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

Method parse_currency

python/ccxt/zebpay.py:376–450  ·  view source on GitHub ↗
(self, rawCurrency: dict)

Source from the content-addressed store, hash-verified

374 return self.parse_currencies(rows)
375
376 def parse_currency(self, rawCurrency: dict) -> Currency:
377 currencyId = self.safe_string(rawCurrency, 'currency')
378 code = self.safe_currency_code(currencyId)
379 name = self.safe_string(rawCurrency, 'name')
380 precision = self.parse_number(self.parse_precision(self.safe_string(rawCurrency, 'precision')))
381 chains = self.safe_list(rawCurrency, 'chains', [])
382 networks = {}
383 minWithdrawFeeString = None
384 minWithdrawString = None
385 minDepositString = None
386 deposit = False
387 withdraw = False
388 for j in range(0, len(chains)):
389 chain = chains[j]
390 networkId = self.safe_string(chain, 'chainId')
391 networkCode = self.network_id_to_code(networkId, code)
392 depositAllowed = self.safe_bool(chain, 'isDepositEnabled') is True
393 deposit = depositAllowed if (depositAllowed) else deposit
394 withdrawAllowed = self.safe_bool(chain, 'isWithdrawEnabled') is True
395 withdraw = withdrawAllowed if (withdrawAllowed) else withdraw
396 withdrawFeeString = self.safe_string(chain, 'withdrawalFee')
397 if withdrawFeeString is not None:
398 minWithdrawFeeString = withdrawFeeString if (minWithdrawFeeString is None) else Precise.string_min(withdrawFeeString, minWithdrawFeeString)
399 minNetworkWithdrawString = self.safe_string(chain, 'withdrawalMinSize')
400 if minNetworkWithdrawString is not None:
401 minWithdrawString = minNetworkWithdrawString if (minWithdrawString is None) else Precise.string_min(minNetworkWithdrawString, minWithdrawString)
402 minNetworkDepositString = self.safe_string(chain, 'depositMinSize')
403 if minNetworkDepositString is not None:
404 minDepositString = minNetworkDepositString if (minDepositString is None) else Precise.string_min(minNetworkDepositString, minDepositString)
405 networks[networkCode] = {
406 'info': chain,
407 'id': networkId,
408 'network': networkCode,
409 'active': depositAllowed and withdrawAllowed,
410 'deposit': depositAllowed,
411 'withdraw': withdrawAllowed,
412 'fee': self.parse_number(withdrawFeeString),
413 'precision': precision,
414 'limits': {
415 'withdraw': {
416 'min': self.parse_number(minNetworkWithdrawString),
417 'max': None,
418 },
419 'deposit': {
420 'min': self.parse_number(minNetworkDepositString),
421 'max': None,
422 },
423 },
424 }
425 return self.safe_currency_structure({
426 'info': rawCurrency,
427 'code': code,
428 'id': currencyId,
429 'name': name,
430 'active': deposit and withdraw,
431 'deposit': deposit,
432 'withdraw': withdraw,
433 'fee': self.parse_number(minWithdrawFeeString),

Callers

nothing calls this directly

Calls 10

safe_stringMethod · 0.80
parse_numberMethod · 0.80
parse_precisionMethod · 0.80
safe_listMethod · 0.80
safe_boolMethod · 0.80
string_minMethod · 0.80
rangeFunction · 0.50
safe_currency_codeMethod · 0.45
network_id_to_codeMethod · 0.45

Tested by

no test coverage detected