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

Method parse_currency

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

Source from the content-addressed store, hash-verified

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