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

Method parse_currency

python/ccxt/async_support/modetrade.py:661–715  ·  view source on GitHub ↗
(self, rawCurrency: dict)

Source from the content-addressed store, hash-verified

659 return self.parse_currencies(tokenRows)
660
661 def parse_currency(self, rawCurrency: dict) -> Currency:
662 currencyId = self.safe_string(rawCurrency, 'token')
663 networks = self.safe_list(rawCurrency, 'chain_details', [])
664 code = self.safe_currency_code(currencyId)
665 minPrecision = None
666 resultingNetworks = {}
667 for j in range(0, len(networks)):
668 network = networks[j]
669 # TODO: transform chain id to human readable name
670 networkId = self.safe_string(network, 'chain_id')
671 precision = self.parse_precision(self.safe_string(network, 'decimals'))
672 if precision is not None:
673 minPrecision = precision if (minPrecision is None) else Precise.string_min(precision, minPrecision)
674 resultingNetworks[networkId] = {
675 'id': networkId,
676 'network': networkId,
677 'limits': {
678 'withdraw': {
679 'min': None,
680 'max': None,
681 },
682 'deposit': {
683 'min': None,
684 'max': None,
685 },
686 },
687 'active': None,
688 'deposit': None,
689 'withdraw': None,
690 'fee': self.safe_number(network, 'withdrawal_fee'),
691 'precision': self.parse_number(precision),
692 'info': network,
693 }
694 return self.safe_currency_structure({
695 'id': currencyId,
696 'name': currencyId,
697 'code': code,
698 'precision': self.parse_number(minPrecision),
699 'active': None,
700 'fee': None,
701 'networks': resultingNetworks,
702 'deposit': None,
703 'withdraw': None,
704 'limits': {
705 'deposit': {
706 'min': None,
707 'max': None,
708 },
709 'withdraw': {
710 'min': self.safe_number(rawCurrency, 'minimum_withdraw_amount'),
711 'max': None,
712 },
713 },
714 'info': rawCurrency,
715 })
716
717 def parse_token_and_fee_temp(self, item, feeTokenKey, feeAmountKey):
718 feeCost = self.safe_string(item, feeAmountKey)

Callers

nothing calls this directly

Calls 9

safe_stringMethod · 0.80
safe_listMethod · 0.80
parse_precisionMethod · 0.80
string_minMethod · 0.80
safe_numberMethod · 0.80
parse_numberMethod · 0.80
rangeFunction · 0.50
safe_currency_codeMethod · 0.45

Tested by

no test coverage detected