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

Method parse_transfer

python/ccxt/extended.py:1885–1914  ·  view source on GitHub ↗
(self, transfer: dict, currency: Currency = None)

Source from the content-addressed store, hash-verified

1883 }
1884
1885 def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
1886 timestamp = self.safe_integer(transfer, 'time')
1887 assetId = self.safe_string(transfer, 'asset')
1888 code = self.get_extended_currency_code_by_id(assetId, currency)
1889 amountString = self.safe_string(transfer, 'amount')
1890 amount = None if (amountString is None) else self.parse_number(Precise.string_abs(amountString))
1891 accountId = self.safe_string(transfer, 'accountId')
1892 counterpartyAccountId = self.safe_string(transfer, 'counterpartyAccountId')
1893 fromAccount = accountId
1894 toAccount = counterpartyAccountId
1895 if (amountString is not None) and not Precise.string_lt(amountString, '0'):
1896 fromAccount = counterpartyAccountId
1897 toAccount = accountId
1898 validSignature = self.safe_bool(transfer, 'validSignature')
1899 status = None
1900 if validSignature is not None:
1901 status = 'ok' if validSignature else 'failed'
1902 else:
1903 status = self.parse_transaction_status(self.safe_string(transfer, 'status'))
1904 return {
1905 'info': transfer,
1906 'id': self.safe_string(transfer, 'id'),
1907 'timestamp': timestamp,
1908 'datetime': self.iso8601(timestamp),
1909 'currency': code,
1910 'amount': amount,
1911 'fromAccount': fromAccount,
1912 'toAccount': toAccount,
1913 'status': status,
1914 }
1915
1916 def get_extended_currency_code_by_id(self, assetId: Str, currency: Currency = None) -> Str:
1917 if assetId is None:

Callers

nothing calls this directly

Calls 9

safe_integerMethod · 0.80
safe_stringMethod · 0.80
parse_numberMethod · 0.80
string_absMethod · 0.80
string_ltMethod · 0.80
safe_boolMethod · 0.80
iso8601Method · 0.45

Tested by

no test coverage detected