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

Method parse_transaction

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

Source from the content-addressed store, hash-verified

2289 return self.parse_ledger(rows, currency, since, limit, params)
2290
2291 def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
2292 # example in fetchLedger
2293 code = self.safe_string(transaction, 'token')
2294 movementDirection = self.safe_string_lower(transaction, 'token_side')
2295 if movementDirection == 'withdraw':
2296 movementDirection = 'withdrawal'
2297 fee = self.parse_token_and_fee_temp(transaction, 'fee_token', 'fee_amount')
2298 addressTo = self.safe_string(transaction, 'target_address')
2299 addressFrom = self.safe_string(transaction, 'source_address')
2300 timestamp = self.safe_integer(transaction, 'created_time')
2301 return {
2302 'info': transaction,
2303 'id': self.safe_string_2(transaction, 'id', 'withdraw_id'),
2304 'txid': self.safe_string(transaction, 'tx_id'),
2305 'timestamp': timestamp,
2306 'datetime': self.iso8601(timestamp),
2307 'address': None,
2308 'addressFrom': addressFrom,
2309 'addressTo': addressTo,
2310 'tag': self.safe_string(transaction, 'extra'),
2311 'tagFrom': None,
2312 'tagTo': None,
2313 'type': movementDirection,
2314 'amount': self.safe_number(transaction, 'amount'),
2315 'currency': code,
2316 'status': self.parse_transaction_status(self.safe_string(transaction, 'status')),
2317 'updated': self.safe_integer(transaction, 'updated_time'),
2318 'comment': None,
2319 'internal': None,
2320 'fee': fee,
2321 'network': None,
2322 }
2323
2324 def parse_transaction_status(self, status: Str):
2325 statuses = {

Callers 1

withdrawMethod · 0.95

Calls 8

safe_stringMethod · 0.80
safe_string_lowerMethod · 0.80
safe_integerMethod · 0.80
safe_string_2Method · 0.80
safe_numberMethod · 0.80
iso8601Method · 0.45

Tested by

no test coverage detected