MCPcopy Create free account
hub / github.com/ccxt/ccxt / parse_transaction

Method parse_transaction

python/ccxt/upbit.py:1586–1650  ·  view source on GitHub ↗
(self, transaction: dict, currency: Currency = None)

Source from the content-addressed store, hash-verified

1584 return self.safe_string(statuses, status, status)
1585
1586 def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
1587 #
1588 # fetchDeposits, fetchDeposit
1589 #
1590 # {
1591 # "type": "deposit",
1592 # "uuid": "94332e99-3a87-4a35-ad98-28b0c969f830",
1593 # "currency": "KRW",
1594 # "txid": "9e37c537-6849-4c8b-a134-57313f5dfc5a",
1595 # "state": "ACCEPTED",
1596 # "created_at": "2017-12-08T15:38:02+09:00",
1597 # "done_at": "2017-12-08T15:38:02+09:00",
1598 # "amount": "100000.0",
1599 # "fee": "0.0"
1600 # }
1601 #
1602 # fetchWithdrawals, fetchWithdrawal
1603 #
1604 # {
1605 # "type": "withdraw",
1606 # "uuid": "9f432943-54e0-40b7-825f-b6fec8b42b79",
1607 # "currency": "BTC",
1608 # "txid": "cd81e9b45df8da29f936836e58c907a106057e454a45767a7b06fcb19b966bba",
1609 # "state": "processing",
1610 # "created_at": "2018-04-13T11:24:01+09:00",
1611 # "done_at": null,
1612 # "amount": "0.01",
1613 # "fee": "0.0",
1614 # "krw_amount": "80420.0"
1615 # }
1616 #
1617 address = None # not present in the data structure received from the exchange
1618 tag = None # not present in the data structure received from the exchange
1619 updatedRaw = self.safe_string(transaction, 'done_at')
1620 timestamp = self.parse8601(self.safe_string(transaction, 'created_at', updatedRaw))
1621 type = self.safe_string(transaction, 'type')
1622 if type == 'withdraw':
1623 type = 'withdrawal'
1624 currencyId = self.safe_string(transaction, 'currency')
1625 code = self.safe_currency_code(currencyId, currency)
1626 return {
1627 'info': transaction,
1628 'id': self.safe_string(transaction, 'uuid'),
1629 'currency': code,
1630 'amount': self.safe_number(transaction, 'amount'),
1631 'network': None,
1632 'address': address,
1633 'addressTo': None,
1634 'addressFrom': None,
1635 'tag': tag,
1636 'tagTo': None,
1637 'tagFrom': None,
1638 'status': self.parse_transaction_status(self.safe_string_lower(transaction, 'state')),
1639 'type': type,
1640 'updated': self.parse8601(updatedRaw),
1641 'txid': self.safe_string(transaction, 'txid'),
1642 'timestamp': timestamp,
1643 'datetime': self.iso8601(timestamp),

Callers 3

fetch_depositMethod · 0.95
fetch_withdrawalMethod · 0.95
withdrawMethod · 0.95

Calls 7

safe_stringMethod · 0.80
safe_numberMethod · 0.80
safe_string_lowerMethod · 0.80
parse8601Method · 0.45
safe_currency_codeMethod · 0.45
iso8601Method · 0.45

Tested by

no test coverage detected