diff --git a/README.md b/README.md index 11ff912..f26e64e 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ sonarcloud Downloads *** -From 1.3.2 update exch_srv_cfg.toml (see CHANGELOG for details) +From 1.3.2 update exch_srv_cfg.toml (see [CHANGELOG](https://github.com/DogsTailFarmer/exchanges-wrapper/blob/master/CHANGELOG.md#added-for-new-features) for details) *** ## exchanges-wrapper vs binance.py @@ -45,7 +45,7 @@ Served methods describes into ```example/exch_client.py``` - Passthrough logging - WSS keepalive - Reuse session for new client sessions -- Utilize Websocket API (bidirectional) for the most commonly used methods (Binance ws-api/v3, ) +- Utilizing Websocket API (bidirectional) for the most commonly used methods (Binance ws-api/v3, ) ## Extra exchanges implementation features - Binance REST API and WSS are accepted as basic, connection of other exchanges wrapped their API to Binance compatible diff --git a/exchanges_wrapper/__init__.py b/exchanges_wrapper/__init__.py index c4193b6..0321f9a 100644 --- a/exchanges_wrapper/__init__.py +++ b/exchanges_wrapper/__init__.py @@ -12,7 +12,7 @@ __contact__ = "https://github.com/DogsTailFarmer" __email__ = "jerry.fedorenko@yahoo.com" __credits__ = ["https://github.com/DanyaSWorlD"] -__version__ = "1.3.2b4" +__version__ = "1.3.2" from pathlib import Path import shutil diff --git a/exchanges_wrapper/client.py b/exchanges_wrapper/client.py index 1163b6b..baa6ad2 100644 --- a/exchanges_wrapper/client.py +++ b/exchanges_wrapper/client.py @@ -33,54 +33,37 @@ def truncate(f, n): class Client: - def __init__( - self, - exchange, - sub_account, - test_net, - api_key, - api_secret, - endpoint_api_public, - endpoint_ws_public, - endpoint_api_auth, - endpoint_ws_auth, - ws_public_mbr, - passphrase, - master_email, - master_name, - two_fa, - endpoint_ws_api - ): - self.exchange = exchange - self.sub_account = sub_account - self.test_net = test_net - self.api_key = api_key - self.api_secret = api_secret - self.passphrase = passphrase - self.endpoint_api_public = endpoint_api_public - self.endpoint_ws_public = endpoint_ws_public - self.endpoint_api_auth = endpoint_api_auth - self.endpoint_ws_auth = endpoint_ws_auth - self.endpoint_ws_api = endpoint_ws_api - self.ws_public_mbr = ws_public_mbr - self.master_email = master_email - self.master_name = master_name - self.two_fa = two_fa + def __init__(self, *acc): + self.exchange = acc[0] + self.sub_account = acc[1] + self.test_net = acc[2] + self.api_key = acc[3] + self.api_secret = acc[4] + self.passphrase = acc[10] + self.endpoint_api_public = acc[5] + self.endpoint_ws_public = acc[6] + self.endpoint_api_auth = acc[7] + self.endpoint_ws_auth = acc[8] + self.endpoint_ws_api = acc[14] + self.ws_public_mbr = acc[9] + self.master_email = acc[11] + self.master_name = acc[12] + self.two_fa = acc[13] # self.session = aiohttp.ClientSession() client_init_params = { - 'api_key': api_key, - 'api_secret': api_secret, - 'passphrase': passphrase, - 'endpoint': endpoint_api_auth, + 'api_key': self.api_key, + 'api_secret': self.api_secret, + 'passphrase': self.passphrase, + 'endpoint': self.endpoint_api_auth, 'session': self.session, - 'exchange': exchange, - 'sub_account': sub_account, - 'test_net': test_net + 'exchange': self.exchange, + 'sub_account': self.sub_account, + 'test_net': self.test_net } self.user_wss_session = None - if exchange == 'binance': + if self.exchange == 'binance': self.http = ClientBinance(**client_init_params) self.user_wss_session = UserWSSession( self.api_key, @@ -88,14 +71,14 @@ def __init__( self.session, self.endpoint_ws_api ) - elif exchange == 'bitfinex': + elif self.exchange == 'bitfinex': self.http = ClientBFX(**client_init_params) - elif exchange == 'huobi': + elif self.exchange == 'huobi': self.http = ClientHBP(**client_init_params) - elif exchange == 'okx': + elif self.exchange == 'okx': self.http = ClientOKX(**client_init_params) else: - raise UserWarning(f"Exchange {exchange} not yet connected") + raise UserWarning(f"Exchange {self.exchange} not yet connected") # self.loaded = False self.symbols = {} @@ -112,7 +95,6 @@ def __init__( self.hbp_main_uid = None self.ledgers_id = [] - async def load(self): infos = await self.fetch_exchange_info() if infos.get('serverTime'): diff --git a/exchanges_wrapper/web_sockets.py b/exchanges_wrapper/web_sockets.py index 9f4a8a2..80a6634 100644 --- a/exchanges_wrapper/web_sockets.py +++ b/exchanges_wrapper/web_sockets.py @@ -130,7 +130,7 @@ async def _handle_messages(self, web_socket, symbol=None, ch_type=str()): raise aiohttp.ClientOSError # data handling elif isinstance(msg_data, list) and len(msg_data) == 2 and msg_data[1] == 'hb': - pass + pass # heartbeat message elif isinstance(msg_data, list): if ch_type == 'book' and isinstance(msg_data[1][-1], list): order_book = bfx.OrderBook(msg_data[1], symbol)