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

Method parse_transaction

python/ccxt/ascendex.py:2644–2697  ·  view source on GitHub ↗
(self, transaction: dict, currency: Currency = None)

Source from the content-addressed store, hash-verified

2642 return self.safe_string(statuses, status, status)
2643
2644 def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
2645 #
2646 # {
2647 # "requestId": "wuzd1Ojsqtz4bCA3UXwtUnnJDmU8PiyB",
2648 # "time": 1591606166000,
2649 # "asset": "USDT",
2650 # "transactionType": "deposit",
2651 # "amount": "25",
2652 # "commission": "0",
2653 # "networkTransactionId": "0xbc4eabdce92f14dbcc01d799a5f8ca1f02f4a3a804b6350ea202be4d3c738fce",
2654 # "status": "pending",
2655 # "numConfirmed": 8,
2656 # "numConfirmations": 20,
2657 # "destAddress": {
2658 # "address": "0xe7c70b4e73b6b450ee46c3b5c0f5fb127ca55722",
2659 # "destTag": "..." # for currencies that have it
2660 # }
2661 # }
2662 #
2663 destAddress = self.safe_dict(transaction, 'destAddress', {})
2664 address = self.safe_string(destAddress, 'address')
2665 tag = self.safe_string(destAddress, 'destTag')
2666 timestamp = self.safe_integer(transaction, 'time')
2667 currencyId = self.safe_string(transaction, 'asset')
2668 amountString = self.safe_string(transaction, 'amount')
2669 feeCostString = self.safe_string(transaction, 'commission')
2670 amountString = Precise.string_sub(amountString, feeCostString)
2671 code = self.safe_currency_code(currencyId, currency)
2672 return {
2673 'info': transaction,
2674 'id': self.safe_string(transaction, 'requestId'),
2675 'txid': self.safe_string(transaction, 'networkTransactionId'),
2676 'type': self.safe_string(transaction, 'transactionType'),
2677 'currency': code,
2678 'network': None,
2679 'amount': self.parse_number(amountString),
2680 'status': self.parse_transaction_status(self.safe_string(transaction, 'status')),
2681 'timestamp': timestamp,
2682 'datetime': self.iso8601(timestamp),
2683 'address': address,
2684 'addressFrom': None,
2685 'addressTo': address,
2686 'tag': tag,
2687 'tagFrom': None,
2688 'tagTo': tag,
2689 'updated': None,
2690 'comment': None,
2691 'fee': {
2692 'currency': code,
2693 'cost': self.parse_number(feeCostString),
2694 'rate': None,
2695 },
2696 'internal': False,
2697 }
2698
2699 def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
2700 """

Callers

nothing calls this directly

Calls 8

safe_dictMethod · 0.80
safe_stringMethod · 0.80
safe_integerMethod · 0.80
string_subMethod · 0.80
parse_numberMethod · 0.80
safe_currency_codeMethod · 0.45
iso8601Method · 0.45

Tested by

no test coverage detected