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

Method parse_transaction

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

Source from the content-addressed store, hash-verified

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