(self, item: dict, currency: Currency = None)
| 2432 | return self.safe_string(types, type, type) |
| 2433 | |
| 2434 | def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry: |
| 2435 | # |
| 2436 | # { |
| 2437 | # "amount":"29.889184", |
| 2438 | # "asset_id":5, |
| 2439 | # "balance":"29.889184", |
| 2440 | # "created_at":"2020-11-15T21:25:01Z", |
| 2441 | # "meta_data":{ |
| 2442 | # "deposit_id":3884, |
| 2443 | # "transaction_id":"0x41a60174849828530abb5008e98fc63c9b598288743ec4ba9620bcce900a3b8d" |
| 2444 | # }, |
| 2445 | # "transaction_type":"deposit", |
| 2446 | # "user_id":22142, |
| 2447 | # "uuid":"70bb5679da3c4637884e2dc63efaa846" |
| 2448 | # } |
| 2449 | # |
| 2450 | id = self.safe_string(item, 'uuid') |
| 2451 | direction = None |
| 2452 | account = None |
| 2453 | metaData = self.safe_dict(item, 'meta_data', {}) |
| 2454 | referenceId = self.safe_string(metaData, 'transaction_id') |
| 2455 | referenceAccount = None |
| 2456 | type = self.safe_string(item, 'transaction_type') |
| 2457 | if (type == 'deposit') or (type == 'commission_rebate') or (type == 'referral_bonus') or (type == 'pnl') or (type == 'withdrawal_cancellation') or (type == 'promo_credit'): |
| 2458 | direction = 'in' |
| 2459 | elif (type == 'withdrawal') or (type == 'commission') or (type == 'conversion') or (type == 'perpetual_futures_funding'): |
| 2460 | direction = 'out' |
| 2461 | type = self.parse_ledger_entry_type(type) |
| 2462 | currencyId = self.safe_string(item, 'asset_id') |
| 2463 | currenciesByNumericId = self.safe_dict(self.options, 'currenciesByNumericId') |
| 2464 | currency = self.safe_value(currenciesByNumericId, currencyId, currency) |
| 2465 | code = None if (currency is None) else currency['code'] |
| 2466 | amount = self.safe_string(item, 'amount') |
| 2467 | timestamp = self.parse8601(self.safe_string(item, 'created_at')) |
| 2468 | after = self.safe_string(item, 'balance') |
| 2469 | before = Precise.string_max('0', Precise.string_sub(after, amount)) |
| 2470 | status = 'ok' |
| 2471 | return self.safe_ledger_entry({ |
| 2472 | 'info': item, |
| 2473 | 'id': id, |
| 2474 | 'direction': direction, |
| 2475 | 'account': account, |
| 2476 | 'referenceId': referenceId, |
| 2477 | 'referenceAccount': referenceAccount, |
| 2478 | 'type': type, |
| 2479 | 'currency': code, |
| 2480 | 'amount': self.parse_number(amount), |
| 2481 | 'before': self.parse_number(before), |
| 2482 | 'after': self.parse_number(after), |
| 2483 | 'status': status, |
| 2484 | 'timestamp': timestamp, |
| 2485 | 'datetime': self.iso8601(timestamp), |
| 2486 | 'fee': None, |
| 2487 | }, currency) |
| 2488 | |
| 2489 | def fetch_deposit_address(self, code: str, params={}) -> DepositAddress: |
| 2490 | """ |
nothing calls this directly
no test coverage detected