ccxt 4.2.84__py2.py3-none-any.whl → 4.2.86__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.

Files changed (152) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/coinex.py +232 -123
  3. ccxt/ace.py +5 -5
  4. ccxt/ascendex.py +8 -8
  5. ccxt/async_support/__init__.py +1 -1
  6. ccxt/async_support/ace.py +5 -5
  7. ccxt/async_support/ascendex.py +8 -8
  8. ccxt/async_support/base/exchange.py +3 -27
  9. ccxt/async_support/bigone.py +12 -12
  10. ccxt/async_support/binance.py +20 -32
  11. ccxt/async_support/bingx.py +45 -28
  12. ccxt/async_support/bit2c.py +1 -1
  13. ccxt/async_support/bitbank.py +27 -29
  14. ccxt/async_support/bitbns.py +5 -5
  15. ccxt/async_support/bitfinex.py +1 -1
  16. ccxt/async_support/bitfinex2.py +1 -1
  17. ccxt/async_support/bitget.py +29 -24
  18. ccxt/async_support/bithumb.py +5 -5
  19. ccxt/async_support/bitmart.py +16 -16
  20. ccxt/async_support/bitopro.py +1 -1
  21. ccxt/async_support/bitrue.py +4 -4
  22. ccxt/async_support/bitso.py +5 -5
  23. ccxt/async_support/bitstamp.py +1 -1
  24. ccxt/async_support/bitteam.py +8 -8
  25. ccxt/async_support/bl3p.py +1 -1
  26. ccxt/async_support/btcturk.py +6 -6
  27. ccxt/async_support/bybit.py +30 -83
  28. ccxt/async_support/coincheck.py +4 -4
  29. ccxt/async_support/coinex.py +404 -262
  30. ccxt/async_support/coinlist.py +7 -7
  31. ccxt/async_support/coinmate.py +4 -4
  32. ccxt/async_support/coinmetro.py +3 -3
  33. ccxt/async_support/coinone.py +5 -5
  34. ccxt/async_support/coinspot.py +2 -2
  35. ccxt/async_support/cryptocom.py +17 -17
  36. ccxt/async_support/currencycom.py +1 -1
  37. ccxt/async_support/delta.py +0 -8
  38. ccxt/async_support/deribit.py +16 -80
  39. ccxt/async_support/digifinex.py +8 -8
  40. ccxt/async_support/exmo.py +8 -8
  41. ccxt/async_support/gate.py +0 -8
  42. ccxt/async_support/hitbtc.py +5 -4
  43. ccxt/async_support/hollaex.py +7 -7
  44. ccxt/async_support/htx.py +7 -7
  45. ccxt/async_support/huobijp.py +3 -3
  46. ccxt/async_support/idex.py +12 -12
  47. ccxt/async_support/independentreserve.py +2 -2
  48. ccxt/async_support/indodax.py +2 -2
  49. ccxt/async_support/kraken.py +8 -8
  50. ccxt/async_support/krakenfutures.py +6 -6
  51. ccxt/async_support/kucoin.py +4 -1
  52. ccxt/async_support/kucoinfutures.py +8 -8
  53. ccxt/async_support/kuna.py +16 -16
  54. ccxt/async_support/latoken.py +2 -2
  55. ccxt/async_support/lbank.py +10 -10
  56. ccxt/async_support/luno.py +4 -4
  57. ccxt/async_support/mercado.py +5 -5
  58. ccxt/async_support/mexc.py +6 -6
  59. ccxt/async_support/ndax.py +1 -1
  60. ccxt/async_support/novadax.py +9 -9
  61. ccxt/async_support/oceanex.py +7 -7
  62. ccxt/async_support/okcoin.py +15 -14
  63. ccxt/async_support/okx.py +23 -31
  64. ccxt/async_support/onetrading.py +4 -4
  65. ccxt/async_support/p2b.py +7 -7
  66. ccxt/async_support/phemex.py +12 -12
  67. ccxt/async_support/poloniexfutures.py +5 -5
  68. ccxt/async_support/probit.py +11 -11
  69. ccxt/async_support/timex.py +7 -7
  70. ccxt/async_support/tokocrypto.py +9 -9
  71. ccxt/async_support/wavesexchange.py +3 -3
  72. ccxt/async_support/whitebit.py +5 -5
  73. ccxt/async_support/woo.py +1 -1
  74. ccxt/async_support/zaif.py +1 -1
  75. ccxt/async_support/zonda.py +7 -7
  76. ccxt/base/exchange.py +66 -23
  77. ccxt/bigone.py +12 -12
  78. ccxt/binance.py +20 -32
  79. ccxt/bingx.py +45 -28
  80. ccxt/bit2c.py +1 -1
  81. ccxt/bitbank.py +27 -29
  82. ccxt/bitbns.py +5 -5
  83. ccxt/bitfinex.py +1 -1
  84. ccxt/bitfinex2.py +1 -1
  85. ccxt/bitget.py +29 -24
  86. ccxt/bithumb.py +5 -5
  87. ccxt/bitmart.py +16 -16
  88. ccxt/bitopro.py +1 -1
  89. ccxt/bitrue.py +4 -4
  90. ccxt/bitso.py +5 -5
  91. ccxt/bitstamp.py +1 -1
  92. ccxt/bitteam.py +8 -8
  93. ccxt/bl3p.py +1 -1
  94. ccxt/btcturk.py +6 -6
  95. ccxt/bybit.py +30 -83
  96. ccxt/coincheck.py +4 -4
  97. ccxt/coinex.py +404 -262
  98. ccxt/coinlist.py +7 -7
  99. ccxt/coinmate.py +4 -4
  100. ccxt/coinmetro.py +3 -3
  101. ccxt/coinone.py +5 -5
  102. ccxt/coinspot.py +2 -2
  103. ccxt/cryptocom.py +17 -17
  104. ccxt/currencycom.py +1 -1
  105. ccxt/delta.py +0 -8
  106. ccxt/deribit.py +16 -80
  107. ccxt/digifinex.py +8 -8
  108. ccxt/exmo.py +8 -8
  109. ccxt/gate.py +0 -8
  110. ccxt/hitbtc.py +5 -4
  111. ccxt/hollaex.py +7 -7
  112. ccxt/htx.py +7 -7
  113. ccxt/huobijp.py +3 -3
  114. ccxt/idex.py +12 -12
  115. ccxt/independentreserve.py +2 -2
  116. ccxt/indodax.py +2 -2
  117. ccxt/kraken.py +8 -8
  118. ccxt/krakenfutures.py +6 -6
  119. ccxt/kucoin.py +4 -1
  120. ccxt/kucoinfutures.py +8 -8
  121. ccxt/kuna.py +16 -16
  122. ccxt/latoken.py +2 -2
  123. ccxt/lbank.py +10 -10
  124. ccxt/luno.py +4 -4
  125. ccxt/mercado.py +5 -5
  126. ccxt/mexc.py +6 -6
  127. ccxt/ndax.py +1 -1
  128. ccxt/novadax.py +9 -9
  129. ccxt/oceanex.py +7 -7
  130. ccxt/okcoin.py +15 -14
  131. ccxt/okx.py +23 -31
  132. ccxt/onetrading.py +4 -4
  133. ccxt/p2b.py +7 -7
  134. ccxt/phemex.py +12 -12
  135. ccxt/poloniexfutures.py +5 -5
  136. ccxt/pro/__init__.py +1 -1
  137. ccxt/pro/binance.py +150 -112
  138. ccxt/pro/bitget.py +1 -0
  139. ccxt/pro/kucoin.py +6 -7
  140. ccxt/pro/okx.py +12 -1
  141. ccxt/probit.py +11 -11
  142. ccxt/timex.py +7 -7
  143. ccxt/tokocrypto.py +9 -9
  144. ccxt/wavesexchange.py +3 -3
  145. ccxt/whitebit.py +5 -5
  146. ccxt/woo.py +1 -1
  147. ccxt/zaif.py +1 -1
  148. ccxt/zonda.py +7 -7
  149. {ccxt-4.2.84.dist-info → ccxt-4.2.86.dist-info}/METADATA +6 -6
  150. {ccxt-4.2.84.dist-info → ccxt-4.2.86.dist-info}/RECORD +152 -152
  151. {ccxt-4.2.84.dist-info → ccxt-4.2.86.dist-info}/WHEEL +0 -0
  152. {ccxt-4.2.84.dist-info → ccxt-4.2.86.dist-info}/top_level.txt +0 -0
ccxt/bingx.py CHANGED
@@ -630,7 +630,7 @@ class bingx(Exchange, ImplicitAPI):
630
630
  if settle is not None:
631
631
  symbol += ':' + settle
632
632
  fees = self.safe_dict(self.fees, type, {})
633
- contractSize = self.safe_number(market, 'size')
633
+ contractSize = self.parse_number('1') if (swap) else None
634
634
  isActive = self.safe_string(market, 'status') == '1'
635
635
  isInverse = None if (spot) else False
636
636
  isLinear = None if (spot) else swap
@@ -671,7 +671,7 @@ class bingx(Exchange, ImplicitAPI):
671
671
  'max': self.safe_integer(market, 'maxLongLeverage'),
672
672
  },
673
673
  'amount': {
674
- 'min': self.safe_number(market, 'minQty'),
674
+ 'min': self.safe_number_2(market, 'minQty', 'tradeMinQuantity'),
675
675
  'max': self.safe_number(market, 'maxQty'),
676
676
  },
677
677
  'price': {
@@ -679,7 +679,7 @@ class bingx(Exchange, ImplicitAPI):
679
679
  'max': None,
680
680
  },
681
681
  'cost': {
682
- 'min': self.safe_number(market, 'minNotional'),
682
+ 'min': self.safe_number_2(market, 'minNotional', 'tradeMinUSDT'),
683
683
  'max': self.safe_number(market, 'maxNotional'),
684
684
  },
685
685
  },
@@ -1009,6 +1009,12 @@ class bingx(Exchange, ImplicitAPI):
1009
1009
  isMaker = self.safe_bool(trade, 'isMaker')
1010
1010
  if isMaker is not None:
1011
1011
  takeOrMaker = 'maker' if isMaker else 'taker'
1012
+ amount = self.safe_string_n(trade, ['qty', 'amount', 'q'])
1013
+ if (market is not None) and market['swap'] and ('volume' in trade):
1014
+ # private trade returns num of contracts instead of base currency(as the order-related methods do)
1015
+ contractSize = self.safe_string(market['info'], 'tradeMinQuantity')
1016
+ volume = self.safe_string(trade, 'volume')
1017
+ amount = Precise.string_mul(volume, contractSize)
1012
1018
  return self.safe_trade({
1013
1019
  'id': self.safe_string_n(trade, ['id', 't']),
1014
1020
  'info': trade,
@@ -1020,7 +1026,7 @@ class bingx(Exchange, ImplicitAPI):
1020
1026
  'side': self.parse_order_side(side),
1021
1027
  'takerOrMaker': takeOrMaker,
1022
1028
  'price': self.safe_string_2(trade, 'price', 'p'),
1023
- 'amount': self.safe_string_n(trade, ['qty', 'volume', 'amount', 'q']),
1029
+ 'amount': amount,
1024
1030
  'cost': cost,
1025
1031
  'fee': {
1026
1032
  'cost': self.parse_number(Precise.string_abs(self.safe_string_2(trade, 'commission', 'n'))),
@@ -1333,9 +1339,12 @@ class bingx(Exchange, ImplicitAPI):
1333
1339
  response = self.spotV1PublicGetTicker24hr(self.extend(request, params))
1334
1340
  else:
1335
1341
  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)
1342
+ data = self.safe_list(response, 'data')
1343
+ if data is not None:
1344
+ first = self.safe_dict(data, 0, {})
1345
+ return self.parse_ticker(first, market)
1346
+ dataDict = self.safe_dict(response, 'data', {})
1347
+ return self.parse_ticker(dataDict, market)
1339
1348
 
1340
1349
  def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
1341
1350
  """
@@ -1359,7 +1368,7 @@ class bingx(Exchange, ImplicitAPI):
1359
1368
  response = self.spotV1PublicGetTicker24hr(params)
1360
1369
  else:
1361
1370
  response = self.swapV2PublicGetQuoteTicker(params)
1362
- tickers = self.safe_value(response, 'data')
1371
+ tickers = self.safe_list(response, 'data')
1363
1372
  return self.parse_tickers(tickers, symbols)
1364
1373
 
1365
1374
  def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
@@ -1604,19 +1613,27 @@ class bingx(Exchange, ImplicitAPI):
1604
1613
 
1605
1614
  def parse_position(self, position, market: Market = None):
1606
1615
  #
1607
- # {
1608
- # "symbol": "BTC-USDT",
1609
- # "positionId": "12345678",
1610
- # "positionSide": "LONG",
1611
- # "isolated": True,
1612
- # "positionAmt": "123.33",
1613
- # "availableAmt": "128.99",
1614
- # "unrealizedProfit": "1.22",
1615
- # "realisedProfit": "8.1",
1616
- # "initialMargin": "123.33",
1617
- # "avgPrice": "2.2",
1618
- # "leverage": 10,
1619
- # }
1616
+ # {
1617
+ # "positionId":"1773122376147623936",
1618
+ # "symbol":"XRP-USDT",
1619
+ # "currency":"USDT",
1620
+ # "positionAmt":"3",
1621
+ # "availableAmt":"3",
1622
+ # "positionSide":"LONG",
1623
+ # "isolated":false,
1624
+ # "avgPrice":"0.6139",
1625
+ # "initialMargin":"0.0897",
1626
+ # "leverage":20,
1627
+ # "unrealizedProfit":"-0.0023",
1628
+ # "realisedProfit":"-0.0009",
1629
+ # "liquidationPrice":0,
1630
+ # "pnlRatio":"-0.0260",
1631
+ # "maxMarginReduction":"",
1632
+ # "riskRate":"",
1633
+ # "markPrice":"",
1634
+ # "positionValue":"",
1635
+ # "onlyOnePosition":false
1636
+ # }
1620
1637
  #
1621
1638
  # standard position
1622
1639
  #
@@ -1642,7 +1659,7 @@ class bingx(Exchange, ImplicitAPI):
1642
1659
  'info': position,
1643
1660
  'id': self.safe_string(position, 'positionId'),
1644
1661
  'symbol': self.safe_symbol(marketId, market, '-', 'swap'),
1645
- 'notional': self.safe_number(position, 'positionAmt'),
1662
+ 'notional': self.safe_number(position, 'positionValue'),
1646
1663
  'marginMode': marginMode,
1647
1664
  'liquidationPrice': None,
1648
1665
  'entryPrice': self.safe_number_2(position, 'avgPrice', 'entryPrice'),
@@ -1660,7 +1677,7 @@ class bingx(Exchange, ImplicitAPI):
1660
1677
  'lastUpdateTimestamp': None,
1661
1678
  'maintenanceMargin': None,
1662
1679
  'maintenanceMarginPercentage': None,
1663
- 'collateral': self.safe_number(position, 'positionAmt'),
1680
+ 'collateral': None,
1664
1681
  'initialMargin': self.safe_number(position, 'initialMargin'),
1665
1682
  'initialMarginPercentage': None,
1666
1683
  'leverage': self.safe_number(position, 'leverage'),
@@ -1938,7 +1955,7 @@ class bingx(Exchange, ImplicitAPI):
1938
1955
  response = self.fix_stringified_json_members(response)
1939
1956
  response = self.parse_json(response)
1940
1957
  data = self.safe_value(response, 'data', {})
1941
- order = self.safe_value(data, 'order', data)
1958
+ order = self.safe_dict(data, 'order', data)
1942
1959
  return self.parse_order(order, market)
1943
1960
 
1944
1961
  def create_orders(self, orders: List[OrderRequest], params={}):
@@ -2407,7 +2424,7 @@ class bingx(Exchange, ImplicitAPI):
2407
2424
  # }
2408
2425
  #
2409
2426
  data = self.safe_value(response, 'data')
2410
- first = self.safe_value(data, 'order', data)
2427
+ first = self.safe_dict(data, 'order', data)
2411
2428
  return self.parse_order(first, market)
2412
2429
 
2413
2430
  def cancel_all_orders(self, symbol: Str = None, params={}):
@@ -2632,7 +2649,7 @@ class bingx(Exchange, ImplicitAPI):
2632
2649
  # }
2633
2650
  #
2634
2651
  data = self.safe_value(response, 'data')
2635
- first = self.safe_value(data, 'order', data)
2652
+ first = self.safe_dict(data, 'order', data)
2636
2653
  return self.parse_order(first, market)
2637
2654
 
2638
2655
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -2804,7 +2821,7 @@ class bingx(Exchange, ImplicitAPI):
2804
2821
  # }
2805
2822
  #
2806
2823
  data = self.safe_value(response, 'data', [])
2807
- orders = self.safe_value(data, 'orders', [])
2824
+ orders = self.safe_list(data, 'orders', [])
2808
2825
  return self.parse_orders(orders, market, since, limit)
2809
2826
 
2810
2827
  def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
@@ -3492,7 +3509,7 @@ class bingx(Exchange, ImplicitAPI):
3492
3509
  """
3493
3510
  self.load_markets()
3494
3511
  response = self.walletsV1PrivateGetCapitalConfigGetall(params)
3495
- coins = self.safe_value(response, 'data')
3512
+ coins = self.safe_list(response, 'data')
3496
3513
  return self.parse_deposit_withdraw_fees(coins, codes, 'coin')
3497
3514
 
3498
3515
  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
@@ -146,21 +146,23 @@ class bitbank(Exchange, ImplicitAPI):
146
146
  },
147
147
  'precisionMode': TICK_SIZE,
148
148
  'exceptions': {
149
- '20001': AuthenticationError,
150
- '20002': AuthenticationError,
151
- '20003': AuthenticationError,
152
- '20005': AuthenticationError,
153
- '20004': InvalidNonce,
154
- '40020': InvalidOrder,
155
- '40021': InvalidOrder,
156
- '40025': ExchangeError,
157
- '40013': OrderNotFound,
158
- '40014': OrderNotFound,
159
- '50008': PermissionDenied,
160
- '50009': OrderNotFound,
161
- '50010': OrderNotFound,
162
- '60001': InsufficientFunds,
163
- '60005': InvalidOrder,
149
+ 'exact': {
150
+ '20001': AuthenticationError,
151
+ '20002': AuthenticationError,
152
+ '20003': AuthenticationError,
153
+ '20005': AuthenticationError,
154
+ '20004': InvalidNonce,
155
+ '40020': InvalidOrder,
156
+ '40021': InvalidOrder,
157
+ '40025': ExchangeError,
158
+ '40013': OrderNotFound,
159
+ '40014': OrderNotFound,
160
+ '50008': PermissionDenied,
161
+ '50009': OrderNotFound,
162
+ '50010': OrderNotFound,
163
+ '60001': InsufficientFunds,
164
+ '60005': InvalidOrder,
165
+ },
164
166
  },
165
167
  })
166
168
 
@@ -302,7 +304,7 @@ class bitbank(Exchange, ImplicitAPI):
302
304
  'pair': market['id'],
303
305
  }
304
306
  response = self.publicGetPairTicker(self.extend(request, params))
305
- data = self.safe_value(response, 'data', {})
307
+ data = self.safe_dict(response, 'data', {})
306
308
  return self.parse_ticker(data, market)
307
309
 
308
310
  def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
@@ -385,7 +387,7 @@ class bitbank(Exchange, ImplicitAPI):
385
387
  }
386
388
  response = self.publicGetPairTransactions(self.extend(request, params))
387
389
  data = self.safe_value(response, 'data', {})
388
- trades = self.safe_value(data, 'transactions', [])
390
+ trades = self.safe_list(data, 'transactions', [])
389
391
  return self.parse_trades(trades, market, since, limit)
390
392
 
391
393
  def fetch_trading_fees(self, params={}):
@@ -508,7 +510,7 @@ class bitbank(Exchange, ImplicitAPI):
508
510
  data = self.safe_value(response, 'data', {})
509
511
  candlestick = self.safe_value(data, 'candlestick', [])
510
512
  first = self.safe_value(candlestick, 0, {})
511
- ohlcv = self.safe_value(first, 'ohlcv', [])
513
+ ohlcv = self.safe_list(first, 'ohlcv', [])
512
514
  return self.parse_ohlcvs(ohlcv, market, timeframe, since, limit)
513
515
 
514
516
  def parse_balance(self, response) -> Balances:
@@ -645,7 +647,7 @@ class bitbank(Exchange, ImplicitAPI):
645
647
  if type == 'limit':
646
648
  request['price'] = self.price_to_precision(symbol, price)
647
649
  response = self.privatePostUserSpotOrder(self.extend(request, params))
648
- data = self.safe_value(response, 'data')
650
+ data = self.safe_dict(response, 'data')
649
651
  return self.parse_order(data, market)
650
652
 
651
653
  def cancel_order(self, id: str, symbol: Str = None, params={}):
@@ -682,7 +684,7 @@ class bitbank(Exchange, ImplicitAPI):
682
684
  'pair': market['id'],
683
685
  }
684
686
  response = self.privateGetUserSpotOrder(self.extend(request, params))
685
- data = self.safe_value(response, 'data')
687
+ data = self.safe_dict(response, 'data')
686
688
  return self.parse_order(data, market)
687
689
 
688
690
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -706,7 +708,7 @@ class bitbank(Exchange, ImplicitAPI):
706
708
  request['since'] = self.parse_to_int(since / 1000)
707
709
  response = self.privateGetUserSpotActiveOrders(self.extend(request, params))
708
710
  data = self.safe_value(response, 'data', {})
709
- orders = self.safe_value(data, 'orders', [])
711
+ orders = self.safe_list(data, 'orders', [])
710
712
  return self.parse_orders(orders, market, since, limit)
711
713
 
712
714
  def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -731,7 +733,7 @@ class bitbank(Exchange, ImplicitAPI):
731
733
  request['since'] = self.parse_to_int(since / 1000)
732
734
  response = self.privateGetUserSpotTradeHistory(self.extend(request, params))
733
735
  data = self.safe_value(response, 'data', {})
734
- trades = self.safe_value(data, 'trades', [])
736
+ trades = self.safe_list(data, 'trades', [])
735
737
  return self.parse_trades(trades, market, since, limit)
736
738
 
737
739
  def fetch_deposit_address(self, code: str, params={}):
@@ -799,7 +801,7 @@ class bitbank(Exchange, ImplicitAPI):
799
801
  # }
800
802
  # }
801
803
  #
802
- data = self.safe_value(response, 'data', {})
804
+ data = self.safe_dict(response, 'data', {})
803
805
  return self.parse_transaction(data, currency)
804
806
 
805
807
  def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
@@ -944,12 +946,8 @@ class bitbank(Exchange, ImplicitAPI):
944
946
  '70009': 'We are currently temporarily restricting orders to be carried out. Please use the limit order.',
945
947
  '70010': 'We are temporarily raising the minimum order quantity system load is now rising.',
946
948
  }
947
- errorClasses = self.exceptions
948
949
  code = self.safe_string(data, 'code')
949
950
  message = self.safe_string(errorMessages, code, 'Error')
950
- ErrorClass = self.safe_value(errorClasses, code)
951
- if ErrorClass is not None:
952
- raise errorClasses[code](message)
953
- else:
954
- raise ExchangeError(self.id + ' ' + self.json(response))
951
+ self.throw_exactly_matched_exception(self.exceptions['exact'], code, message)
952
+ raise ExchangeError(self.id + ' ' + self.json(response))
955
953
  return None
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={}):
ccxt/bitget.py CHANGED
@@ -2148,7 +2148,7 @@ class bitget(Exchange, ImplicitAPI):
2148
2148
  # ]
2149
2149
  # }
2150
2150
  #
2151
- rawTransactions = self.safe_value(response, 'data', [])
2151
+ rawTransactions = self.safe_list(response, 'data', [])
2152
2152
  return self.parse_transactions(rawTransactions, currency, since, limit)
2153
2153
 
2154
2154
  def withdraw(self, code: str, amount: float, address, tag=None, params={}):
@@ -2285,7 +2285,7 @@ class bitget(Exchange, ImplicitAPI):
2285
2285
  # ]
2286
2286
  # }
2287
2287
  #
2288
- rawTransactions = self.safe_value(response, 'data', [])
2288
+ rawTransactions = self.safe_list(response, 'data', [])
2289
2289
  return self.parse_transactions(rawTransactions, currency, since, limit)
2290
2290
 
2291
2291
  def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
@@ -2408,7 +2408,7 @@ class bitget(Exchange, ImplicitAPI):
2408
2408
  # }
2409
2409
  # }
2410
2410
  #
2411
- data = self.safe_value(response, 'data', {})
2411
+ data = self.safe_dict(response, 'data', {})
2412
2412
  return self.parse_deposit_address(data, currency)
2413
2413
 
2414
2414
  def parse_deposit_address(self, depositAddress, currency: Currency = None):
@@ -2681,7 +2681,7 @@ class bitget(Exchange, ImplicitAPI):
2681
2681
  # ]
2682
2682
  # }
2683
2683
  #
2684
- data = self.safe_value(response, 'data', [])
2684
+ data = self.safe_list(response, 'data', [])
2685
2685
  return self.parse_ticker(data[0], market)
2686
2686
 
2687
2687
  def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
@@ -2778,7 +2778,7 @@ class bitget(Exchange, ImplicitAPI):
2778
2778
  # ]
2779
2779
  # }
2780
2780
  #
2781
- data = self.safe_value(response, 'data', [])
2781
+ data = self.safe_list(response, 'data', [])
2782
2782
  return self.parse_tickers(data, symbols)
2783
2783
 
2784
2784
  def parse_trade(self, trade, market: Market = None) -> Trade:
@@ -2999,7 +2999,7 @@ class bitget(Exchange, ImplicitAPI):
2999
2999
  # ]
3000
3000
  # }
3001
3001
  #
3002
- data = self.safe_value(response, 'data', [])
3002
+ data = self.safe_list(response, 'data', [])
3003
3003
  return self.parse_trades(data, market, since, limit)
3004
3004
 
3005
3005
  def fetch_trading_fee(self, symbol: str, params={}):
@@ -4007,7 +4007,7 @@ class bitget(Exchange, ImplicitAPI):
4007
4007
  # }
4008
4008
  # }
4009
4009
  #
4010
- data = self.safe_value(response, 'data', {})
4010
+ data = self.safe_dict(response, 'data', {})
4011
4011
  return self.parse_order(data, market)
4012
4012
 
4013
4013
  def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
@@ -4424,7 +4424,7 @@ class bitget(Exchange, ImplicitAPI):
4424
4424
  # }
4425
4425
  # }
4426
4426
  #
4427
- data = self.safe_value(response, 'data', {})
4427
+ data = self.safe_dict(response, 'data', {})
4428
4428
  return self.parse_order(data, market)
4429
4429
 
4430
4430
  def cancel_order(self, id: str, symbol: Str = None, params={}):
@@ -4625,7 +4625,7 @@ class bitget(Exchange, ImplicitAPI):
4625
4625
  # }
4626
4626
  #
4627
4627
  data = self.safe_value(response, 'data', {})
4628
- orders = self.safe_value(data, 'successList', [])
4628
+ orders = self.safe_list(data, 'successList', [])
4629
4629
  return self.parse_orders(orders, market)
4630
4630
 
4631
4631
  def cancel_all_orders(self, symbol: Str = None, params={}):
@@ -4832,9 +4832,14 @@ class bitget(Exchange, ImplicitAPI):
4832
4832
  #
4833
4833
  if isinstance(response, str):
4834
4834
  response = json.loads(response)
4835
- data = self.safe_value(response, 'data')
4836
- first = self.safe_value(data, 0, data)
4835
+ data = self.safe_dict(response, 'data')
4836
+ if (data is not None) and not isinstance(data, list):
4837
+ return self.parse_order(data, market)
4838
+ dataList = self.safe_list(response, 'data', [])
4839
+ first = self.safe_dict(dataList, 0, {})
4837
4840
  return self.parse_order(first, market)
4841
+ # first = self.safe_dict(data, 0, data)
4842
+ # return self.parse_order(first, market)
4838
4843
 
4839
4844
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
4840
4845
  """
@@ -5111,10 +5116,10 @@ class bitget(Exchange, ImplicitAPI):
5111
5116
  data = self.safe_value(response, 'data')
5112
5117
  if type == 'spot':
5113
5118
  if (marginMode is not None) or stop:
5114
- resultList = self.safe_value(data, 'orderList', [])
5119
+ resultList = self.safe_list(data, 'orderList', [])
5115
5120
  return self.parse_orders(resultList, market, since, limit)
5116
5121
  else:
5117
- result = self.safe_value(data, 'entrustedList', [])
5122
+ result = self.safe_list(data, 'entrustedList', [])
5118
5123
  return self.parse_orders(result, market, since, limit)
5119
5124
  return self.parse_orders(data, market, since, limit)
5120
5125
 
@@ -5444,7 +5449,7 @@ class bitget(Exchange, ImplicitAPI):
5444
5449
  return self.parse_orders(self.safe_value(data, 'entrustedList', []), market, since, limit)
5445
5450
  if isinstance(response, str):
5446
5451
  response = json.loads(response)
5447
- orders = self.safe_value(response, 'data', [])
5452
+ orders = self.safe_list(response, 'data', [])
5448
5453
  return self.parse_orders(orders, market, since, limit)
5449
5454
 
5450
5455
  def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -5815,10 +5820,10 @@ class bitget(Exchange, ImplicitAPI):
5815
5820
  #
5816
5821
  data = self.safe_value(response, 'data')
5817
5822
  if (market['swap']) or (market['future']):
5818
- fillList = self.safe_value(data, 'fillList', [])
5823
+ fillList = self.safe_list(data, 'fillList', [])
5819
5824
  return self.parse_trades(fillList, market, since, limit)
5820
5825
  elif marginMode is not None:
5821
- fills = self.safe_value(data, 'fills', [])
5826
+ fills = self.safe_list(data, 'fills', [])
5822
5827
  return self.parse_trades(fills, market, since, limit)
5823
5828
  return self.parse_trades(data, market, since, limit)
5824
5829
 
@@ -5876,8 +5881,8 @@ class bitget(Exchange, ImplicitAPI):
5876
5881
  # ]
5877
5882
  # }
5878
5883
  #
5879
- data = self.safe_value(response, 'data', [])
5880
- first = self.safe_value(data, 0, {})
5884
+ data = self.safe_list(response, 'data', [])
5885
+ first = self.safe_dict(data, 0, {})
5881
5886
  return self.parse_position(first, market)
5882
5887
 
5883
5888
  def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
@@ -6738,7 +6743,7 @@ class bitget(Exchange, ImplicitAPI):
6738
6743
  # }
6739
6744
  # }
6740
6745
  #
6741
- data = self.safe_value(response, 'data', {})
6746
+ data = self.safe_dict(response, 'data', {})
6742
6747
  return self.parse_open_interest(data, market)
6743
6748
 
6744
6749
  def parse_open_interest(self, interest, market: Market = None):
@@ -6817,7 +6822,7 @@ class bitget(Exchange, ImplicitAPI):
6817
6822
  # ]
6818
6823
  # }
6819
6824
  #
6820
- data = self.safe_value(response, 'data', [])
6825
+ data = self.safe_list(response, 'data', [])
6821
6826
  return self.parse_transfers(data, currency, since, limit)
6822
6827
 
6823
6828
  def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
@@ -7007,7 +7012,7 @@ class bitget(Exchange, ImplicitAPI):
7007
7012
  # "requestTime": "1700120731773"
7008
7013
  # }
7009
7014
  #
7010
- data = self.safe_value(response, 'data', [])
7015
+ data = self.safe_list(response, 'data', [])
7011
7016
  return self.parse_deposit_withdraw_fees(data, codes, 'coin')
7012
7017
 
7013
7018
  def borrow_cross_margin(self, code: str, amount: float, params={}):
@@ -7294,7 +7299,7 @@ class bitget(Exchange, ImplicitAPI):
7294
7299
  # }
7295
7300
  #
7296
7301
  data = self.safe_value(response, 'data', {})
7297
- liquidations = self.safe_value(data, 'resultList', [])
7302
+ liquidations = self.safe_list(data, 'resultList', [])
7298
7303
  return self.parse_liquidations(liquidations, market, since, limit)
7299
7304
 
7300
7305
  def parse_liquidation(self, liquidation, market: Market = None):
@@ -7722,7 +7727,7 @@ class bitget(Exchange, ImplicitAPI):
7722
7727
  # }
7723
7728
  #
7724
7729
  data = self.safe_value(response, 'data', {})
7725
- order = self.safe_value(data, 'successList', [])
7730
+ order = self.safe_list(data, 'successList', [])
7726
7731
  return self.parse_order(order[0], market)
7727
7732
 
7728
7733
  def close_all_positions(self, params={}) -> List[Position]:
@@ -7758,7 +7763,7 @@ class bitget(Exchange, ImplicitAPI):
7758
7763
  # }
7759
7764
  #
7760
7765
  data = self.safe_value(response, 'data', {})
7761
- orderInfo = self.safe_value(data, 'successList', [])
7766
+ orderInfo = self.safe_list(data, 'successList', [])
7762
7767
  return self.parse_positions(orderInfo, None, params)
7763
7768
 
7764
7769
  def fetch_margin_mode(self, symbol: str, params={}) -> MarginMode:
ccxt/bithumb.py CHANGED
@@ -487,7 +487,7 @@ class bithumb(Exchange, ImplicitAPI):
487
487
  # }
488
488
  # }
489
489
  #
490
- data = self.safe_value(response, 'data', {})
490
+ data = self.safe_dict(response, 'data', {})
491
491
  return self.parse_ticker(data, market)
492
492
 
493
493
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -552,7 +552,7 @@ class bithumb(Exchange, ImplicitAPI):
552
552
  # }
553
553
  # }
554
554
  #
555
- data = self.safe_value(response, 'data', [])
555
+ data = self.safe_list(response, 'data', [])
556
556
  return self.parse_ohlcvs(data, market, timeframe, since, limit)
557
557
 
558
558
  def parse_trade(self, trade, market: Market = None) -> Trade:
@@ -660,7 +660,7 @@ class bithumb(Exchange, ImplicitAPI):
660
660
  # ]
661
661
  # }
662
662
  #
663
- data = self.safe_value(response, 'data', [])
663
+ data = self.safe_list(response, 'data', [])
664
664
  return self.parse_trades(data, market, since, limit)
665
665
 
666
666
  def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
@@ -748,7 +748,7 @@ class bithumb(Exchange, ImplicitAPI):
748
748
  # }
749
749
  # }
750
750
  #
751
- data = self.safe_value(response, 'data')
751
+ data = self.safe_dict(response, 'data')
752
752
  return self.parse_order(self.extend(data, {'order_id': id}), market)
753
753
 
754
754
  def parse_order_status(self, status):
@@ -893,7 +893,7 @@ class bithumb(Exchange, ImplicitAPI):
893
893
  # ]
894
894
  # }
895
895
  #
896
- data = self.safe_value(response, 'data', [])
896
+ data = self.safe_list(response, 'data', [])
897
897
  return self.parse_orders(data, market, since, limit)
898
898
 
899
899
  def cancel_order(self, id: str, symbol: Str = None, params={}):