ccxt 4.3.1__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.

@@ -607,6 +607,8 @@ class kucoin(Exchange, ImplicitAPI):
607
607
  'BIFI': 'BIFIF',
608
608
  'VAI': 'VAIOT',
609
609
  'WAX': 'WAXP',
610
+ 'ALT': 'APTOSLAUNCHTOKEN',
611
+ 'KALT': 'ALT', # ALTLAYER
610
612
  },
611
613
  'options': {
612
614
  'version': 'v1',
@@ -1777,7 +1779,7 @@ class kucoin(Exchange, ImplicitAPI):
1777
1779
  address = address.replace('bitcoincash:', '')
1778
1780
  code = None
1779
1781
  if currency is not None:
1780
- code = currency['id']
1782
+ code = self.safe_currency_code(currency['id'])
1781
1783
  if code != 'NIM':
1782
1784
  # contains spaces
1783
1785
  self.check_address(address)
@@ -1823,7 +1825,7 @@ class kucoin(Exchange, ImplicitAPI):
1823
1825
  self.options['versions']['private']['GET']['deposit-addresses'] = version
1824
1826
  chains = self.safe_list(response, 'data', [])
1825
1827
  parsed = self.parse_deposit_addresses(chains, [currency['code']], False, {
1826
- 'currency': currency['id'],
1828
+ 'currency': currency['code'],
1827
1829
  })
1828
1830
  return self.index_by(parsed, 'network')
1829
1831
 
@@ -2800,7 +2802,7 @@ class kucoin(Exchange, ImplicitAPI):
2800
2802
  async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
2801
2803
  """
2802
2804
  get the list of most recent trades for a particular symbol
2803
- :see: https://docs.kucoin.com/#get-trade-histories
2805
+ :see: https://www.kucoin.com/docs/rest/spot-trading/market-data/get-trade-histories
2804
2806
  :param str symbol: unified symbol of the market to fetch trades for
2805
2807
  :param int [since]: timestamp in ms of the earliest trade to fetch
2806
2808
  :param int [limit]: the maximum amount of trades to fetch
@@ -2965,7 +2967,7 @@ class kucoin(Exchange, ImplicitAPI):
2965
2967
  async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
2966
2968
  """
2967
2969
  fetch the trading fees for a market
2968
- :see: https://docs.kucoin.com/#actual-fee-rate-of-the-trading-pair
2970
+ :see: https://www.kucoin.com/docs/rest/funding/trade-fee/trading-pair-actual-fee-spot-margin-trade_hf
2969
2971
  :param str symbol: unified market symbol
2970
2972
  :param dict [params]: extra parameters specific to the exchange API endpoint
2971
2973
  :returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
@@ -3003,7 +3005,7 @@ class kucoin(Exchange, ImplicitAPI):
3003
3005
  async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
3004
3006
  """
3005
3007
  make a withdrawal
3006
- :see: https://docs.kucoin.com/#apply-withdraw-2
3008
+ :see: https://www.kucoin.com/docs/rest/funding/withdrawals/apply-withdraw
3007
3009
  :param str code: unified currency code
3008
3010
  :param float amount: the amount to withdraw
3009
3011
  :param str address: the address to withdraw to
@@ -3164,8 +3166,8 @@ class kucoin(Exchange, ImplicitAPI):
3164
3166
  async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
3165
3167
  """
3166
3168
  fetch all deposits made to an account
3167
- :see: https://docs.kucoin.com/#get-deposit-list
3168
- :see: https://docs.kucoin.com/#get-v1-historical-deposits-list
3169
+ :see: https://www.kucoin.com/docs/rest/funding/deposit/get-deposit-list
3170
+ :see: https://www.kucoin.com/docs/rest/funding/deposit/get-v1-historical-deposits-list
3169
3171
  :param str code: unified currency code
3170
3172
  :param int [since]: the earliest time in ms to fetch deposits for
3171
3173
  :param int [limit]: the maximum number of deposits structures to retrieve
@@ -3240,8 +3242,8 @@ class kucoin(Exchange, ImplicitAPI):
3240
3242
  async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
3241
3243
  """
3242
3244
  fetch all withdrawals made from an account
3243
- :see: https://docs.kucoin.com/#get-withdrawals-list
3244
- :see: https://docs.kucoin.com/#get-v1-historical-withdrawals-list
3245
+ :see: https://www.kucoin.com/docs/rest/funding/withdrawals/get-withdrawals-list
3246
+ :see: https://www.kucoin.com/docs/rest/funding/withdrawals/get-v1-historical-withdrawals-list
3245
3247
  :param str code: unified currency code
3246
3248
  :param int [since]: the earliest time in ms to fetch withdrawals for
3247
3249
  :param int [limit]: the maximum number of withdrawals structures to retrieve
@@ -3491,7 +3493,7 @@ class kucoin(Exchange, ImplicitAPI):
3491
3493
  async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
3492
3494
  """
3493
3495
  transfer currency internally between wallets on the same account
3494
- :see: https://docs.kucoin.com/#inner-transfer
3496
+ :see: https://www.kucoin.com/docs/rest/funding/transfer/inner-transfer
3495
3497
  :see: https://docs.kucoin.com/futures/#transfer-funds-to-kucoin-main-account-2
3496
3498
  :see: https://docs.kucoin.com/spot-hf/#internal-funds-transfers-in-high-frequency-trading-accounts
3497
3499
  :param str code: unified currency code
@@ -3758,7 +3760,7 @@ class kucoin(Exchange, ImplicitAPI):
3758
3760
 
3759
3761
  async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
3760
3762
  """
3761
- :see: https://docs.kucoin.com/#get-account-ledgers
3763
+ :see: https://www.kucoin.com/docs/rest/account/basic-info/get-account-ledgers-spot-margin
3762
3764
  :see: https://www.kucoin.com/docs/rest/account/basic-info/get-account-ledgers-trade_hf
3763
3765
  :see: https://www.kucoin.com/docs/rest/account/basic-info/get-account-ledgers-margin_hf
3764
3766
  fetch the history of changes, actions done by the user or operations that altered balance of the user
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.1'
7
+ __version__ = '4.3.2'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -31,7 +31,7 @@ from ccxt.base.decimal_to_precision import decimal_to_precision
31
31
  from ccxt.base.decimal_to_precision import DECIMAL_PLACES, TICK_SIZE, NO_PADDING, TRUNCATE, ROUND, ROUND_UP, ROUND_DOWN, SIGNIFICANT_DIGITS
32
32
  from ccxt.base.decimal_to_precision import number_to_string
33
33
  from ccxt.base.precise import Precise
34
- from ccxt.base.types import BalanceAccount, Currency, IndexType, OrderSide, OrderType, Trade, OrderRequest, Market, MarketType, Str, Num, Strings
34
+ from ccxt.base.types import BalanceAccount, Currency, IndexType, OrderSide, OrderType, Trade, OrderRequest, Market, MarketType, Str, Num, Strings, CancellationRequest
35
35
 
36
36
  # -----------------------------------------------------------------------------
37
37
 
@@ -4318,6 +4318,9 @@ class Exchange(object):
4318
4318
  def cancel_all_orders(self, symbol: Str = None, params={}):
4319
4319
  raise NotSupported(self.id + ' cancelAllOrders() is not supported yet')
4320
4320
 
4321
+ def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
4322
+ raise NotSupported(self.id + ' cancelOrdersForSymbols() is not supported yet')
4323
+
4321
4324
  def cancel_all_orders_ws(self, symbol: Str = None, params={}):
4322
4325
  raise NotSupported(self.id + ' cancelAllOrdersWs() is not supported yet')
4323
4326
 
ccxt/base/types.py CHANGED
@@ -148,6 +148,10 @@ class OrderRequest(TypedDict):
148
148
  price: Union[None, float]
149
149
  params: Dict[str, Any]
150
150
 
151
+ class CancellationRequest(TypedDict):
152
+ id: Str
153
+ symbol: Str
154
+ clientOrderId: Str
151
155
 
152
156
  class Order(TypedDict):
153
157
  info: Dict[str, Any]
ccxt/bingx.py CHANGED
@@ -20,6 +20,7 @@ from ccxt.base.errors import InsufficientFunds
20
20
  from ccxt.base.errors import OrderNotFound
21
21
  from ccxt.base.errors import NotSupported
22
22
  from ccxt.base.errors import DDoSProtection
23
+ from ccxt.base.errors import ExchangeNotAvailable
23
24
  from ccxt.base.decimal_to_precision import DECIMAL_PLACES
24
25
  from ccxt.base.precise import Precise
25
26
 
@@ -397,7 +398,7 @@ class bingx(Exchange, ImplicitAPI):
397
398
  '100400': BadRequest,
398
399
  '100421': BadSymbol, # {"code":100421,"msg":"This pair is currently restricted from API trading","debugMsg":""}
399
400
  '100440': ExchangeError,
400
- '100500': ExchangeError,
401
+ '100500': ExchangeNotAvailable, # {"code":100500,"msg":"The current system is busy, please try again later","debugMsg":""}
401
402
  '100503': ExchangeError,
402
403
  '80001': BadRequest,
403
404
  '80012': InsufficientFunds, # bingx {"code":80012,"msg":"{\"Code\":101253,\"Msg\":\"margin is not enough\"}}
@@ -3717,7 +3718,7 @@ class bingx(Exchange, ImplicitAPI):
3717
3718
  market = None
3718
3719
  if symbol is not None:
3719
3720
  market = self.market(symbol)
3720
- request['symbol'] = symbol
3721
+ request['symbol'] = market['id']
3721
3722
  if since is not None:
3722
3723
  request['startTime'] = since
3723
3724
  if limit is not None:
ccxt/bitget.py CHANGED
@@ -8050,6 +8050,8 @@ class bitget(Exchange, ImplicitAPI):
8050
8050
  #
8051
8051
  # spot
8052
8052
  #
8053
+ # {"code":"00000","msg":"success","requestTime":1713294492511,"data":[...]}"
8054
+ #
8053
8055
  # {"status":"fail","err_code":"01001","err_msg":"系统异常,请稍后重试"}
8054
8056
  # {"status":"error","ts":1595594160149,"err_code":"invalid-parameter","err_msg":"invalid size, valid range: [1,2000]"}
8055
8057
  # {"status":"error","ts":1595684716042,"err_code":"invalid-parameter","err_msg":"illegal sign invalid"}
@@ -8071,13 +8073,13 @@ class bitget(Exchange, ImplicitAPI):
8071
8073
  # {"code":"40108","msg":"","requestTime":1595885064600,"data":null}
8072
8074
  # {"order_id":"513468410013679613","client_oid":null,"symbol":"ethusd","result":false,"err_code":"order_no_exist_error","err_msg":"订单不存在!"}
8073
8075
  #
8074
- message = self.safe_string(response, 'err_msg')
8075
- errorCode = self.safe_string_2(response, 'code', 'err_code')
8076
+ message = self.safe_string_2(response, 'err_msg', 'msg')
8076
8077
  feedback = self.id + ' ' + body
8077
- nonEmptyMessage = ((message is not None) and (message != ''))
8078
+ nonEmptyMessage = ((message is not None) and (message != '') and (message != 'success'))
8078
8079
  if nonEmptyMessage:
8079
8080
  self.throw_exactly_matched_exception(self.exceptions['exact'], message, feedback)
8080
8081
  self.throw_broadly_matched_exception(self.exceptions['broad'], message, feedback)
8082
+ errorCode = self.safe_string_2(response, 'code', 'err_code')
8081
8083
  nonZeroErrorCode = (errorCode is not None) and (errorCode != '00000')
8082
8084
  if nonZeroErrorCode:
8083
8085
  self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, feedback)
ccxt/coinbase.py CHANGED
@@ -27,9 +27,10 @@ class coinbase(Exchange, ImplicitAPI):
27
27
  def describe(self):
28
28
  return self.deep_extend(super(coinbase, self).describe(), {
29
29
  'id': 'coinbase',
30
- 'name': 'Coinbase',
30
+ 'name': 'Coinbase Advanced',
31
31
  'countries': ['US'],
32
32
  'pro': True,
33
+ 'certified': True,
33
34
  # rate-limits:
34
35
  # ADVANCED API: https://docs.cloud.coinbase.com/advanced-trade-api/docs/rest-api-rate-limits
35
36
  # - max 30 req/second for private data, 10 req/s for public data
ccxt/coinbasepro.py CHANGED
@@ -27,7 +27,7 @@ class coinbasepro(Exchange, ImplicitAPI):
27
27
  def describe(self):
28
28
  return self.deep_extend(super(coinbasepro, self).describe(), {
29
29
  'id': 'coinbasepro',
30
- 'name': 'Coinbase Pro',
30
+ 'name': 'Coinbase Pro(Deprecated)',
31
31
  'countries': ['US'],
32
32
  'rateLimit': 100,
33
33
  'userAgent': self.userAgents['chrome'],
ccxt/coinex.py CHANGED
@@ -814,65 +814,59 @@ class coinex(Exchange, ImplicitAPI):
814
814
  # Spot fetchTicker, fetchTickers
815
815
  #
816
816
  # {
817
- # "vol": "293.19415130",
818
- # "low": "38200.00",
819
- # "open": "39514.99",
820
- # "high": "39530.00",
821
- # "last": "38649.57",
822
- # "buy": "38640.20",
823
- # "buy_amount": "0.22800000",
824
- # "sell": "38640.21",
825
- # "sell_amount": "0.02828439"
817
+ # "close": "62393.47",
818
+ # "high": "64106.41",
819
+ # "last": "62393.47",
820
+ # "low": "59650.01",
821
+ # "market": "BTCUSDT",
822
+ # "open": "61616.15",
823
+ # "period": 86400,
824
+ # "value": "28711273.4065667262",
825
+ # "volume": "461.76557205",
826
+ # "volume_buy": "11.41506354",
827
+ # "volume_sell": "7.3240169"
826
828
  # }
827
829
  #
828
830
  # Swap fetchTicker, fetchTickers
829
831
  #
830
832
  # {
831
- # "vol": "7714.2175",
832
- # "low": "38200.00",
833
- # "open": "39569.23",
834
- # "high": "39569.23",
835
- # "last": "38681.37",
836
- # "buy": "38681.36",
833
+ # "close": "62480.08",
834
+ # "high": "64100",
835
+ # "index_price": "62443.05",
836
+ # "last": "62480.08",
837
+ # "low": "59600",
838
+ # "mark_price": "62443.05",
839
+ # "market": "BTCUSDT",
840
+ # "open": "61679.98",
837
841
  # "period": 86400,
838
- # "funding_time": 462,
839
- # "position_amount": "296.7552",
840
- # "funding_rate_last": "0.00009395",
841
- # "funding_rate_next": "0.00000649",
842
- # "funding_rate_predict": "-0.00007176",
843
- # "insurance": "16464465.09431942163278132918",
844
- # "sign_price": "38681.93",
845
- # "index_price": "38681.69500000",
846
- # "sell_total": "16.6039",
847
- # "buy_total": "19.8481",
848
- # "buy_amount": "4.6315",
849
- # "sell": "38681.37",
850
- # "sell_amount": "11.4044"
842
+ # "value": "180226025.69791713065326633165",
843
+ # "volume": "2900.2218",
844
+ # "volume_buy": "7.3847",
845
+ # "volume_sell": "6.1249"
851
846
  # }
852
847
  #
853
- timestamp = self.safe_integer(ticker, 'date')
854
- symbol = self.safe_symbol(None, market)
855
- ticker = self.safe_value(ticker, 'ticker', {})
856
- last = self.safe_string(ticker, 'last')
848
+ marketType = 'swap' if ('mark_price' in ticker) else 'spot'
849
+ marketId = self.safe_string(ticker, 'market')
850
+ symbol = self.safe_symbol(marketId, market, None, marketType)
857
851
  return self.safe_ticker({
858
852
  'symbol': symbol,
859
- 'timestamp': timestamp,
860
- 'datetime': self.iso8601(timestamp),
853
+ 'timestamp': None,
854
+ 'datetime': None,
861
855
  'high': self.safe_string(ticker, 'high'),
862
856
  'low': self.safe_string(ticker, 'low'),
863
- 'bid': self.safe_string(ticker, 'buy'),
864
- 'bidVolume': self.safe_string(ticker, 'buy_amount'),
865
- 'ask': self.safe_string(ticker, 'sell'),
866
- 'askVolume': self.safe_string(ticker, 'sell_amount'),
857
+ 'bid': None,
858
+ 'bidVolume': self.safe_string(ticker, 'volume_buy'),
859
+ 'ask': None,
860
+ 'askVolume': self.safe_string(ticker, 'volume_sell'),
867
861
  'vwap': None,
868
862
  'open': self.safe_string(ticker, 'open'),
869
- 'close': last,
870
- 'last': last,
863
+ 'close': self.safe_string(ticker, 'close'),
864
+ 'last': self.safe_string(ticker, 'last'),
871
865
  'previousClose': None,
872
866
  'change': None,
873
867
  'percentage': None,
874
868
  'average': None,
875
- 'baseVolume': self.safe_string_2(ticker, 'vol', 'volume'),
869
+ 'baseVolume': self.safe_string(ticker, 'volume'),
876
870
  'quoteVolume': None,
877
871
  'info': ticker,
878
872
  }, market)
@@ -880,8 +874,8 @@ class coinex(Exchange, ImplicitAPI):
880
874
  def fetch_ticker(self, symbol: str, params={}) -> Ticker:
881
875
  """
882
876
  fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
883
- :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market007_single_market_ticker
884
- :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http008_market_ticker
877
+ :see: https://docs.coinex.com/api/v2/spot/market/http/list-market-ticker
878
+ :see: https://docs.coinex.com/api/v2/futures/market/http/list-market-ticker
885
879
  :param str symbol: unified symbol of the market to fetch the ticker for
886
880
  :param dict [params]: extra parameters specific to the exchange API endpoint
887
881
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -893,28 +887,29 @@ class coinex(Exchange, ImplicitAPI):
893
887
  }
894
888
  response = None
895
889
  if market['swap']:
896
- response = self.v1PerpetualPublicGetMarketTicker(self.extend(request, params))
890
+ response = self.v2PublicGetFuturesTicker(self.extend(request, params))
897
891
  else:
898
- response = self.v1PublicGetMarketTicker(self.extend(request, params))
892
+ response = self.v2PublicGetSpotTicker(self.extend(request, params))
899
893
  #
900
894
  # Spot
901
895
  #
902
896
  # {
903
897
  # "code": 0,
904
- # "data": {
905
- # "date": 1651306913414,
906
- # "ticker": {
907
- # "vol": "293.19415130",
908
- # "low": "38200.00",
909
- # "open": "39514.99",
910
- # "high": "39530.00",
911
- # "last": "38649.57",
912
- # "buy": "38640.20",
913
- # "buy_amount": "0.22800000",
914
- # "sell": "38640.21",
915
- # "sell_amount": "0.02828439"
898
+ # "data": [
899
+ # {
900
+ # "close": "62393.47",
901
+ # "high": "64106.41",
902
+ # "last": "62393.47",
903
+ # "low": "59650.01",
904
+ # "market": "BTCUSDT",
905
+ # "open": "61616.15",
906
+ # "period": 86400,
907
+ # "value": "28711273.4065667262",
908
+ # "volume": "461.76557205",
909
+ # "volume_buy": "11.41506354",
910
+ # "volume_sell": "7.3240169"
916
911
  # }
917
- # },
912
+ # ],
918
913
  # "message": "OK"
919
914
  # }
920
915
  #
@@ -922,41 +917,35 @@ class coinex(Exchange, ImplicitAPI):
922
917
  #
923
918
  # {
924
919
  # "code": 0,
925
- # "data": {
926
- # "date": 1651306641500,
927
- # "ticker": {
928
- # "vol": "7714.2175",
929
- # "low": "38200.00",
930
- # "open": "39569.23",
931
- # "high": "39569.23",
932
- # "last": "38681.37",
933
- # "buy": "38681.36",
920
+ # "data": [
921
+ # {
922
+ # "close": "62480.08",
923
+ # "high": "64100",
924
+ # "index_price": "62443.05",
925
+ # "last": "62480.08",
926
+ # "low": "59600",
927
+ # "mark_price": "62443.05",
928
+ # "market": "BTCUSDT",
929
+ # "open": "61679.98",
934
930
  # "period": 86400,
935
- # "funding_time": 462,
936
- # "position_amount": "296.7552",
937
- # "funding_rate_last": "0.00009395",
938
- # "funding_rate_next": "0.00000649",
939
- # "funding_rate_predict": "-0.00007176",
940
- # "insurance": "16464465.09431942163278132918",
941
- # "sign_price": "38681.93",
942
- # "index_price": "38681.69500000",
943
- # "sell_total": "16.6039",
944
- # "buy_total": "19.8481",
945
- # "buy_amount": "4.6315",
946
- # "sell": "38681.37",
947
- # "sell_amount": "11.4044"
931
+ # "value": "180226025.69791713065326633165",
932
+ # "volume": "2900.2218",
933
+ # "volume_buy": "7.3847",
934
+ # "volume_sell": "6.1249"
948
935
  # }
949
- # },
936
+ # ],
950
937
  # "message": "OK"
951
938
  # }
952
939
  #
953
- return self.parse_ticker(response['data'], market)
940
+ data = self.safe_list(response, 'data', [])
941
+ result = self.safe_dict(data, 0, {})
942
+ return self.parse_ticker(result, market)
954
943
 
955
944
  def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
956
945
  """
957
946
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
958
- :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market008_all_market_ticker
959
- :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http009_market_ticker_all
947
+ :see: https://docs.coinex.com/api/v2/spot/market/http/list-market-ticker
948
+ :see: https://docs.coinex.com/api/v2/futures/market/http/list-market-ticker
960
949
  :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
961
950
  :param dict [params]: extra parameters specific to the exchange API endpoint
962
951
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -970,83 +959,58 @@ class coinex(Exchange, ImplicitAPI):
970
959
  marketType, query = self.handle_market_type_and_params('fetchTickers', market, params)
971
960
  response = None
972
961
  if marketType == 'swap':
973
- response = self.v1PerpetualPublicGetMarketTickerAll(query)
962
+ response = self.v2PublicGetFuturesTicker(query)
974
963
  else:
975
- response = self.v1PublicGetMarketTickerAll()
964
+ response = self.v2PublicGetSpotTicker(query)
976
965
  #
977
966
  # Spot
978
967
  #
979
968
  # {
980
969
  # "code": 0,
981
- # "data": {
982
- # "date": 1651519857284,
983
- # "ticker": {
984
- # "PSPUSDT": {
985
- # "vol": "127131.55227034",
986
- # "low": "0.0669",
987
- # "open": "0.0688",
988
- # "high": "0.0747",
989
- # "last": "0.0685",
990
- # "buy": "0.0676",
991
- # "buy_amount": "702.70117866",
992
- # "sell": "0.0690",
993
- # "sell_amount": "686.76861562"
994
- # },
970
+ # "data": [
971
+ # {
972
+ # "close": "62393.47",
973
+ # "high": "64106.41",
974
+ # "last": "62393.47",
975
+ # "low": "59650.01",
976
+ # "market": "BTCUSDT",
977
+ # "open": "61616.15",
978
+ # "period": 86400,
979
+ # "value": "28711273.4065667262",
980
+ # "volume": "461.76557205",
981
+ # "volume_buy": "11.41506354",
982
+ # "volume_sell": "7.3240169"
995
983
  # }
996
- # },
997
- # "message": "Ok"
984
+ # ],
985
+ # "message": "OK"
998
986
  # }
999
987
  #
1000
988
  # Swap
1001
989
  #
1002
990
  # {
1003
991
  # "code": 0,
1004
- # "data": {
1005
- # "date": 1651520268644,
1006
- # "ticker": {
1007
- # "KAVAUSDT": {
1008
- # "vol": "834924",
1009
- # "low": "3.9418",
1010
- # "open": "4.1834",
1011
- # "high": "4.4328",
1012
- # "last": "4.0516",
1013
- # "buy": "4.0443",
1014
- # "period": 86400,
1015
- # "funding_time": 262,
1016
- # "position_amount": "16111",
1017
- # "funding_rate_last": "-0.00069514",
1018
- # "funding_rate_next": "-0.00061009",
1019
- # "funding_rate_predict": "-0.00055812",
1020
- # "insurance": "16532425.53026084124483989548",
1021
- # "sign_price": "4.0516",
1022
- # "index_price": "4.0530",
1023
- # "sell_total": "59446",
1024
- # "buy_total": "62423",
1025
- # "buy_amount": "959",
1026
- # "sell": "4.0466",
1027
- # "sell_amount": "141"
1028
- # },
992
+ # "data": [
993
+ # {
994
+ # "close": "62480.08",
995
+ # "high": "64100",
996
+ # "index_price": "62443.05",
997
+ # "last": "62480.08",
998
+ # "low": "59600",
999
+ # "mark_price": "62443.05",
1000
+ # "market": "BTCUSDT",
1001
+ # "open": "61679.98",
1002
+ # "period": 86400,
1003
+ # "value": "180226025.69791713065326633165",
1004
+ # "volume": "2900.2218",
1005
+ # "volume_buy": "7.3847",
1006
+ # "volume_sell": "6.1249"
1029
1007
  # }
1030
- # },
1031
- # "message": "Ok"
1008
+ # ],
1009
+ # "message": "OK"
1032
1010
  # }
1033
1011
  #
1034
- data = self.safe_value(response, 'data')
1035
- timestamp = self.safe_integer(data, 'date')
1036
- tickers = self.safe_value(data, 'ticker', {})
1037
- marketIds = list(tickers.keys())
1038
- result = {}
1039
- for i in range(0, len(marketIds)):
1040
- marketId = marketIds[i]
1041
- marketInner = self.safe_market(marketId, None, None, marketType)
1042
- symbol = marketInner['symbol']
1043
- ticker = self.parse_ticker({
1044
- 'date': timestamp,
1045
- 'ticker': tickers[marketId],
1046
- }, marketInner)
1047
- ticker['symbol'] = symbol
1048
- result[symbol] = ticker
1049
- return self.filter_by_array_tickers(result, 'symbol', symbols)
1012
+ data = self.safe_list(response, 'data', [])
1013
+ return self.parse_tickers(data, symbols)
1050
1014
 
1051
1015
  def fetch_time(self, params={}):
1052
1016
  """
ccxt/cryptocom.py CHANGED
@@ -1500,7 +1500,7 @@ class cryptocom(Exchange, ImplicitAPI):
1500
1500
  """
1501
1501
  tag, params = self.handle_withdraw_tag_and_params(tag, params)
1502
1502
  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
  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: