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

Method parse_transaction

python/ccxt/bybit.py:5801–5877  ·  view source on GitHub ↗
(self, transaction: dict, currency: Currency = None)

Source from the content-addressed store, hash-verified

5799 return self.safe_string(statuses, status, status)
5800
5801 def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
5802 #
5803 # fetchWithdrawals
5804 #
5805 # {
5806 # "coin": "USDT",
5807 # "chain": "TRX",
5808 # "amount": "12.34",
5809 # "txID": "de5ea0a2f2e59dc9a714837dd3ddc6d5e151b56ec5d786d351c4f52336f80d3c",
5810 # "status": "success",
5811 # "toAddress": "TQdmFKUoe1Lk2iwZuwRJEHJreTUBoN3BAw",
5812 # "tag": "",
5813 # "withdrawFee": "0.5",
5814 # "createTime": "1665144183000",
5815 # "updateTime": "1665144256000",
5816 # "withdrawId": "8839035"
5817 # }
5818 #
5819 # fetchDeposits
5820 #
5821 # {
5822 # "coin": "USDT",
5823 # "chain": "TRX",
5824 # "amount": "44",
5825 # "txID": "0b038ea12fa1575e2d66693db3c346b700d4b28347afc39f80321cf089acc960",
5826 # "status": "3",
5827 # "toAddress": "TC6NCAC5WSVCCiaD3kWZXyW91ZKKhLm53b",
5828 # "tag": "",
5829 # "depositFee": "",
5830 # "successAt": "1665142507000",
5831 # "confirmations": "100",
5832 # "txIndex": "0",
5833 # "blockHash": "0000000002ac3b1064aee94bca1bd0b58c4c09c65813b084b87a2063d961129e"
5834 # }
5835 #
5836 # withdraw
5837 #
5838 # {
5839 # "id": "9377266"
5840 # }
5841 #
5842 currencyId = self.safe_string(transaction, 'coin')
5843 code = self.safe_currency_code(currencyId, currency)
5844 timestamp = self.safe_integer_2(transaction, 'createTime', 'successAt')
5845 updated = self.safe_integer(transaction, 'updateTime')
5846 status = self.parse_transaction_status(self.safe_string(transaction, 'status'))
5847 feeCost = self.safe_number_2(transaction, 'depositFee', 'withdrawFee')
5848 type = 'deposit' if ('depositFee' in transaction) else 'withdrawal'
5849 fee = None
5850 if feeCost is not None:
5851 fee = {
5852 'cost': feeCost,
5853 'currency': code,
5854 }
5855 toAddress = self.safe_string(transaction, 'toAddress')
5856 return {
5857 'info': transaction,
5858 'id': self.safe_string_2(transaction, 'id', 'withdrawId'),

Callers 1

withdrawMethod · 0.95

Calls 10

safe_stringMethod · 0.80
safe_integer_2Method · 0.80
safe_integerMethod · 0.80
safe_number_2Method · 0.80
safe_string_2Method · 0.80
safe_numberMethod · 0.80
safe_currency_codeMethod · 0.45
iso8601Method · 0.45
network_id_to_codeMethod · 0.45

Tested by

no test coverage detected