diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cf80f7..a9272ba 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v1.4.1 2023-12-01 +### Update +* Bybit: fetch_ledgers(): get transfer event from Sub account to Main account on Main account + ## v1.4.0 2023-11-23 ### Update * Some minor improvements diff --git a/exchanges_wrapper/__init__.py b/exchanges_wrapper/__init__.py index ba82528..e78446c 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.4.0" +__version__ = "1.4.1" from pathlib import Path import shutil diff --git a/exchanges_wrapper/bybit_parser.py b/exchanges_wrapper/bybit_parser.py index 738cb28..e5afefc 100644 --- a/exchanges_wrapper/bybit_parser.py +++ b/exchanges_wrapper/bybit_parser.py @@ -463,6 +463,21 @@ 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: + data_out.append( + { + i['id']: { + 'e': 'balanceUpdate', + 'E': i['transactionTime'], + 'a': i['currency'], + 'd': i['cashFlow'], + 'T': ts, + } + } + ) + return data_out diff --git a/exchanges_wrapper/client.py b/exchanges_wrapper/client.py index dffe6c6..4fa950f 100644 --- a/exchanges_wrapper/client.py +++ b/exchanges_wrapper/client.py @@ -454,8 +454,8 @@ async def fetch_ledgers(self, symbol, limit=25): ) _res = bbt.on_balance_update(res['list'], ts, symbol, 'internal') - # Universal Transfer Records, ie from Main account to Sub account - res, _ = await self.http.send_api_call( + # Universal Transfer Records, ie from Sub account to Main account + res, ts = await self.http.send_api_call( "/v5/asset/transfer/query-universal-transfer-list", signed=True, **params @@ -467,6 +467,26 @@ async def fetch_ledgers(self, symbol, limit=25): 'universal', 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' + ) + for i in _res: _id = next(iter(i)) if _id not in self.ledgers_id: