(self, item: dict, currency: Currency = None)
| 11395 | return self.parse_ledger(response, currency, since, limit) |
| 11396 | |
| 11397 | def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry: |
| 11398 | # |
| 11399 | # options(eapi) |
| 11400 | # |
| 11401 | # { |
| 11402 | # "id": "1125899906845701870", |
| 11403 | # "asset": "USDT", |
| 11404 | # "amount": "-0.16518203", |
| 11405 | # "type": "FEE", |
| 11406 | # "createDate": 167662104241 |
| 11407 | # } |
| 11408 | # |
| 11409 | # futures(fapi, dapi, papi) |
| 11410 | # |
| 11411 | # { |
| 11412 | # "symbol": "", |
| 11413 | # "incomeType": "TRANSFER", |
| 11414 | # "income": "10.00000000", |
| 11415 | # "asset": "USDT", |
| 11416 | # "time": 1677645250000, |
| 11417 | # "info": "TRANSFER", |
| 11418 | # "tranId": 131001573082, |
| 11419 | # "tradeId": "" |
| 11420 | # } |
| 11421 | # |
| 11422 | amount = self.safe_string_2(item, 'amount', 'income') |
| 11423 | direction = None |
| 11424 | if Precise.string_le(amount, '0'): |
| 11425 | direction = 'out' |
| 11426 | amount = Precise.string_mul('-1', amount) |
| 11427 | else: |
| 11428 | direction = 'in' |
| 11429 | currencyId = self.safe_string(item, 'asset') |
| 11430 | code = self.safe_currency_code(currencyId, currency) |
| 11431 | currency = self.safe_currency(currencyId, currency) |
| 11432 | timestamp = self.safe_integer_2(item, 'createDate', 'time') |
| 11433 | type = self.safe_string_2(item, 'type', 'incomeType') |
| 11434 | return self.safe_ledger_entry({ |
| 11435 | 'info': item, |
| 11436 | 'id': self.safe_string_2(item, 'id', 'tranId'), |
| 11437 | 'direction': direction, |
| 11438 | 'account': None, |
| 11439 | 'referenceAccount': None, |
| 11440 | 'referenceId': self.safe_string(item, 'tradeId'), |
| 11441 | 'type': self.parse_ledger_entry_type(type), |
| 11442 | 'currency': code, |
| 11443 | 'amount': self.parse_number(amount), |
| 11444 | 'timestamp': timestamp, |
| 11445 | 'datetime': self.iso8601(timestamp), |
| 11446 | 'before': None, |
| 11447 | 'after': None, |
| 11448 | 'status': None, |
| 11449 | 'fee': None, |
| 11450 | }, currency) |
| 11451 | |
| 11452 | def parse_ledger_entry_type(self, type): |
| 11453 | ledgerType = { |
no test coverage detected