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

Method parse_currency

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

Source from the content-addressed store, hash-verified

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