Skip to content

Commit

Permalink
1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
DogsTailFarmer committed Dec 8, 2023
1 parent ccca0d8 commit bf98024
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion exchanges_wrapper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
__contact__ = "https://github.com/DogsTailFarmer"
__email__ = "[email protected]"
__credits__ = ["https://github.com/DanyaSWorlD"]
__version__ = "1.4.0"
__version__ = "1.4.1"

from pathlib import Path
import shutil
Expand Down
15 changes: 15 additions & 0 deletions exchanges_wrapper/bybit_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
24 changes: 22 additions & 2 deletions exchanges_wrapper/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit bf98024

Please sign in to comment.