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

Method parse_transaction

python/ccxt/bitget.py:2952–3027  ·  view source on GitHub ↗
(self, transaction: dict, currency: Currency = None)

Source from the content-addressed store, hash-verified

2950 return self.parse_transactions(rawTransactions, currency, since, limit)
2951
2952 def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
2953 #
2954 # fetchDeposits
2955 #
2956 # {
2957 # "orderId": "1083832260799930368",
2958 # "tradeId": "35bf0e588a42b25c71a9d45abe7308cabdeec6b7b423910b9bd4743d3a9a9efa",
2959 # "coin": "BTC",
2960 # "type": "deposit",
2961 # "size": "0.00030000",
2962 # "status": "success",
2963 # "toAddress": "1BfZh7JESJGBUszCGeZnzxbVVvBycbJSbA",
2964 # "dest": "on_chain",
2965 # "chain": "BTC",
2966 # "fromAddress": null,
2967 # "cTime": "1694131668281",
2968 # "uTime": "1694131680247"
2969 # }
2970 #
2971 # fetchWithdrawals
2972 #
2973 # {
2974 # "orderId": "1083832260799930368",
2975 # "tradeId": "35bf0e588a42b25c71a9d45abe7308cabdeec6b7b423910b9bd4743d3a9a9efa",
2976 # "clientOid": "123",
2977 # "coin": "BTC",
2978 # "type": "withdraw",
2979 # "size": "0.00030000",
2980 # "fee": "-1.0000000",
2981 # "status": "success",
2982 # "toAddress": "1BfZh7JESJGBUszCGeZnzxbVVvBycbJSbA",
2983 # "dest": "on_chain",
2984 # "chain": "BTC",
2985 # "confirm": "100",
2986 # "fromAddress": null,
2987 # "cTime": "1694131668281",
2988 # "uTime": "1694131680247"
2989 # }
2990 #
2991 currencyId = self.safe_string(transaction, 'coin')
2992 code = self.safe_currency_code(currencyId, currency)
2993 timestamp = self.safe_integer(transaction, 'cTime')
2994 networkId = self.safe_string(transaction, 'chain')
2995 status = self.safe_string(transaction, 'status')
2996 tag = self.safe_string(transaction, 'tag')
2997 feeCostString = self.safe_string(transaction, 'fee')
2998 feeCostAbsString = None
2999 if feeCostString is not None:
3000 feeCostAbsString = Precise.string_abs(feeCostString)
3001 fee = None
3002 amountString = self.safe_string(transaction, 'size')
3003 if feeCostAbsString is not None:
3004 fee = {'currency': code, 'cost': self.parse_number(feeCostAbsString)}
3005 amountString = Precise.string_sub(amountString, feeCostAbsString)
3006 return {
3007 'id': self.safe_string(transaction, 'orderId'),
3008 'info': transaction,
3009 'txid': self.safe_string(transaction, 'tradeId'),

Callers 1

withdrawMethod · 0.95

Calls 9

safe_stringMethod · 0.80
safe_integerMethod · 0.80
string_absMethod · 0.80
parse_numberMethod · 0.80
string_subMethod · 0.80
safe_currency_codeMethod · 0.45
iso8601Method · 0.45
network_id_to_codeMethod · 0.45

Tested by

no test coverage detected