ccxt 4.2.84__py2.py3-none-any.whl → 4.2.85__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.
Files changed (150) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/ace.py +5 -5
  3. ccxt/ascendex.py +8 -8
  4. ccxt/async_support/__init__.py +1 -1
  5. ccxt/async_support/ace.py +5 -5
  6. ccxt/async_support/ascendex.py +8 -8
  7. ccxt/async_support/base/exchange.py +3 -27
  8. ccxt/async_support/bigone.py +12 -12
  9. ccxt/async_support/binance.py +20 -32
  10. ccxt/async_support/bingx.py +12 -9
  11. ccxt/async_support/bit2c.py +1 -1
  12. ccxt/async_support/bitbank.py +8 -8
  13. ccxt/async_support/bitbns.py +5 -5
  14. ccxt/async_support/bitfinex.py +1 -1
  15. ccxt/async_support/bitfinex2.py +1 -1
  16. ccxt/async_support/bitget.py +29 -24
  17. ccxt/async_support/bithumb.py +5 -5
  18. ccxt/async_support/bitmart.py +16 -16
  19. ccxt/async_support/bitopro.py +1 -1
  20. ccxt/async_support/bitrue.py +4 -4
  21. ccxt/async_support/bitso.py +5 -5
  22. ccxt/async_support/bitstamp.py +1 -1
  23. ccxt/async_support/bitteam.py +8 -8
  24. ccxt/async_support/bl3p.py +1 -1
  25. ccxt/async_support/btcturk.py +6 -6
  26. ccxt/async_support/bybit.py +30 -83
  27. ccxt/async_support/coincheck.py +4 -4
  28. ccxt/async_support/coinex.py +11 -11
  29. ccxt/async_support/coinlist.py +7 -7
  30. ccxt/async_support/coinmate.py +4 -4
  31. ccxt/async_support/coinmetro.py +3 -3
  32. ccxt/async_support/coinone.py +5 -5
  33. ccxt/async_support/coinspot.py +2 -2
  34. ccxt/async_support/cryptocom.py +17 -17
  35. ccxt/async_support/currencycom.py +1 -1
  36. ccxt/async_support/delta.py +0 -8
  37. ccxt/async_support/deribit.py +16 -80
  38. ccxt/async_support/digifinex.py +8 -8
  39. ccxt/async_support/exmo.py +8 -8
  40. ccxt/async_support/gate.py +0 -8
  41. ccxt/async_support/hitbtc.py +5 -4
  42. ccxt/async_support/hollaex.py +7 -7
  43. ccxt/async_support/htx.py +7 -7
  44. ccxt/async_support/huobijp.py +3 -3
  45. ccxt/async_support/idex.py +2 -2
  46. ccxt/async_support/independentreserve.py +2 -2
  47. ccxt/async_support/indodax.py +2 -2
  48. ccxt/async_support/kraken.py +8 -8
  49. ccxt/async_support/krakenfutures.py +6 -6
  50. ccxt/async_support/kucoin.py +4 -1
  51. ccxt/async_support/kucoinfutures.py +8 -8
  52. ccxt/async_support/kuna.py +16 -16
  53. ccxt/async_support/latoken.py +2 -2
  54. ccxt/async_support/lbank.py +10 -10
  55. ccxt/async_support/luno.py +4 -4
  56. ccxt/async_support/mercado.py +5 -5
  57. ccxt/async_support/mexc.py +6 -6
  58. ccxt/async_support/ndax.py +1 -1
  59. ccxt/async_support/novadax.py +9 -9
  60. ccxt/async_support/oceanex.py +7 -7
  61. ccxt/async_support/okcoin.py +13 -13
  62. ccxt/async_support/okx.py +23 -31
  63. ccxt/async_support/onetrading.py +4 -4
  64. ccxt/async_support/p2b.py +7 -7
  65. ccxt/async_support/phemex.py +12 -12
  66. ccxt/async_support/poloniexfutures.py +5 -5
  67. ccxt/async_support/probit.py +11 -11
  68. ccxt/async_support/timex.py +7 -7
  69. ccxt/async_support/tokocrypto.py +9 -9
  70. ccxt/async_support/wavesexchange.py +3 -3
  71. ccxt/async_support/whitebit.py +5 -5
  72. ccxt/async_support/woo.py +1 -1
  73. ccxt/async_support/zaif.py +1 -1
  74. ccxt/async_support/zonda.py +7 -7
  75. ccxt/base/exchange.py +66 -23
  76. ccxt/bigone.py +12 -12
  77. ccxt/binance.py +20 -32
  78. ccxt/bingx.py +12 -9
  79. ccxt/bit2c.py +1 -1
  80. ccxt/bitbank.py +8 -8
  81. ccxt/bitbns.py +5 -5
  82. ccxt/bitfinex.py +1 -1
  83. ccxt/bitfinex2.py +1 -1
  84. ccxt/bitget.py +29 -24
  85. ccxt/bithumb.py +5 -5
  86. ccxt/bitmart.py +16 -16
  87. ccxt/bitopro.py +1 -1
  88. ccxt/bitrue.py +4 -4
  89. ccxt/bitso.py +5 -5
  90. ccxt/bitstamp.py +1 -1
  91. ccxt/bitteam.py +8 -8
  92. ccxt/bl3p.py +1 -1
  93. ccxt/btcturk.py +6 -6
  94. ccxt/bybit.py +30 -83
  95. ccxt/coincheck.py +4 -4
  96. ccxt/coinex.py +11 -11
  97. ccxt/coinlist.py +7 -7
  98. ccxt/coinmate.py +4 -4
  99. ccxt/coinmetro.py +3 -3
  100. ccxt/coinone.py +5 -5
  101. ccxt/coinspot.py +2 -2
  102. ccxt/cryptocom.py +17 -17
  103. ccxt/currencycom.py +1 -1
  104. ccxt/delta.py +0 -8
  105. ccxt/deribit.py +16 -80
  106. ccxt/digifinex.py +8 -8
  107. ccxt/exmo.py +8 -8
  108. ccxt/gate.py +0 -8
  109. ccxt/hitbtc.py +5 -4
  110. ccxt/hollaex.py +7 -7
  111. ccxt/htx.py +7 -7
  112. ccxt/huobijp.py +3 -3
  113. ccxt/idex.py +2 -2
  114. ccxt/independentreserve.py +2 -2
  115. ccxt/indodax.py +2 -2
  116. ccxt/kraken.py +8 -8
  117. ccxt/krakenfutures.py +6 -6
  118. ccxt/kucoin.py +4 -1
  119. ccxt/kucoinfutures.py +8 -8
  120. ccxt/kuna.py +16 -16
  121. ccxt/latoken.py +2 -2
  122. ccxt/lbank.py +10 -10
  123. ccxt/luno.py +4 -4
  124. ccxt/mercado.py +5 -5
  125. ccxt/mexc.py +6 -6
  126. ccxt/ndax.py +1 -1
  127. ccxt/novadax.py +9 -9
  128. ccxt/oceanex.py +7 -7
  129. ccxt/okcoin.py +13 -13
  130. ccxt/okx.py +23 -31
  131. ccxt/onetrading.py +4 -4
  132. ccxt/p2b.py +7 -7
  133. ccxt/phemex.py +12 -12
  134. ccxt/poloniexfutures.py +5 -5
  135. ccxt/pro/__init__.py +1 -1
  136. ccxt/pro/binance.py +150 -112
  137. ccxt/pro/kucoin.py +6 -7
  138. ccxt/pro/okx.py +12 -1
  139. ccxt/probit.py +11 -11
  140. ccxt/timex.py +7 -7
  141. ccxt/tokocrypto.py +9 -9
  142. ccxt/wavesexchange.py +3 -3
  143. ccxt/whitebit.py +5 -5
  144. ccxt/woo.py +1 -1
  145. ccxt/zaif.py +1 -1
  146. ccxt/zonda.py +7 -7
  147. {ccxt-4.2.84.dist-info → ccxt-4.2.85.dist-info}/METADATA +4 -4
  148. {ccxt-4.2.84.dist-info → ccxt-4.2.85.dist-info}/RECORD +150 -150
  149. {ccxt-4.2.84.dist-info → ccxt-4.2.85.dist-info}/WHEEL +0 -0
  150. {ccxt-4.2.84.dist-info → ccxt-4.2.85.dist-info}/top_level.txt +0 -0
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.84'
7
+ __version__ = '4.2.85'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -321,8 +321,6 @@ class Exchange(object):
321
321
  'fetchDepositAddresses': None,
322
322
  'fetchDepositAddressesByNetwork': None,
323
323
  'fetchDeposits': None,
324
- 'fetchFundingFee': None,
325
- 'fetchFundingFees': None,
326
324
  'fetchFundingHistory': None,
327
325
  'fetchFundingRate': None,
328
326
  'fetchFundingRateHistory': None,
@@ -1497,13 +1495,6 @@ class Exchange(object):
1497
1495
  markets = self.fetch_markets(params)
1498
1496
  return self.set_markets(markets, currencies)
1499
1497
 
1500
- def load_fees(self, reload=False):
1501
- if not reload:
1502
- if self.loaded_fees != Exchange.loaded_fees:
1503
- return self.loaded_fees
1504
- self.loaded_fees = self.deep_extend(self.loaded_fees, self.fetch_fees())
1505
- return self.loaded_fees
1506
-
1507
1498
  def fetch_markets(self, params={}):
1508
1499
  # markets are returned as a list
1509
1500
  # currencies are returned as a dict
@@ -3834,18 +3825,6 @@ class Exchange(object):
3834
3825
  def fetch_status(self, params={}):
3835
3826
  raise NotSupported(self.id + ' fetchStatus() is not supported yet')
3836
3827
 
3837
- def fetch_funding_fee(self, code: str, params={}):
3838
- warnOnFetchFundingFee = self.safe_bool(self.options, 'warnOnFetchFundingFee', True)
3839
- if warnOnFetchFundingFee:
3840
- raise NotSupported(self.id + ' fetchFundingFee() method is deprecated, it will be removed in July 2022, please, use fetchTransactionFee() or set exchange.options["warnOnFetchFundingFee"] = False to suppress self warning')
3841
- return self.fetch_transaction_fee(code, params)
3842
-
3843
- def fetch_funding_fees(self, codes: List[str] = None, params={}):
3844
- warnOnFetchFundingFees = self.safe_bool(self.options, 'warnOnFetchFundingFees', True)
3845
- if warnOnFetchFundingFees:
3846
- raise NotSupported(self.id + ' fetchFundingFees() method is deprecated, it will be removed in July 2022. Please, use fetchTransactionFees() or set exchange.options["warnOnFetchFundingFees"] = False to suppress self warning')
3847
- return self.fetch_transaction_fees(codes, params)
3848
-
3849
3828
  def fetch_transaction_fee(self, code: str, params={}):
3850
3829
  if not self.has['fetchTransactionFees']:
3851
3830
  raise NotSupported(self.id + ' fetchTransactionFee() is not supported yet')
@@ -4031,7 +4010,7 @@ class Exchange(object):
4031
4010
  def fetch_order_books(self, symbols: List[str] = None, limit: Int = None, params={}):
4032
4011
  raise NotSupported(self.id + ' fetchOrderBooks() is not supported yet')
4033
4012
 
4034
- def watch_bids_asks(self, symbols: List[str] = None, params={}):
4013
+ def watch_bids_asks(self, symbols: Strings = None, params={}):
4035
4014
  raise NotSupported(self.id + ' watchBidsAsks() is not supported yet')
4036
4015
 
4037
4016
  def watch_tickers(self, symbols: List[str] = None, params={}):
@@ -5378,3 +5357,67 @@ class Exchange(object):
5378
5357
 
5379
5358
  def parse_leverage(self, leverage, market: Market = None):
5380
5359
  raise NotSupported(self.id + ' parseLeverage() is not supported yet')
5360
+
5361
+ def convert_expire_date(self, date: str):
5362
+ # parse YYMMDD to datetime string
5363
+ year = date[0:2]
5364
+ month = date[2:4]
5365
+ day = date[4:6]
5366
+ reconstructedDate = '20' + year + '-' + month + '-' + day + 'T00:00:00Z'
5367
+ return reconstructedDate
5368
+
5369
+ def convert_expire_date_to_market_id_date(self, date: str):
5370
+ # parse 240119 to 19JAN24
5371
+ year = date[0:2]
5372
+ monthRaw = date[2:4]
5373
+ month = None
5374
+ day = date[4:6]
5375
+ if monthRaw == '01':
5376
+ month = 'JAN'
5377
+ elif monthRaw == '02':
5378
+ month = 'FEB'
5379
+ elif monthRaw == '03':
5380
+ month = 'MAR'
5381
+ elif monthRaw == '04':
5382
+ month = 'APR'
5383
+ elif monthRaw == '05':
5384
+ month = 'MAY'
5385
+ elif monthRaw == '06':
5386
+ month = 'JUN'
5387
+ elif monthRaw == '07':
5388
+ month = 'JUL'
5389
+ elif monthRaw == '08':
5390
+ month = 'AUG'
5391
+ elif monthRaw == '09':
5392
+ month = 'SEP'
5393
+ elif monthRaw == '10':
5394
+ month = 'OCT'
5395
+ elif monthRaw == '11':
5396
+ month = 'NOV'
5397
+ elif monthRaw == '12':
5398
+ month = 'DEC'
5399
+ reconstructedDate = day + month + year
5400
+ return reconstructedDate
5401
+
5402
+ def convert_market_id_expire_date(self, date: str):
5403
+ # parse 19JAN24 to 240119
5404
+ monthMappping = {
5405
+ 'JAN': '01',
5406
+ 'FEB': '02',
5407
+ 'MAR': '03',
5408
+ 'APR': '04',
5409
+ 'MAY': '05',
5410
+ 'JUN': '06',
5411
+ 'JUL': '07',
5412
+ 'AUG': '08',
5413
+ 'SEP': '09',
5414
+ 'OCT': '10',
5415
+ 'NOV': '11',
5416
+ 'DEC': '12',
5417
+ }
5418
+ year = date[0:2]
5419
+ monthName = date[2:5]
5420
+ month = self.safe_string(monthMappping, monthName)
5421
+ day = date[5:7]
5422
+ reconstructedDate = day + month + year
5423
+ return reconstructedDate
ccxt/bigone.py CHANGED
@@ -810,7 +810,7 @@ class bigone(Exchange, ImplicitAPI):
810
810
  # }
811
811
  # }
812
812
  #
813
- ticker = self.safe_value(response, 'data', {})
813
+ ticker = self.safe_dict(response, 'data', {})
814
814
  return self.parse_ticker(ticker, market)
815
815
  else:
816
816
  tickers = self.fetch_tickers([symbol], params)
@@ -983,7 +983,7 @@ class bigone(Exchange, ImplicitAPI):
983
983
  # }
984
984
  # }
985
985
  #
986
- orderbook = self.safe_value(response, 'data', {})
986
+ orderbook = self.safe_dict(response, 'data', {})
987
987
  return self.parse_order_book(orderbook, market['symbol'], None, 'bids', 'asks', 'price', 'quantity')
988
988
 
989
989
  def parse_contract_bids_asks(self, bidsAsks):
@@ -1171,7 +1171,7 @@ class bigone(Exchange, ImplicitAPI):
1171
1171
  # ]
1172
1172
  # }
1173
1173
  #
1174
- trades = self.safe_value(response, 'data', [])
1174
+ trades = self.safe_list(response, 'data', [])
1175
1175
  return self.parse_trades(trades, market, since, limit)
1176
1176
 
1177
1177
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -1245,7 +1245,7 @@ class bigone(Exchange, ImplicitAPI):
1245
1245
  # ]
1246
1246
  # }
1247
1247
  #
1248
- data = self.safe_value(response, 'data', [])
1248
+ data = self.safe_list(response, 'data', [])
1249
1249
  return self.parse_ohlcvs(data, market, timeframe, since, limit)
1250
1250
 
1251
1251
  def parse_balance(self, response) -> Balances:
@@ -1483,7 +1483,7 @@ class bigone(Exchange, ImplicitAPI):
1483
1483
  # "updated_at":"2019-01-29T06:05:56Z"
1484
1484
  # }
1485
1485
  #
1486
- order = self.safe_value(response, 'data')
1486
+ order = self.safe_dict(response, 'data')
1487
1487
  return self.parse_order(order, market)
1488
1488
 
1489
1489
  def cancel_order(self, id: str, symbol: Str = None, params={}):
@@ -1510,7 +1510,7 @@ class bigone(Exchange, ImplicitAPI):
1510
1510
  # "created_at":"2019-01-29T06:05:56Z",
1511
1511
  # "updated_at":"2019-01-29T06:05:56Z"
1512
1512
  # }
1513
- order = self.safe_value(response, 'data')
1513
+ order = self.safe_dict(response, 'data')
1514
1514
  return self.parse_order(order)
1515
1515
 
1516
1516
  def cancel_all_orders(self, symbol: Str = None, params={}):
@@ -1552,7 +1552,7 @@ class bigone(Exchange, ImplicitAPI):
1552
1552
  self.load_markets()
1553
1553
  request = {'id': id}
1554
1554
  response = self.privateGetOrdersId(self.extend(request, params))
1555
- order = self.safe_value(response, 'data', {})
1555
+ order = self.safe_dict(response, 'data', {})
1556
1556
  return self.parse_order(order)
1557
1557
 
1558
1558
  def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -1599,7 +1599,7 @@ class bigone(Exchange, ImplicitAPI):
1599
1599
  # "page_token":"dxzef",
1600
1600
  # }
1601
1601
  #
1602
- orders = self.safe_value(response, 'data', [])
1602
+ orders = self.safe_list(response, 'data', [])
1603
1603
  return self.parse_orders(orders, market, since, limit)
1604
1604
 
1605
1605
  def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -1657,7 +1657,7 @@ class bigone(Exchange, ImplicitAPI):
1657
1657
  # "page_token":"dxfv"
1658
1658
  # }
1659
1659
  #
1660
- trades = self.safe_value(response, 'data', [])
1660
+ trades = self.safe_list(response, 'data', [])
1661
1661
  return self.parse_trades(trades, market, since, limit)
1662
1662
 
1663
1663
  def parse_order_status(self, status):
@@ -1923,7 +1923,7 @@ class bigone(Exchange, ImplicitAPI):
1923
1923
  # ]
1924
1924
  # }
1925
1925
  #
1926
- deposits = self.safe_value(response, 'data', [])
1926
+ deposits = self.safe_list(response, 'data', [])
1927
1927
  return self.parse_transactions(deposits, currency, since, limit)
1928
1928
 
1929
1929
  def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
@@ -1971,7 +1971,7 @@ class bigone(Exchange, ImplicitAPI):
1971
1971
  # "page_token":"dxvf"
1972
1972
  # }
1973
1973
  #
1974
- withdrawals = self.safe_value(response, 'data', [])
1974
+ withdrawals = self.safe_list(response, 'data', [])
1975
1975
  return self.parse_transactions(withdrawals, currency, since, limit)
1976
1976
 
1977
1977
  def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
@@ -2091,7 +2091,7 @@ class bigone(Exchange, ImplicitAPI):
2091
2091
  # }
2092
2092
  # }
2093
2093
  #
2094
- data = self.safe_value(response, 'data', {})
2094
+ data = self.safe_dict(response, 'data', {})
2095
2095
  return self.parse_transaction(data, currency)
2096
2096
 
2097
2097
  def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
ccxt/binance.py CHANGED
@@ -2440,14 +2440,6 @@ class binance(Exchange, ImplicitAPI):
2440
2440
  super(binance, self).set_sandbox_mode(enable)
2441
2441
  self.options['sandboxMode'] = enable
2442
2442
 
2443
- def convert_expire_date(self, date):
2444
- # parse YYMMDD to timestamp
2445
- year = date[0:2]
2446
- month = date[2:4]
2447
- day = date[4:6]
2448
- reconstructedDate = '20' + year + '-' + month + '-' + day + 'T00:00:00Z'
2449
- return reconstructedDate
2450
-
2451
2443
  def create_expired_option_market(self, symbol: str):
2452
2444
  # support expired option contracts
2453
2445
  settle = 'USDT'
@@ -3859,26 +3851,24 @@ class binance(Exchange, ImplicitAPI):
3859
3851
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
3860
3852
  """
3861
3853
  self.load_markets()
3862
- symbols = self.market_symbols(symbols)
3863
- market = None
3864
- if symbols is not None:
3865
- first = self.safe_string(symbols, 0)
3866
- market = self.market(first)
3854
+ symbols = self.market_symbols(symbols, None, True, True, True)
3855
+ market = self.get_market_from_symbols(symbols)
3867
3856
  type = None
3857
+ type, params = self.handle_market_type_and_params('fetchBidsAsks', market, params)
3868
3858
  subType = None
3869
3859
  subType, params = self.handle_sub_type_and_params('fetchBidsAsks', market, params)
3870
- type, params = self.handle_market_type_and_params('fetchBidsAsks', market, params)
3871
3860
  response = None
3872
3861
  if self.is_linear(type, subType):
3873
3862
  response = self.fapiPublicGetTickerBookTicker(params)
3874
3863
  elif self.is_inverse(type, subType):
3875
3864
  response = self.dapiPublicGetTickerBookTicker(params)
3876
- else:
3865
+ elif type == 'spot':
3877
3866
  request = {}
3878
3867
  if symbols is not None:
3879
- marketIds = self.market_ids(symbols)
3880
- request['symbols'] = self.json(marketIds)
3868
+ request['symbols'] = self.json(self.market_ids(symbols))
3881
3869
  response = self.publicGetTickerBookTicker(self.extend(request, params))
3870
+ else:
3871
+ raise NotSupported(self.id + ' fetchBidsAsks() does not support ' + type + ' markets yet')
3882
3872
  return self.parse_tickers(response, symbols)
3883
3873
 
3884
3874
  def fetch_last_prices(self, symbols: Strings = None, params={}):
@@ -3893,12 +3883,12 @@ class binance(Exchange, ImplicitAPI):
3893
3883
  :returns dict: a dictionary of lastprices structures
3894
3884
  """
3895
3885
  self.load_markets()
3896
- symbols = self.market_symbols(symbols)
3886
+ symbols = self.market_symbols(symbols, None, True, True, True)
3897
3887
  market = self.get_market_from_symbols(symbols)
3898
3888
  type = None
3889
+ type, params = self.handle_market_type_and_params('fetchLastPrices', market, params)
3899
3890
  subType = None
3900
3891
  subType, params = self.handle_sub_type_and_params('fetchLastPrices', market, params)
3901
- type, params = self.handle_market_type_and_params('fetchLastPrices', market, params)
3902
3892
  response = None
3903
3893
  if self.is_linear(type, subType):
3904
3894
  response = self.fapiPublicV2GetTickerPrice(params)
@@ -3993,28 +3983,26 @@ class binance(Exchange, ImplicitAPI):
3993
3983
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
3994
3984
  """
3995
3985
  self.load_markets()
3996
- type = None
3997
- market = None
3998
3986
  symbols = self.market_symbols(symbols, None, True, True, True)
3999
- if symbols is not None:
4000
- first = self.safe_string(symbols, 0)
4001
- market = self.market(first)
3987
+ market = self.get_market_from_symbols(symbols)
3988
+ type = None
4002
3989
  type, params = self.handle_market_type_and_params('fetchTickers', market, params)
4003
3990
  subType = None
4004
3991
  subType, params = self.handle_sub_type_and_params('fetchTickers', market, params)
4005
3992
  response = None
4006
- if type == 'option':
4007
- response = self.eapiPublicGetTicker(params)
4008
- elif self.is_linear(type, subType):
3993
+ if self.is_linear(type, subType):
4009
3994
  response = self.fapiPublicGetTicker24hr(params)
4010
3995
  elif self.is_inverse(type, subType):
4011
3996
  response = self.dapiPublicGetTicker24hr(params)
4012
- else:
3997
+ elif type == 'spot':
4013
3998
  request = {}
4014
3999
  if symbols is not None:
4015
- marketIds = self.market_ids(symbols)
4016
- request['symbols'] = self.json(marketIds)
4000
+ request['symbols'] = self.json(self.market_ids(symbols))
4017
4001
  response = self.publicGetTicker24hr(self.extend(request, params))
4002
+ elif type == 'option':
4003
+ response = self.eapiPublicGetTicker(params)
4004
+ else:
4005
+ raise NotSupported(self.id + ' fetchTickers() does not support ' + type + ' markets yet')
4018
4006
  return self.parse_tickers(response, symbols)
4019
4007
 
4020
4008
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -4635,7 +4623,7 @@ class binance(Exchange, ImplicitAPI):
4635
4623
  # }
4636
4624
  # }
4637
4625
  #
4638
- data = self.safe_value(response, 'newOrderResponse')
4626
+ data = self.safe_dict(response, 'newOrderResponse')
4639
4627
  return self.parse_order(data, market)
4640
4628
 
4641
4629
  def edit_spot_order_request(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
@@ -11400,7 +11388,7 @@ class binance(Exchange, ImplicitAPI):
11400
11388
  #
11401
11389
  else:
11402
11390
  raise BadRequest(self.id + ' fetchMarginModes() supports linear and inverse subTypes only')
11403
- assets = self.safe_value(response, 'positions', [])
11391
+ assets = self.safe_list(response, 'positions', [])
11404
11392
  return self.parse_margin_modes(assets, symbols, 'symbol', 'swap')
11405
11393
 
11406
11394
  def parse_margin_mode(self, marginMode, market=None) -> MarginMode:
ccxt/bingx.py CHANGED
@@ -1333,9 +1333,12 @@ class bingx(Exchange, ImplicitAPI):
1333
1333
  response = self.spotV1PublicGetTicker24hr(self.extend(request, params))
1334
1334
  else:
1335
1335
  response = self.swapV2PublicGetQuoteTicker(self.extend(request, params))
1336
- data = self.safe_value(response, 'data')
1337
- ticker = self.safe_value(data, 0, data)
1338
- return self.parse_ticker(ticker, market)
1336
+ data = self.safe_list(response, 'data')
1337
+ if data is not None:
1338
+ first = self.safe_dict(data, 0, {})
1339
+ return self.parse_ticker(first, market)
1340
+ dataDict = self.safe_dict(response, 'data', {})
1341
+ return self.parse_ticker(dataDict, market)
1339
1342
 
1340
1343
  def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
1341
1344
  """
@@ -1359,7 +1362,7 @@ class bingx(Exchange, ImplicitAPI):
1359
1362
  response = self.spotV1PublicGetTicker24hr(params)
1360
1363
  else:
1361
1364
  response = self.swapV2PublicGetQuoteTicker(params)
1362
- tickers = self.safe_value(response, 'data')
1365
+ tickers = self.safe_list(response, 'data')
1363
1366
  return self.parse_tickers(tickers, symbols)
1364
1367
 
1365
1368
  def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
@@ -1938,7 +1941,7 @@ class bingx(Exchange, ImplicitAPI):
1938
1941
  response = self.fix_stringified_json_members(response)
1939
1942
  response = self.parse_json(response)
1940
1943
  data = self.safe_value(response, 'data', {})
1941
- order = self.safe_value(data, 'order', data)
1944
+ order = self.safe_dict(data, 'order', data)
1942
1945
  return self.parse_order(order, market)
1943
1946
 
1944
1947
  def create_orders(self, orders: List[OrderRequest], params={}):
@@ -2407,7 +2410,7 @@ class bingx(Exchange, ImplicitAPI):
2407
2410
  # }
2408
2411
  #
2409
2412
  data = self.safe_value(response, 'data')
2410
- first = self.safe_value(data, 'order', data)
2413
+ first = self.safe_dict(data, 'order', data)
2411
2414
  return self.parse_order(first, market)
2412
2415
 
2413
2416
  def cancel_all_orders(self, symbol: Str = None, params={}):
@@ -2632,7 +2635,7 @@ class bingx(Exchange, ImplicitAPI):
2632
2635
  # }
2633
2636
  #
2634
2637
  data = self.safe_value(response, 'data')
2635
- first = self.safe_value(data, 'order', data)
2638
+ first = self.safe_dict(data, 'order', data)
2636
2639
  return self.parse_order(first, market)
2637
2640
 
2638
2641
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -2804,7 +2807,7 @@ class bingx(Exchange, ImplicitAPI):
2804
2807
  # }
2805
2808
  #
2806
2809
  data = self.safe_value(response, 'data', [])
2807
- orders = self.safe_value(data, 'orders', [])
2810
+ orders = self.safe_list(data, 'orders', [])
2808
2811
  return self.parse_orders(orders, market, since, limit)
2809
2812
 
2810
2813
  def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
@@ -3492,7 +3495,7 @@ class bingx(Exchange, ImplicitAPI):
3492
3495
  """
3493
3496
  self.load_markets()
3494
3497
  response = self.walletsV1PrivateGetCapitalConfigGetall(params)
3495
- coins = self.safe_value(response, 'data')
3498
+ coins = self.safe_list(response, 'data')
3496
3499
  return self.parse_deposit_withdraw_fees(coins, codes, 'coin')
3497
3500
 
3498
3501
  def withdraw(self, code: str, amount: float, address, tag=None, params={}):
ccxt/bit2c.py CHANGED
@@ -470,7 +470,7 @@ class bit2c(Exchange, ImplicitAPI):
470
470
  response = self.privateGetOrderMyOrders(self.extend(request, params))
471
471
  orders = self.safe_value(response, market['id'], {})
472
472
  asks = self.safe_value(orders, 'ask', [])
473
- bids = self.safe_value(orders, 'bid', [])
473
+ bids = self.safe_list(orders, 'bid', [])
474
474
  return self.parse_orders(self.array_concat(asks, bids), market, since, limit)
475
475
 
476
476
  def fetch_order(self, id: str, symbol: Str = None, params={}):
ccxt/bitbank.py CHANGED
@@ -302,7 +302,7 @@ class bitbank(Exchange, ImplicitAPI):
302
302
  'pair': market['id'],
303
303
  }
304
304
  response = self.publicGetPairTicker(self.extend(request, params))
305
- data = self.safe_value(response, 'data', {})
305
+ data = self.safe_dict(response, 'data', {})
306
306
  return self.parse_ticker(data, market)
307
307
 
308
308
  def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
@@ -385,7 +385,7 @@ class bitbank(Exchange, ImplicitAPI):
385
385
  }
386
386
  response = self.publicGetPairTransactions(self.extend(request, params))
387
387
  data = self.safe_value(response, 'data', {})
388
- trades = self.safe_value(data, 'transactions', [])
388
+ trades = self.safe_list(data, 'transactions', [])
389
389
  return self.parse_trades(trades, market, since, limit)
390
390
 
391
391
  def fetch_trading_fees(self, params={}):
@@ -508,7 +508,7 @@ class bitbank(Exchange, ImplicitAPI):
508
508
  data = self.safe_value(response, 'data', {})
509
509
  candlestick = self.safe_value(data, 'candlestick', [])
510
510
  first = self.safe_value(candlestick, 0, {})
511
- ohlcv = self.safe_value(first, 'ohlcv', [])
511
+ ohlcv = self.safe_list(first, 'ohlcv', [])
512
512
  return self.parse_ohlcvs(ohlcv, market, timeframe, since, limit)
513
513
 
514
514
  def parse_balance(self, response) -> Balances:
@@ -645,7 +645,7 @@ class bitbank(Exchange, ImplicitAPI):
645
645
  if type == 'limit':
646
646
  request['price'] = self.price_to_precision(symbol, price)
647
647
  response = self.privatePostUserSpotOrder(self.extend(request, params))
648
- data = self.safe_value(response, 'data')
648
+ data = self.safe_dict(response, 'data')
649
649
  return self.parse_order(data, market)
650
650
 
651
651
  def cancel_order(self, id: str, symbol: Str = None, params={}):
@@ -682,7 +682,7 @@ class bitbank(Exchange, ImplicitAPI):
682
682
  'pair': market['id'],
683
683
  }
684
684
  response = self.privateGetUserSpotOrder(self.extend(request, params))
685
- data = self.safe_value(response, 'data')
685
+ data = self.safe_dict(response, 'data')
686
686
  return self.parse_order(data, market)
687
687
 
688
688
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -706,7 +706,7 @@ class bitbank(Exchange, ImplicitAPI):
706
706
  request['since'] = self.parse_to_int(since / 1000)
707
707
  response = self.privateGetUserSpotActiveOrders(self.extend(request, params))
708
708
  data = self.safe_value(response, 'data', {})
709
- orders = self.safe_value(data, 'orders', [])
709
+ orders = self.safe_list(data, 'orders', [])
710
710
  return self.parse_orders(orders, market, since, limit)
711
711
 
712
712
  def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -731,7 +731,7 @@ class bitbank(Exchange, ImplicitAPI):
731
731
  request['since'] = self.parse_to_int(since / 1000)
732
732
  response = self.privateGetUserSpotTradeHistory(self.extend(request, params))
733
733
  data = self.safe_value(response, 'data', {})
734
- trades = self.safe_value(data, 'trades', [])
734
+ trades = self.safe_list(data, 'trades', [])
735
735
  return self.parse_trades(trades, market, since, limit)
736
736
 
737
737
  def fetch_deposit_address(self, code: str, params={}):
@@ -799,7 +799,7 @@ class bitbank(Exchange, ImplicitAPI):
799
799
  # }
800
800
  # }
801
801
  #
802
- data = self.safe_value(response, 'data', {})
802
+ data = self.safe_dict(response, 'data', {})
803
803
  return self.parse_transaction(data, currency)
804
804
 
805
805
  def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
ccxt/bitbns.py CHANGED
@@ -696,7 +696,7 @@ class bitbns(Exchange, ImplicitAPI):
696
696
  # }
697
697
  #
698
698
  data = self.safe_value(response, 'data', [])
699
- first = self.safe_value(data, 0)
699
+ first = self.safe_dict(data, 0)
700
700
  return self.parse_order(first, market)
701
701
 
702
702
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -744,7 +744,7 @@ class bitbns(Exchange, ImplicitAPI):
744
744
  # "code":200
745
745
  # }
746
746
  #
747
- data = self.safe_value(response, 'data', [])
747
+ data = self.safe_list(response, 'data', [])
748
748
  return self.parse_orders(data, market, since, limit)
749
749
 
750
750
  def parse_trade(self, trade, market: Market = None) -> Trade:
@@ -884,7 +884,7 @@ class bitbns(Exchange, ImplicitAPI):
884
884
  # "code": 200
885
885
  # }
886
886
  #
887
- data = self.safe_value(response, 'data', [])
887
+ data = self.safe_list(response, 'data', [])
888
888
  return self.parse_trades(data, market, since, limit)
889
889
 
890
890
  def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
@@ -955,7 +955,7 @@ class bitbns(Exchange, ImplicitAPI):
955
955
  # "code":200
956
956
  # }
957
957
  #
958
- data = self.safe_value(response, 'data', [])
958
+ data = self.safe_list(response, 'data', [])
959
959
  return self.parse_transactions(data, currency, since, limit)
960
960
 
961
961
  def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
@@ -979,7 +979,7 @@ class bitbns(Exchange, ImplicitAPI):
979
979
  #
980
980
  # ...
981
981
  #
982
- data = self.safe_value(response, 'data', [])
982
+ data = self.safe_list(response, 'data', [])
983
983
  return self.parse_transactions(data, currency, since, limit)
984
984
 
985
985
  def parse_transaction_status_by_type(self, status, type=None):
ccxt/bitfinex.py CHANGED
@@ -460,7 +460,7 @@ class bitfinex(Exchange, ImplicitAPI):
460
460
  # }
461
461
  # }
462
462
  #
463
- withdraw = self.safe_value(response, 'withdraw')
463
+ withdraw = self.safe_list(response, 'withdraw')
464
464
  return self.parse_deposit_withdraw_fees(withdraw, codes)
465
465
 
466
466
  def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
ccxt/bitfinex2.py CHANGED
@@ -1712,7 +1712,7 @@ class bitfinex2(Exchange, ImplicitAPI):
1712
1712
  'all': 1,
1713
1713
  }
1714
1714
  response = self.privatePostAuthWOrderCancelMulti(self.extend(request, params))
1715
- orders = self.safe_value(response, 4, [])
1715
+ orders = self.safe_list(response, 4, [])
1716
1716
  return self.parse_orders(orders)
1717
1717
 
1718
1718
  def cancel_order(self, id: str, symbol: Str = None, params={}):