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

Method parse_currency

python/ccxt/kraken.py:854–905  ·  view source on GitHub ↗
(self, rawCurrency: dict)

Source from the content-addressed store, hash-verified

852 return self.parse_currencies(enhancedArray)
853
854 def parse_currency(self, rawCurrency: dict) -> Currency:
855 # todo: will need to rethink the fees
856 # see: https://support.kraken.com/hc/en-us/articles/201893608-What-are-the-withdrawal-fees-
857 # to add support for multiple withdrawal/deposit methods and
858 # differentiated fees for each particular method
859 #
860 # Notes about abbreviations:
861 # Z and X prefixes: https://support.kraken.com/hc/en-us/articles/360001206766-Bitcoin-currency-code-XBT-vs-BTC
862 # S and M suffixes: https://support.kraken.com/hc/en-us/articles/360039879471-What-is-Asset-S-and-Asset-M-
863 #
864 id = self.safe_string(rawCurrency, '_coin_id')
865 code = self.safe_currency_code(id)
866 # the below cannot be reliably done in `safeCurrencyCode`, so we have to do it here
867 if id.find('.') < 0:
868 altName = self.safe_string(rawCurrency, 'altname')
869 # handle cases like below:
870 #
871 # id | altname
872 # ---------------
873 # XXBT | XBT
874 # ZUSD | USD
875 if id != altName and (id.startswith('X') or id.startswith('Z')):
876 code = self.safe_currency_code(altName)
877 # also, add map in commonCurrencies:
878 self.commonCurrencies[id] = code
879 else:
880 code = self.safe_currency_code(id)
881 isFiat = code.find('.HOLD') >= 0
882 rawCurrency = self.omit(rawCurrency, '_coin_id')
883 return self.safe_currency_structure({
884 'id': id,
885 'code': code,
886 'info': rawCurrency,
887 'name': self.safe_string(rawCurrency, 'altname'),
888 'active': self.safe_string(rawCurrency, 'status') == 'enabled',
889 'type': 'fiat' if isFiat else 'crypto',
890 'deposit': None,
891 'withdraw': None,
892 'fee': None,
893 'precision': self.parse_number(self.parse_precision(self.safe_string(rawCurrency, 'decimals'))),
894 'limits': {
895 'amount': {
896 'min': None,
897 'max': None,
898 },
899 'withdraw': {
900 'min': None,
901 'max': None,
902 },
903 },
904 'networks': {},
905 })
906
907 def safe_currency_code(self, currencyId: Str, currency: Currency = None) -> Str:
908 if currencyId is None:

Callers

nothing calls this directly

Calls 7

safe_currency_codeMethod · 0.95
safe_stringMethod · 0.80
findMethod · 0.80
parse_numberMethod · 0.80
parse_precisionMethod · 0.80
omitMethod · 0.45

Tested by

no test coverage detected