diff --git a/CHANGELOG.md b/CHANGELOG.md index 64b2a92..9a1404e 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 2.1.13 2024-06-26 +### Fix +* `HTX`: WSS missed account change event + +### Update +* Dependency + ## 2.1.12 2024-04-30 ### Fix * `Docker`: [#49 ImportError: cannot import name 'version' from 'exchanges_wrapper'](https://github.com/DogsTailFarmer/exchanges-wrapper/issues/49#issue-2272432093) @@ -31,14 +38,14 @@ ## 2.1.6 2024-03-29 ### Fix -* Bybit: `on_balance_update`: missed event during transfer from API +* `Bybit`: `on_balance_update`: missed event during transfer from API ### Update * Dependency: Up requirements for crypto-ws-api==2.0.8 ## 2.1.5 2024-03-25 ### Fix -* Bybit: `on_balance_update`: duplication during transfer from web-interface +* `Bybit`: `on_balance_update`: duplication during transfer from web-interface * Some exception handling ### Update diff --git a/exchanges_wrapper/__init__.py b/exchanges_wrapper/__init__.py index ef188f3..492a2e8 100755 --- 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__ = "2.1.12" +__version__ = "2.1.13" from pathlib import Path import shutil diff --git a/exchanges_wrapper/web_sockets.py b/exchanges_wrapper/web_sockets.py index a9a9c88..f266a2a 100644 --- a/exchanges_wrapper/web_sockets.py +++ b/exchanges_wrapper/web_sockets.py @@ -408,23 +408,22 @@ async def start_wss(self): async def _handle_event(self, msg_data, *args): content = None + _ch = msg_data['ch'] _data = msg_data.get('data') - if _data.get('symbol') == self.symbol.lower(): - if msg_data['ch'] == 'accounts.update#2': - content = hbp.on_funds_update(_data) - elif (msg_data['ch'] == f"orders#{self.symbol.lower()}" - and _data['eventType'] in ('creation', 'cancellation')): - order_id = _data['orderId'] - self.client.active_order(order_id, quantity=_data['orderSize']) - if _data.get('eventType') == 'cancellation': - self.client.active_orders[order_id]['cancelled'] = True - elif msg_data['ch'] == f"trade.clearing#{self.symbol.lower()}#0": - order_id = _data['orderId'] - self.client.active_order(order_id, last_event=_data) - if _data['tradeId'] not in self.client.active_orders[order_id]["eventIds"]: - self.client.active_orders[order_id]["eventIds"].append(_data['tradeId']) - self.client.active_orders[order_id]['executedQty'] += Decimal(_data['tradeVolume']) - content = hbp.on_order_update(self.client.active_orders[order_id]) + if _ch == 'accounts.update#2' and _data.get('currency') in self.symbol.lower(): + content = hbp.on_funds_update(_data) + elif _ch == f"orders#{self.symbol.lower()}" and _data['eventType'] in ('creation', 'cancellation'): + order_id = _data['orderId'] + self.client.active_order(order_id, quantity=_data['orderSize']) + if _data.get('eventType') == 'cancellation': + self.client.active_orders[order_id]['cancelled'] = True + elif _ch == f"trade.clearing#{self.symbol.lower()}#0": + order_id = _data['orderId'] + self.client.active_order(order_id, last_event=_data) + if _data['tradeId'] not in self.client.active_orders[order_id]["eventIds"]: + self.client.active_orders[order_id]["eventIds"].append(_data['tradeId']) + self.client.active_orders[order_id]['executedQty'] += Decimal(_data['tradeVolume']) + content = hbp.on_order_update(self.client.active_orders[order_id]) if content: logger.debug(f"HTXPrivateEvents.content: {content}") diff --git a/pyproject.toml b/pyproject.toml index 0611ed5..695a67a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,15 +17,15 @@ dynamic = ["version", "description"] requires-python = ">=3.9" dependencies = [ - "crypto-ws-api==2.0.11", + "crypto-ws-api==2.0.12", "grpcio==1.62.0", "pyotp~=2.9.0", "simplejson==3.19.2", - "aiohttp==3.9.3", + "aiohttp==3.9.5", "Pympler~=1.0.1", "websockets~=12.0", "expiringdict~=1.2.2", - "ujson~=5.9.0", + "ujson~=5.10.0", "betterproto==2.0.0b6", "grpclib~=0.4.7" ] diff --git a/requirements.txt b/requirements.txt index 8de6164..6620899 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,11 @@ -crypto-ws-api==2.0.11 +crypto-ws-api==2.0.12 pyotp==2.9.0 simplejson==3.19.2 toml~=0.10.2 -aiohttp~=3.9.0 +aiohttp~=3.9.5 Pympler~=1.0.1 websockets==12.0 expiringdict~=1.2.2 -ujson~=5.9.0 +ujson~=5.10.0 betterproto==2.0.0b6 grpclib~=0.4.7