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

Method parse_currency

python/ccxt/async_support/ascendex.py:540–595  ·  view source on GitHub ↗
(self, rawCurrency: dict)

Source from the content-addressed store, hash-verified

538 return self.parse_currencies(data)
539
540 def parse_currency(self, rawCurrency: dict) -> Currency:
541 id = self.safe_string(rawCurrency, 'assetCode')
542 code = self.safe_currency_code(id)
543 chains = self.safe_list(rawCurrency, 'blockChain', [])
544 precision = self.parse_number(self.parse_precision(self.safe_string(rawCurrency, 'nativeScale')))
545 networks = {}
546 for j in range(0, len(chains)):
547 networkEtnry = chains[j]
548 networkId = self.safe_string(networkEtnry, 'chainName')
549 networkCode = self.network_code_to_id(networkId, code)
550 networks[networkCode] = {
551 'fee': self.safe_number(networkEtnry, 'withdrawFee'),
552 'active': None,
553 'withdraw': self.safe_bool(networkEtnry, 'allowWithdraw'),
554 'deposit': self.safe_bool(networkEtnry, 'allowDeposit'),
555 'precision': precision,
556 'limits': {
557 'amount': {
558 'min': None,
559 'max': None,
560 },
561 'withdraw': {
562 'min': self.safe_number(networkEtnry, 'minWithdrawal'),
563 'max': None,
564 },
565 'deposit': {
566 'min': self.safe_number(networkEtnry, 'minDepositAmt'),
567 'max': None,
568 },
569 },
570 }
571 # todo type: if chainsLength == 0 and (assetName.endswith(' Staking') or assetName.find(' Reward ') >= 0 or assetName.find('Slot Auction') >= 0 or assetName.find(' Freeze Asset') >= 0):
572 return self.safe_currency_structure({
573 'id': id,
574 'code': code,
575 'info': rawCurrency,
576 'type': None,
577 'margin': None,
578 'name': self.safe_string(rawCurrency, 'assetName'),
579 'active': None,
580 'deposit': None,
581 'withdraw': None,
582 'fee': None,
583 'precision': precision,
584 'limits': {
585 'amount': {
586 'min': None,
587 'max': None,
588 },
589 'withdraw': {
590 'min': self.safe_number(rawCurrency, 'minWithdrawalAmt'),
591 'max': None,
592 },
593 },
594 'networks': networks,
595 })
596
597 async def fetch_markets(self, params={}) -> List[Market]:

Callers

nothing calls this directly

Calls 10

safe_stringMethod · 0.80
safe_listMethod · 0.80
parse_numberMethod · 0.80
parse_precisionMethod · 0.80
safe_numberMethod · 0.80
safe_boolMethod · 0.80
rangeFunction · 0.50
safe_currency_codeMethod · 0.45
network_code_to_idMethod · 0.45

Tested by

no test coverage detected