(self, item: dict, currency: Currency = None)
| 6048 | return self.parse_ledger(data, currency, since, limit) |
| 6049 | |
| 6050 | def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry: |
| 6051 | # |
| 6052 | # { |
| 6053 | # "id": 234467, |
| 6054 | # "user_id": 1, |
| 6055 | # "coin": "BTC", |
| 6056 | # "wallet_id": 27913, |
| 6057 | # "type": "Realized P&L", |
| 6058 | # "amount": "-0.00000006", |
| 6059 | # "tx_id": "", |
| 6060 | # "address": "BTCUSD", |
| 6061 | # "wallet_balance": "0.03000330", |
| 6062 | # "exec_time": "2019-12-09T00:00:25.000Z", |
| 6063 | # "cross_seq": 0 |
| 6064 | # } |
| 6065 | # |
| 6066 | # { |
| 6067 | # "symbol": "XRPUSDT", |
| 6068 | # "side": "Buy", |
| 6069 | # "funding": "", |
| 6070 | # "orderLinkId": "linear-order", |
| 6071 | # "orderId": "592b7e41-78fd-42e2-9aa3-91e1835ef3e1", |
| 6072 | # "fee": "0.00260280", |
| 6073 | # "change": "-0.0026028", |
| 6074 | # "cashFlow": "0", |
| 6075 | # "transactionTime": "1672121182224", |
| 6076 | # "type": "TRADE", |
| 6077 | # "feeRate": "0.0006", |
| 6078 | # "size": "12", |
| 6079 | # "qty": "12", |
| 6080 | # "cashBalance": "5086.58101322", |
| 6081 | # "currency": "USDT", |
| 6082 | # "category": "linear", |
| 6083 | # "tradePrice": "0.3615", |
| 6084 | # "tradeId": "8569c10f-5061-5891-81c4-a54929847eb3" |
| 6085 | # } |
| 6086 | # |
| 6087 | currencyId = self.safe_string_2(item, 'coin', 'currency') |
| 6088 | code = self.safe_currency_code(currencyId, currency) |
| 6089 | currency = self.safe_currency(currencyId, currency) |
| 6090 | amountString = self.safe_string_2(item, 'amount', 'change') |
| 6091 | afterString = self.safe_string_2(item, 'wallet_balance', 'cashBalance') |
| 6092 | direction = 'out' if Precise.string_lt(amountString, '0') else 'in' |
| 6093 | before = None |
| 6094 | after = None |
| 6095 | amount = None |
| 6096 | if afterString is not None and amountString is not None: |
| 6097 | difference = amountString if (direction == 'out') else Precise.string_neg(amountString) |
| 6098 | before = self.parse_to_numeric(Precise.string_add(afterString, difference)) |
| 6099 | after = self.parse_to_numeric(afterString) |
| 6100 | amount = self.parse_to_numeric(Precise.string_abs(amountString)) |
| 6101 | timestamp = self.parse8601(self.safe_string(item, 'exec_time')) |
| 6102 | if timestamp is None: |
| 6103 | timestamp = self.safe_integer(item, 'transactionTime') |
| 6104 | return self.safe_ledger_entry({ |
| 6105 | 'info': item, |
| 6106 | 'id': self.safe_string(item, 'id'), |
| 6107 | 'direction': direction, |
nothing calls this directly
no test coverage detected