ccxt 4.2.100__py2.py3-none-any.whl → 4.3.2__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

@@ -617,54 +617,52 @@ class coinex(Exchange, ImplicitAPI):
617
617
  async def fetch_markets(self, params={}) -> List[Market]:
618
618
  """
619
619
  retrieves data on all markets for coinex
620
- :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market002_all_market_info
621
- :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http006_market_list
620
+ :see: https://docs.coinex.com/api/v2/spot/market/http/list-market
621
+ :see: https://docs.coinex.com/api/v2/futures/market/http/list-market
622
622
  :param dict [params]: extra parameters specific to the exchange API endpoint
623
623
  :returns dict[]: an array of objects representing market data
624
624
  """
625
- promises = [
625
+ promisesUnresolved = [
626
626
  self.fetch_spot_markets(params),
627
627
  self.fetch_contract_markets(params),
628
628
  ]
629
- promises = await asyncio.gather(*promises)
629
+ promises = await asyncio.gather(*promisesUnresolved)
630
630
  spotMarkets = promises[0]
631
631
  swapMarkets = promises[1]
632
632
  return self.array_concat(spotMarkets, swapMarkets)
633
633
 
634
634
  async def fetch_spot_markets(self, params):
635
- response = await self.v1PublicGetMarketInfo(params)
635
+ response = await self.v2PublicGetSpotMarket(params)
636
636
  #
637
637
  # {
638
638
  # "code": 0,
639
- # "data": {
640
- # "WAVESBTC": {
641
- # "name": "WAVESBTC",
642
- # "min_amount": "1",
643
- # "maker_fee_rate": "0.001",
644
- # "taker_fee_rate": "0.001",
645
- # "pricing_name": "BTC",
646
- # "pricing_decimal": 8,
647
- # "trading_name": "WAVES",
648
- # "trading_decimal": 8
649
- # }
650
- # }
639
+ # "data": [
640
+ # {
641
+ # "base_ccy": "SORA",
642
+ # "base_ccy_precision": 8,
643
+ # "is_amm_available": True,
644
+ # "is_margin_available": False,
645
+ # "maker_fee_rate": "0.003",
646
+ # "market": "SORAUSDT",
647
+ # "min_amount": "500",
648
+ # "quote_ccy": "USDT",
649
+ # "quote_ccy_precision": 6,
650
+ # "taker_fee_rate": "0.003"
651
+ # },
652
+ # ],
653
+ # "message": "OK"
651
654
  # }
652
655
  #
653
- markets = self.safe_value(response, 'data', {})
656
+ markets = self.safe_list(response, 'data', [])
654
657
  result = []
655
- keys = list(markets.keys())
656
- for i in range(0, len(keys)):
657
- key = keys[i]
658
- market = markets[key]
659
- id = self.safe_string(market, 'name')
660
- tradingName = self.safe_string(market, 'trading_name')
661
- baseId = tradingName
662
- quoteId = self.safe_string(market, 'pricing_name')
658
+ for i in range(0, len(markets)):
659
+ market = markets[i]
660
+ id = self.safe_string(market, 'market')
661
+ baseId = self.safe_string(market, 'base_ccy')
662
+ quoteId = self.safe_string(market, 'quote_ccy')
663
663
  base = self.safe_currency_code(baseId)
664
664
  quote = self.safe_currency_code(quoteId)
665
665
  symbol = base + '/' + quote
666
- if tradingName == id:
667
- symbol = id
668
666
  result.append({
669
667
  'id': id,
670
668
  'symbol': symbol,
@@ -692,8 +690,8 @@ class coinex(Exchange, ImplicitAPI):
692
690
  'strike': None,
693
691
  'optionType': None,
694
692
  'precision': {
695
- 'amount': self.parse_number(self.parse_precision(self.safe_string(market, 'trading_decimal'))),
696
- 'price': self.parse_number(self.parse_precision(self.safe_string(market, 'pricing_decimal'))),
693
+ 'amount': self.parse_number(self.parse_precision(self.safe_string(market, 'base_ccy_precision'))),
694
+ 'price': self.parse_number(self.parse_precision(self.safe_string(market, 'quote_ccy_precision'))),
697
695
  },
698
696
  'limits': {
699
697
  'leverage': {
@@ -719,45 +717,43 @@ class coinex(Exchange, ImplicitAPI):
719
717
  return result
720
718
 
721
719
  async def fetch_contract_markets(self, params):
722
- response = await self.v1PerpetualPublicGetMarketList(params)
720
+ response = await self.v2PublicGetFuturesMarket(params)
723
721
  #
724
722
  # {
725
723
  # "code": 0,
726
724
  # "data": [
727
725
  # {
728
- # "name": "BTCUSD",
729
- # "type": 2, # 1: USDT-M Contracts, 2: Coin-M Contracts
730
- # "leverages": ["3", "5", "8", "10", "15", "20", "30", "50", "100"],
731
- # "stock": "BTC",
732
- # "money": "USD",
733
- # "fee_prec": 5,
734
- # "stock_prec": 8,
735
- # "money_prec": 1,
736
- # "amount_prec": 0,
737
- # "amount_min": "10",
738
- # "multiplier": "1",
739
- # "tick_size": "0.1", # Min. Price Increment
740
- # "available": True
726
+ # "base_ccy": "BTC",
727
+ # "base_ccy_precision": 8,
728
+ # "contract_type": "inverse",
729
+ # "leverage": ["1","2","3","5","8","10","15","20","30","50","100"],
730
+ # "maker_fee_rate": "0",
731
+ # "market": "BTCUSD",
732
+ # "min_amount": "10",
733
+ # "open_interest_volume": "2566879",
734
+ # "quote_ccy": "USD",
735
+ # "quote_ccy_precision": 2,
736
+ # "taker_fee_rate": "0"
741
737
  # },
742
738
  # ],
743
739
  # "message": "OK"
744
740
  # }
745
741
  #
746
- markets = self.safe_value(response, 'data', [])
742
+ markets = self.safe_list(response, 'data', [])
747
743
  result = []
748
744
  for i in range(0, len(markets)):
749
745
  entry = markets[i]
750
746
  fees = self.fees
751
- leverages = self.safe_value(entry, 'leverages', [])
752
- subType = self.safe_integer(entry, 'type')
753
- linear = (subType == 1)
754
- inverse = (subType == 2)
755
- id = self.safe_string(entry, 'name')
756
- baseId = self.safe_string(entry, 'stock')
757
- quoteId = self.safe_string(entry, 'money')
747
+ leverages = self.safe_list(entry, 'leverage', [])
748
+ subType = self.safe_string(entry, 'contract_type')
749
+ linear = (subType == 'linear')
750
+ inverse = (subType == 'inverse')
751
+ id = self.safe_string(entry, 'market')
752
+ baseId = self.safe_string(entry, 'base_ccy')
753
+ quoteId = self.safe_string(entry, 'quote_ccy')
758
754
  base = self.safe_currency_code(baseId)
759
755
  quote = self.safe_currency_code(quoteId)
760
- settleId = 'USDT' if (subType == 1) else baseId
756
+ settleId = 'USDT' if (subType == 'linear') else baseId
761
757
  settle = self.safe_currency_code(settleId)
762
758
  symbol = base + '/' + quote + ':' + settle
763
759
  leveragesLength = len(leverages)
@@ -776,20 +772,20 @@ class coinex(Exchange, ImplicitAPI):
776
772
  'swap': True,
777
773
  'future': False,
778
774
  'option': False,
779
- 'active': self.safe_value(entry, 'available'),
775
+ 'active': None,
780
776
  'contract': True,
781
777
  'linear': linear,
782
778
  'inverse': inverse,
783
779
  'taker': fees['trading']['taker'],
784
780
  'maker': fees['trading']['maker'],
785
- 'contractSize': self.safe_number(entry, 'multiplier'),
781
+ 'contractSize': self.parse_number('1'),
786
782
  'expiry': None,
787
783
  'expiryDatetime': None,
788
784
  'strike': None,
789
785
  'optionType': None,
790
786
  'precision': {
791
- 'amount': self.parse_number(self.parse_precision(self.safe_string(entry, 'amount_prec'))),
792
- 'price': self.parse_number(self.parse_precision(self.safe_string(entry, 'money_prec'))),
787
+ 'amount': self.parse_number(self.parse_precision(self.safe_string(entry, 'base_ccy_precision'))),
788
+ 'price': self.parse_number(self.parse_precision(self.safe_string(entry, 'quote_ccy_precision'))),
793
789
  },
794
790
  'limits': {
795
791
  'leverage': {
@@ -797,7 +793,7 @@ class coinex(Exchange, ImplicitAPI):
797
793
  'max': self.safe_number(leverages, leveragesLength - 1),
798
794
  },
799
795
  'amount': {
800
- 'min': self.safe_number(entry, 'amount_min'),
796
+ 'min': self.safe_number(entry, 'min_amount'),
801
797
  'max': None,
802
798
  },
803
799
  'price': {
@@ -819,65 +815,59 @@ class coinex(Exchange, ImplicitAPI):
819
815
  # Spot fetchTicker, fetchTickers
820
816
  #
821
817
  # {
822
- # "vol": "293.19415130",
823
- # "low": "38200.00",
824
- # "open": "39514.99",
825
- # "high": "39530.00",
826
- # "last": "38649.57",
827
- # "buy": "38640.20",
828
- # "buy_amount": "0.22800000",
829
- # "sell": "38640.21",
830
- # "sell_amount": "0.02828439"
818
+ # "close": "62393.47",
819
+ # "high": "64106.41",
820
+ # "last": "62393.47",
821
+ # "low": "59650.01",
822
+ # "market": "BTCUSDT",
823
+ # "open": "61616.15",
824
+ # "period": 86400,
825
+ # "value": "28711273.4065667262",
826
+ # "volume": "461.76557205",
827
+ # "volume_buy": "11.41506354",
828
+ # "volume_sell": "7.3240169"
831
829
  # }
832
830
  #
833
831
  # Swap fetchTicker, fetchTickers
834
832
  #
835
833
  # {
836
- # "vol": "7714.2175",
837
- # "low": "38200.00",
838
- # "open": "39569.23",
839
- # "high": "39569.23",
840
- # "last": "38681.37",
841
- # "buy": "38681.36",
834
+ # "close": "62480.08",
835
+ # "high": "64100",
836
+ # "index_price": "62443.05",
837
+ # "last": "62480.08",
838
+ # "low": "59600",
839
+ # "mark_price": "62443.05",
840
+ # "market": "BTCUSDT",
841
+ # "open": "61679.98",
842
842
  # "period": 86400,
843
- # "funding_time": 462,
844
- # "position_amount": "296.7552",
845
- # "funding_rate_last": "0.00009395",
846
- # "funding_rate_next": "0.00000649",
847
- # "funding_rate_predict": "-0.00007176",
848
- # "insurance": "16464465.09431942163278132918",
849
- # "sign_price": "38681.93",
850
- # "index_price": "38681.69500000",
851
- # "sell_total": "16.6039",
852
- # "buy_total": "19.8481",
853
- # "buy_amount": "4.6315",
854
- # "sell": "38681.37",
855
- # "sell_amount": "11.4044"
843
+ # "value": "180226025.69791713065326633165",
844
+ # "volume": "2900.2218",
845
+ # "volume_buy": "7.3847",
846
+ # "volume_sell": "6.1249"
856
847
  # }
857
848
  #
858
- timestamp = self.safe_integer(ticker, 'date')
859
- symbol = self.safe_symbol(None, market)
860
- ticker = self.safe_value(ticker, 'ticker', {})
861
- last = self.safe_string(ticker, 'last')
849
+ marketType = 'swap' if ('mark_price' in ticker) else 'spot'
850
+ marketId = self.safe_string(ticker, 'market')
851
+ symbol = self.safe_symbol(marketId, market, None, marketType)
862
852
  return self.safe_ticker({
863
853
  'symbol': symbol,
864
- 'timestamp': timestamp,
865
- 'datetime': self.iso8601(timestamp),
854
+ 'timestamp': None,
855
+ 'datetime': None,
866
856
  'high': self.safe_string(ticker, 'high'),
867
857
  'low': self.safe_string(ticker, 'low'),
868
- 'bid': self.safe_string(ticker, 'buy'),
869
- 'bidVolume': self.safe_string(ticker, 'buy_amount'),
870
- 'ask': self.safe_string(ticker, 'sell'),
871
- 'askVolume': self.safe_string(ticker, 'sell_amount'),
858
+ 'bid': None,
859
+ 'bidVolume': self.safe_string(ticker, 'volume_buy'),
860
+ 'ask': None,
861
+ 'askVolume': self.safe_string(ticker, 'volume_sell'),
872
862
  'vwap': None,
873
863
  'open': self.safe_string(ticker, 'open'),
874
- 'close': last,
875
- 'last': last,
864
+ 'close': self.safe_string(ticker, 'close'),
865
+ 'last': self.safe_string(ticker, 'last'),
876
866
  'previousClose': None,
877
867
  'change': None,
878
868
  'percentage': None,
879
869
  'average': None,
880
- 'baseVolume': self.safe_string_2(ticker, 'vol', 'volume'),
870
+ 'baseVolume': self.safe_string(ticker, 'volume'),
881
871
  'quoteVolume': None,
882
872
  'info': ticker,
883
873
  }, market)
@@ -885,8 +875,8 @@ class coinex(Exchange, ImplicitAPI):
885
875
  async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
886
876
  """
887
877
  fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
888
- :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market007_single_market_ticker
889
- :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http008_market_ticker
878
+ :see: https://docs.coinex.com/api/v2/spot/market/http/list-market-ticker
879
+ :see: https://docs.coinex.com/api/v2/futures/market/http/list-market-ticker
890
880
  :param str symbol: unified symbol of the market to fetch the ticker for
891
881
  :param dict [params]: extra parameters specific to the exchange API endpoint
892
882
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -898,28 +888,29 @@ class coinex(Exchange, ImplicitAPI):
898
888
  }
899
889
  response = None
900
890
  if market['swap']:
901
- response = await self.v1PerpetualPublicGetMarketTicker(self.extend(request, params))
891
+ response = await self.v2PublicGetFuturesTicker(self.extend(request, params))
902
892
  else:
903
- response = await self.v1PublicGetMarketTicker(self.extend(request, params))
893
+ response = await self.v2PublicGetSpotTicker(self.extend(request, params))
904
894
  #
905
895
  # Spot
906
896
  #
907
897
  # {
908
898
  # "code": 0,
909
- # "data": {
910
- # "date": 1651306913414,
911
- # "ticker": {
912
- # "vol": "293.19415130",
913
- # "low": "38200.00",
914
- # "open": "39514.99",
915
- # "high": "39530.00",
916
- # "last": "38649.57",
917
- # "buy": "38640.20",
918
- # "buy_amount": "0.22800000",
919
- # "sell": "38640.21",
920
- # "sell_amount": "0.02828439"
899
+ # "data": [
900
+ # {
901
+ # "close": "62393.47",
902
+ # "high": "64106.41",
903
+ # "last": "62393.47",
904
+ # "low": "59650.01",
905
+ # "market": "BTCUSDT",
906
+ # "open": "61616.15",
907
+ # "period": 86400,
908
+ # "value": "28711273.4065667262",
909
+ # "volume": "461.76557205",
910
+ # "volume_buy": "11.41506354",
911
+ # "volume_sell": "7.3240169"
921
912
  # }
922
- # },
913
+ # ],
923
914
  # "message": "OK"
924
915
  # }
925
916
  #
@@ -927,41 +918,35 @@ class coinex(Exchange, ImplicitAPI):
927
918
  #
928
919
  # {
929
920
  # "code": 0,
930
- # "data": {
931
- # "date": 1651306641500,
932
- # "ticker": {
933
- # "vol": "7714.2175",
934
- # "low": "38200.00",
935
- # "open": "39569.23",
936
- # "high": "39569.23",
937
- # "last": "38681.37",
938
- # "buy": "38681.36",
921
+ # "data": [
922
+ # {
923
+ # "close": "62480.08",
924
+ # "high": "64100",
925
+ # "index_price": "62443.05",
926
+ # "last": "62480.08",
927
+ # "low": "59600",
928
+ # "mark_price": "62443.05",
929
+ # "market": "BTCUSDT",
930
+ # "open": "61679.98",
939
931
  # "period": 86400,
940
- # "funding_time": 462,
941
- # "position_amount": "296.7552",
942
- # "funding_rate_last": "0.00009395",
943
- # "funding_rate_next": "0.00000649",
944
- # "funding_rate_predict": "-0.00007176",
945
- # "insurance": "16464465.09431942163278132918",
946
- # "sign_price": "38681.93",
947
- # "index_price": "38681.69500000",
948
- # "sell_total": "16.6039",
949
- # "buy_total": "19.8481",
950
- # "buy_amount": "4.6315",
951
- # "sell": "38681.37",
952
- # "sell_amount": "11.4044"
932
+ # "value": "180226025.69791713065326633165",
933
+ # "volume": "2900.2218",
934
+ # "volume_buy": "7.3847",
935
+ # "volume_sell": "6.1249"
953
936
  # }
954
- # },
937
+ # ],
955
938
  # "message": "OK"
956
939
  # }
957
940
  #
958
- return self.parse_ticker(response['data'], market)
941
+ data = self.safe_list(response, 'data', [])
942
+ result = self.safe_dict(data, 0, {})
943
+ return self.parse_ticker(result, market)
959
944
 
960
945
  async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
961
946
  """
962
947
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
963
- :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market008_all_market_ticker
964
- :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http009_market_ticker_all
948
+ :see: https://docs.coinex.com/api/v2/spot/market/http/list-market-ticker
949
+ :see: https://docs.coinex.com/api/v2/futures/market/http/list-market-ticker
965
950
  :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
966
951
  :param dict [params]: extra parameters specific to the exchange API endpoint
967
952
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -975,83 +960,58 @@ class coinex(Exchange, ImplicitAPI):
975
960
  marketType, query = self.handle_market_type_and_params('fetchTickers', market, params)
976
961
  response = None
977
962
  if marketType == 'swap':
978
- response = await self.v1PerpetualPublicGetMarketTickerAll(query)
963
+ response = await self.v2PublicGetFuturesTicker(query)
979
964
  else:
980
- response = await self.v1PublicGetMarketTickerAll()
965
+ response = await self.v2PublicGetSpotTicker(query)
981
966
  #
982
967
  # Spot
983
968
  #
984
969
  # {
985
970
  # "code": 0,
986
- # "data": {
987
- # "date": 1651519857284,
988
- # "ticker": {
989
- # "PSPUSDT": {
990
- # "vol": "127131.55227034",
991
- # "low": "0.0669",
992
- # "open": "0.0688",
993
- # "high": "0.0747",
994
- # "last": "0.0685",
995
- # "buy": "0.0676",
996
- # "buy_amount": "702.70117866",
997
- # "sell": "0.0690",
998
- # "sell_amount": "686.76861562"
999
- # },
971
+ # "data": [
972
+ # {
973
+ # "close": "62393.47",
974
+ # "high": "64106.41",
975
+ # "last": "62393.47",
976
+ # "low": "59650.01",
977
+ # "market": "BTCUSDT",
978
+ # "open": "61616.15",
979
+ # "period": 86400,
980
+ # "value": "28711273.4065667262",
981
+ # "volume": "461.76557205",
982
+ # "volume_buy": "11.41506354",
983
+ # "volume_sell": "7.3240169"
1000
984
  # }
1001
- # },
1002
- # "message": "Ok"
985
+ # ],
986
+ # "message": "OK"
1003
987
  # }
1004
988
  #
1005
989
  # Swap
1006
990
  #
1007
991
  # {
1008
992
  # "code": 0,
1009
- # "data": {
1010
- # "date": 1651520268644,
1011
- # "ticker": {
1012
- # "KAVAUSDT": {
1013
- # "vol": "834924",
1014
- # "low": "3.9418",
1015
- # "open": "4.1834",
1016
- # "high": "4.4328",
1017
- # "last": "4.0516",
1018
- # "buy": "4.0443",
1019
- # "period": 86400,
1020
- # "funding_time": 262,
1021
- # "position_amount": "16111",
1022
- # "funding_rate_last": "-0.00069514",
1023
- # "funding_rate_next": "-0.00061009",
1024
- # "funding_rate_predict": "-0.00055812",
1025
- # "insurance": "16532425.53026084124483989548",
1026
- # "sign_price": "4.0516",
1027
- # "index_price": "4.0530",
1028
- # "sell_total": "59446",
1029
- # "buy_total": "62423",
1030
- # "buy_amount": "959",
1031
- # "sell": "4.0466",
1032
- # "sell_amount": "141"
1033
- # },
993
+ # "data": [
994
+ # {
995
+ # "close": "62480.08",
996
+ # "high": "64100",
997
+ # "index_price": "62443.05",
998
+ # "last": "62480.08",
999
+ # "low": "59600",
1000
+ # "mark_price": "62443.05",
1001
+ # "market": "BTCUSDT",
1002
+ # "open": "61679.98",
1003
+ # "period": 86400,
1004
+ # "value": "180226025.69791713065326633165",
1005
+ # "volume": "2900.2218",
1006
+ # "volume_buy": "7.3847",
1007
+ # "volume_sell": "6.1249"
1034
1008
  # }
1035
- # },
1036
- # "message": "Ok"
1009
+ # ],
1010
+ # "message": "OK"
1037
1011
  # }
1038
1012
  #
1039
- data = self.safe_value(response, 'data')
1040
- timestamp = self.safe_integer(data, 'date')
1041
- tickers = self.safe_value(data, 'ticker', {})
1042
- marketIds = list(tickers.keys())
1043
- result = {}
1044
- for i in range(0, len(marketIds)):
1045
- marketId = marketIds[i]
1046
- marketInner = self.safe_market(marketId, None, None, marketType)
1047
- symbol = marketInner['symbol']
1048
- ticker = self.parse_ticker({
1049
- 'date': timestamp,
1050
- 'ticker': tickers[marketId],
1051
- }, marketInner)
1052
- ticker['symbol'] = symbol
1053
- result[symbol] = ticker
1054
- return self.filter_by_array_tickers(result, 'symbol', symbols)
1013
+ data = self.safe_list(response, 'data', [])
1014
+ return self.parse_tickers(data, symbols)
1055
1015
 
1056
1016
  async def fetch_time(self, params={}):
1057
1017
  """
@@ -1500,7 +1500,7 @@ class cryptocom(Exchange, ImplicitAPI):
1500
1500
  """
1501
1501
  tag, params = self.handle_withdraw_tag_and_params(tag, params)
1502
1502
  await self.load_markets()
1503
- currency = self.currency(code)
1503
+ currency = self.safe_currency(code) # for instance, USDC is not inferred from markets but it's still available
1504
1504
  request = {
1505
1505
  'currency': currency['id'],
1506
1506
  'amount': amount,
@@ -1542,7 +1542,7 @@ class cryptocom(Exchange, ImplicitAPI):
1542
1542
  :returns dict: a dictionary of `address structures <https://docs.ccxt.com/#/?id=address-structure>` indexed by the network
1543
1543
  """
1544
1544
  await self.load_markets()
1545
- currency = self.currency(code)
1545
+ currency = self.safe_currency(code)
1546
1546
  request = {
1547
1547
  'currency': currency['id'],
1548
1548
  }
@@ -1633,7 +1633,7 @@ class cryptocom(Exchange, ImplicitAPI):
1633
1633
  currency = None
1634
1634
  request = {}
1635
1635
  if code is not None:
1636
- currency = self.currency(code)
1636
+ currency = self.safe_currency(code)
1637
1637
  request['currency'] = currency['id']
1638
1638
  if since is not None:
1639
1639
  # 90 days date range
@@ -1686,7 +1686,7 @@ class cryptocom(Exchange, ImplicitAPI):
1686
1686
  currency = None
1687
1687
  request = {}
1688
1688
  if code is not None:
1689
- currency = self.currency(code)
1689
+ currency = self.safe_currency(code)
1690
1690
  request['currency'] = currency['id']
1691
1691
  if since is not None:
1692
1692
  # 90 days date range
@@ -2179,7 +2179,7 @@ class cryptocom(Exchange, ImplicitAPI):
2179
2179
  request = {}
2180
2180
  currency = None
2181
2181
  if code is not None:
2182
- currency = self.currency(code)
2182
+ currency = self.safe_currency(code)
2183
2183
  if since is not None:
2184
2184
  request['start_time'] = since
2185
2185
  if limit is not None: