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

Method parse_currency

python/ccxt/hyperliquid.py:469–509  ·  view source on GitHub ↗
(self, rawCurrency: dict)

Source from the content-addressed store, hash-verified

467 return self.parse_currencies(tokens)
468
469 def parse_currency(self, rawCurrency: dict) -> Currency:
470 # id = i
471 id = self.safe_string(rawCurrency, 'index')
472 name = self.safe_string(rawCurrency, 'name')
473 code = self.safe_currency_code(name)
474 self.options['cachedCurrenciesById'][id] = name
475 result = self.safe_currency_structure({
476 'id': id,
477 'name': name,
478 'code': code,
479 'precision': self.parse_precision(self.safe_string(rawCurrency, 'weiDecimals')),
480 'info': rawCurrency,
481 'active': None,
482 'deposit': None,
483 'withdraw': None,
484 'networks': None,
485 'fee': None,
486 'type': 'crypto',
487 'limits': {
488 'amount': {
489 'min': None,
490 'max': None,
491 },
492 'withdraw': {
493 'min': None,
494 'max': None,
495 },
496 },
497 })
498 # add in wrapped map
499 fullName = self.safe_string(rawCurrency, 'fullName')
500 if fullName is not None and name is not None:
501 isWrapped = fullName.startswith('Unit ') and name.startswith('U')
502 if isWrapped:
503 parts = name.split('U')
504 nameWithoutU = ''
505 for j in range(0, len(parts)):
506 nameWithoutU = nameWithoutU + parts[j]
507 baseCode = self.safe_currency_code(nameWithoutU)
508 self.options['spotCurrencyMapping'][code] = baseCode
509 return result
510
511 def fetch_markets(self, params={}) -> List[Market]:
512 """

Callers

nothing calls this directly

Calls 6

safe_stringMethod · 0.80
parse_precisionMethod · 0.80
splitMethod · 0.80
rangeFunction · 0.50
safe_currency_codeMethod · 0.45

Tested by

no test coverage detected