From dd50515c33b08a8eb55204bb82399274f4fe8b8e Mon Sep 17 00:00:00 2001 From: DogsTaiFarmer Date: Sun, 7 Jul 2024 14:47:31 +0300 Subject: [PATCH] 2.1.14 --- CHANGELOG.md | 4 +++ exchanges_wrapper/__init__.py | 2 +- exchanges_wrapper/client.py | 36 +++++++++++------------ exchanges_wrapper/parsers/bybit_parser.py | 3 -- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a1404e..3e0b7fc 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.1.14 2024-07-07 +### Fix +* `Bybit`: `fetch_ledgers()` doubling of incoming transfers to a subaccount + ## 2.1.13 2024-06-26 ### Fix * `HTX`: WSS missed account change event diff --git a/exchanges_wrapper/__init__.py b/exchanges_wrapper/__init__.py index 492a2e8..7e905db 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.13" +__version__ = "2.1.14" from pathlib import Path import shutil diff --git a/exchanges_wrapper/client.py b/exchanges_wrapper/client.py index d08b53a..b9b0791 100644 --- a/exchanges_wrapper/client.py +++ b/exchanges_wrapper/client.py @@ -493,24 +493,24 @@ async def fetch_ledgers(self, symbol, limit=25): uid=self.account_uid ) - params.pop('status') - params['accountType'] = 'UNIFIED' - params['category'] = 'spot' - params['type'] = 'TRANSFER_IN' - - # Get Transaction Log - res, ts = await self.http.send_api_call( - "/v5/account/transaction-log", - signed=True, - **params - ) - - _res += bbt.on_balance_update( - res['list'], - ts, - symbol, - 'log' - ) + if not _res: + # Get Transaction Log + params.pop('status') + params['accountType'] = 'UNIFIED' + params['category'] = 'spot' + params['type'] = 'TRANSFER_IN' + + res, ts = await self.http.send_api_call( + "/v5/account/transaction-log", + signed=True, + **params + ) + _res += bbt.on_balance_update( + res['list'], + ts, + symbol, + 'log' + ) for i in _res: _id = next(iter(i)) diff --git a/exchanges_wrapper/parsers/bybit_parser.py b/exchanges_wrapper/parsers/bybit_parser.py index 47cd1e9..c55f685 100644 --- a/exchanges_wrapper/parsers/bybit_parser.py +++ b/exchanges_wrapper/parsers/bybit_parser.py @@ -452,7 +452,6 @@ def on_balance_update(data_in: list, ts: str, symbol: str, mode: str, uid=None) } } ) - elif mode == 'universal': for i in data_in: if i['coin'] in symbol and \ @@ -469,7 +468,6 @@ def on_balance_update(data_in: list, ts: str, symbol: str, mode: str, uid=None) } } ) - elif mode == 'log': for i in data_in: if i['currency'] in symbol: @@ -484,7 +482,6 @@ def on_balance_update(data_in: list, ts: str, symbol: str, mode: str, uid=None) } } ) - return data_out