ccxt 4.4.40__py2.py3-none-any.whl → 4.4.42__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 (173) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/binance.py +3 -0
  3. ccxt/abstract/binancecoinm.py +3 -0
  4. ccxt/abstract/binanceus.py +3 -0
  5. ccxt/abstract/binanceusdm.py +3 -0
  6. ccxt/abstract/bitmart.py +2 -0
  7. ccxt/abstract/okx.py +5 -0
  8. ccxt/ace.py +1 -1
  9. ccxt/alpaca.py +0 -1
  10. ccxt/ascendex.py +0 -1
  11. ccxt/async_support/__init__.py +1 -1
  12. ccxt/async_support/ace.py +1 -1
  13. ccxt/async_support/alpaca.py +0 -1
  14. ccxt/async_support/ascendex.py +0 -1
  15. ccxt/async_support/base/exchange.py +24 -17
  16. ccxt/async_support/bigone.py +0 -1
  17. ccxt/async_support/binance.py +27 -24
  18. ccxt/async_support/bingx.py +5 -1
  19. ccxt/async_support/bitfinex.py +123 -1
  20. ccxt/async_support/bitget.py +1 -0
  21. ccxt/async_support/bitmart.py +243 -2
  22. ccxt/async_support/blofin.py +16 -7
  23. ccxt/async_support/bybit.py +8 -8
  24. ccxt/async_support/cex.py +1 -1
  25. ccxt/async_support/coinbase.py +8 -9
  26. ccxt/async_support/coinbaseexchange.py +5 -6
  27. ccxt/async_support/coinbaseinternational.py +7 -8
  28. ccxt/async_support/coincatch.py +0 -1
  29. ccxt/async_support/coincheck.py +0 -1
  30. ccxt/async_support/coinex.py +91 -6
  31. ccxt/async_support/coinlist.py +3 -4
  32. ccxt/async_support/coinmate.py +1 -3
  33. ccxt/async_support/coinmetro.py +4 -5
  34. ccxt/async_support/coinone.py +0 -1
  35. ccxt/async_support/coinsph.py +7 -8
  36. ccxt/async_support/cryptocom.py +3 -0
  37. ccxt/async_support/currencycom.py +3 -4
  38. ccxt/async_support/defx.py +6 -7
  39. ccxt/async_support/deribit.py +1 -3
  40. ccxt/async_support/digifinex.py +0 -1
  41. ccxt/async_support/ellipx.py +0 -2
  42. ccxt/async_support/exmo.py +61 -6
  43. ccxt/async_support/gate.py +2 -3
  44. ccxt/async_support/gemini.py +4 -5
  45. ccxt/async_support/hashkey.py +79 -67
  46. ccxt/async_support/hitbtc.py +47 -5
  47. ccxt/async_support/hollaex.py +4 -6
  48. ccxt/async_support/htx.py +2 -4
  49. ccxt/async_support/huobijp.py +0 -1
  50. ccxt/async_support/hyperliquid.py +60 -1
  51. ccxt/async_support/idex.py +8 -8
  52. ccxt/async_support/independentreserve.py +0 -1
  53. ccxt/async_support/indodax.py +0 -1
  54. ccxt/async_support/kraken.py +186 -28
  55. ccxt/async_support/krakenfutures.py +75 -3
  56. ccxt/async_support/kucoin.py +6 -4
  57. ccxt/async_support/kucoinfutures.py +10 -9
  58. ccxt/async_support/kuna.py +1 -3
  59. ccxt/async_support/latoken.py +1 -3
  60. ccxt/async_support/lbank.py +0 -1
  61. ccxt/async_support/luno.py +0 -1
  62. ccxt/async_support/lykke.py +0 -1
  63. ccxt/async_support/mercado.py +0 -1
  64. ccxt/async_support/mexc.py +6 -7
  65. ccxt/async_support/ndax.py +1 -1
  66. ccxt/async_support/novadax.py +4 -6
  67. ccxt/async_support/oceanex.py +0 -1
  68. ccxt/async_support/okcoin.py +1 -3
  69. ccxt/async_support/okx.py +7 -4
  70. ccxt/async_support/onetrading.py +1 -3
  71. ccxt/async_support/p2b.py +1 -1
  72. ccxt/async_support/paradex.py +5 -7
  73. ccxt/async_support/phemex.py +8 -10
  74. ccxt/async_support/poloniex.py +1 -3
  75. ccxt/async_support/poloniexfutures.py +6 -6
  76. ccxt/async_support/probit.py +0 -1
  77. ccxt/async_support/timex.py +0 -1
  78. ccxt/async_support/tokocrypto.py +11 -14
  79. ccxt/async_support/tradeogre.py +1 -1
  80. ccxt/async_support/upbit.py +0 -1
  81. ccxt/async_support/wavesexchange.py +4 -5
  82. ccxt/async_support/whitebit.py +8 -9
  83. ccxt/async_support/woo.py +98 -12
  84. ccxt/async_support/woofipro.py +96 -15
  85. ccxt/async_support/xt.py +6 -3
  86. ccxt/async_support/yobit.py +0 -1
  87. ccxt/async_support/zaif.py +0 -1
  88. ccxt/async_support/zonda.py +1 -2
  89. ccxt/base/exchange.py +39 -20
  90. ccxt/base/types.py +10 -0
  91. ccxt/bigone.py +0 -1
  92. ccxt/binance.py +27 -24
  93. ccxt/bingx.py +5 -1
  94. ccxt/bitfinex.py +123 -1
  95. ccxt/bitget.py +1 -0
  96. ccxt/bitmart.py +243 -2
  97. ccxt/blofin.py +16 -7
  98. ccxt/bybit.py +8 -8
  99. ccxt/cex.py +1 -1
  100. ccxt/coinbase.py +8 -9
  101. ccxt/coinbaseexchange.py +5 -6
  102. ccxt/coinbaseinternational.py +7 -8
  103. ccxt/coincatch.py +0 -1
  104. ccxt/coincheck.py +0 -1
  105. ccxt/coinex.py +91 -6
  106. ccxt/coinlist.py +3 -4
  107. ccxt/coinmate.py +1 -3
  108. ccxt/coinmetro.py +4 -5
  109. ccxt/coinone.py +0 -1
  110. ccxt/coinsph.py +7 -8
  111. ccxt/cryptocom.py +3 -0
  112. ccxt/currencycom.py +3 -4
  113. ccxt/defx.py +6 -7
  114. ccxt/deribit.py +1 -3
  115. ccxt/digifinex.py +0 -1
  116. ccxt/ellipx.py +0 -2
  117. ccxt/exmo.py +61 -6
  118. ccxt/gate.py +2 -3
  119. ccxt/gemini.py +4 -5
  120. ccxt/hashkey.py +79 -67
  121. ccxt/hitbtc.py +47 -5
  122. ccxt/hollaex.py +4 -6
  123. ccxt/htx.py +2 -4
  124. ccxt/huobijp.py +0 -1
  125. ccxt/hyperliquid.py +60 -1
  126. ccxt/idex.py +8 -8
  127. ccxt/independentreserve.py +0 -1
  128. ccxt/indodax.py +0 -1
  129. ccxt/kraken.py +186 -28
  130. ccxt/krakenfutures.py +75 -3
  131. ccxt/kucoin.py +6 -4
  132. ccxt/kucoinfutures.py +10 -9
  133. ccxt/kuna.py +1 -3
  134. ccxt/latoken.py +1 -3
  135. ccxt/lbank.py +0 -1
  136. ccxt/luno.py +0 -1
  137. ccxt/lykke.py +0 -1
  138. ccxt/mercado.py +0 -1
  139. ccxt/mexc.py +6 -7
  140. ccxt/ndax.py +1 -1
  141. ccxt/novadax.py +4 -6
  142. ccxt/oceanex.py +0 -1
  143. ccxt/okcoin.py +1 -3
  144. ccxt/okx.py +7 -4
  145. ccxt/onetrading.py +1 -3
  146. ccxt/p2b.py +1 -1
  147. ccxt/paradex.py +5 -7
  148. ccxt/phemex.py +8 -10
  149. ccxt/poloniex.py +1 -3
  150. ccxt/poloniexfutures.py +6 -6
  151. ccxt/pro/__init__.py +1 -1
  152. ccxt/probit.py +0 -1
  153. ccxt/timex.py +0 -1
  154. ccxt/tokocrypto.py +11 -14
  155. ccxt/tradeogre.py +1 -1
  156. ccxt/upbit.py +0 -1
  157. ccxt/wavesexchange.py +4 -5
  158. ccxt/whitebit.py +8 -9
  159. ccxt/woo.py +98 -12
  160. ccxt/woofipro.py +96 -15
  161. ccxt/xt.py +6 -3
  162. ccxt/yobit.py +0 -1
  163. ccxt/zaif.py +0 -1
  164. ccxt/zonda.py +1 -2
  165. {ccxt-4.4.40.dist-info → ccxt-4.4.42.dist-info}/METADATA +5 -5
  166. {ccxt-4.4.40.dist-info → ccxt-4.4.42.dist-info}/RECORD +169 -173
  167. ccxt/bitbay.py +0 -17
  168. ccxt/bitfinex2.py +0 -3624
  169. ccxt/hitbtc3.py +0 -16
  170. ccxt/pro/bitfinex2.py +0 -1086
  171. {ccxt-4.4.40.dist-info → ccxt-4.4.42.dist-info}/LICENSE.txt +0 -0
  172. {ccxt-4.4.40.dist-info → ccxt-4.4.42.dist-info}/WHEEL +0 -0
  173. {ccxt-4.4.40.dist-info → ccxt-4.4.42.dist-info}/top_level.txt +0 -0
ccxt/deribit.py CHANGED
@@ -1767,7 +1767,6 @@ class deribit(Exchange, ImplicitAPI):
1767
1767
  # injected in createOrder
1768
1768
  trades = self.safe_value(order, 'trades')
1769
1769
  timeInForce = self.parse_time_in_force(self.safe_string(order, 'time_in_force'))
1770
- stopPrice = self.safe_value(order, 'stop_price')
1771
1770
  postOnly = self.safe_value(order, 'post_only')
1772
1771
  return self.safe_order({
1773
1772
  'info': order,
@@ -1782,8 +1781,7 @@ class deribit(Exchange, ImplicitAPI):
1782
1781
  'postOnly': postOnly,
1783
1782
  'side': side,
1784
1783
  'price': priceString,
1785
- 'stopPrice': stopPrice,
1786
- 'triggerPrice': stopPrice,
1784
+ 'triggerPrice': self.safe_value(order, 'stop_price'),
1787
1785
  'amount': amount,
1788
1786
  'cost': cost,
1789
1787
  'average': averageString,
ccxt/digifinex.py CHANGED
@@ -2024,7 +2024,6 @@ class digifinex(Exchange, ImplicitAPI):
2024
2024
  'postOnly': None,
2025
2025
  'side': side,
2026
2026
  'price': self.safe_number(order, 'price'),
2027
- 'stopPrice': None,
2028
2027
  'triggerPrice': None,
2029
2028
  'amount': self.safe_number_2(order, 'amount', 'size'),
2030
2029
  'filled': self.safe_number_2(order, 'executed_amount', 'filled_qty'),
ccxt/ellipx.py CHANGED
@@ -1264,7 +1264,6 @@ class ellipx(Exchange, ImplicitAPI):
1264
1264
  'postOnly': postOnly,
1265
1265
  'side': side,
1266
1266
  'price': price,
1267
- 'stopPrice': None,
1268
1267
  'triggerPrice': None,
1269
1268
  'average': None,
1270
1269
  'cost': cost,
@@ -1323,7 +1322,6 @@ class ellipx(Exchange, ImplicitAPI):
1323
1322
  'postOnly': None,
1324
1323
  'side': None,
1325
1324
  'price': None,
1326
- 'stopPrice': None,
1327
1325
  'triggerPrice': None,
1328
1326
  'average': None,
1329
1327
  'cost': None,
ccxt/exmo.py CHANGED
@@ -43,6 +43,9 @@ class exmo(Exchange, ImplicitAPI):
43
43
  'cancelOrder': True,
44
44
  'cancelOrders': False,
45
45
  'createDepositAddress': False,
46
+ 'createMarketBuyOrder': True,
47
+ 'createMarketBuyOrderWithCost': True,
48
+ 'createMarketOrderWithCost': True,
46
49
  'createOrder': True,
47
50
  'createStopLimitOrder': True,
48
51
  'createStopMarketOrder': True,
@@ -1352,6 +1355,52 @@ class exmo(Exchange, ImplicitAPI):
1352
1355
  result = self.array_concat(result, trades)
1353
1356
  return self.filter_by_since_limit(result, since, limit)
1354
1357
 
1358
+ def create_market_order_with_cost(self, symbol: str, side: OrderSide, cost: float, params={}):
1359
+ """
1360
+ create a market order by providing the symbol, side and cost
1361
+
1362
+ https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd
1363
+
1364
+ :param str symbol: unified symbol of the market to create an order in
1365
+ :param str side: 'buy' or 'sell'
1366
+ :param float cost: how much you want to trade in units of the quote currency
1367
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1368
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1369
+ """
1370
+ self.load_markets()
1371
+ params = self.extend(params, {'cost': cost})
1372
+ return self.create_order(symbol, 'market', side, cost, None, params)
1373
+
1374
+ def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
1375
+ """
1376
+ create a market buy order by providing the symbol and cost
1377
+
1378
+ https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd
1379
+
1380
+ :param str symbol: unified symbol of the market to create an order in
1381
+ :param float cost: how much you want to trade in units of the quote currency
1382
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1383
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1384
+ """
1385
+ self.load_markets()
1386
+ params = self.extend(params, {'cost': cost})
1387
+ return self.create_order(symbol, 'market', 'buy', cost, None, params)
1388
+
1389
+ def create_market_sell_order_with_cost(self, symbol: str, cost: float, params={}):
1390
+ """
1391
+ create a market sell order by providing the symbol and cost
1392
+
1393
+ https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd
1394
+
1395
+ :param str symbol: unified symbol of the market to create an order in
1396
+ :param float cost: how much you want to trade in units of the quote currency
1397
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1398
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1399
+ """
1400
+ self.load_markets()
1401
+ params = self.extend(params, {'cost': cost})
1402
+ return self.create_order(symbol, 'market', 'sell', cost, None, params)
1403
+
1355
1404
  def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1356
1405
  """
1357
1406
  create a trade order
@@ -1366,9 +1415,10 @@ class exmo(Exchange, ImplicitAPI):
1366
1415
  :param float amount: how much of currency you want to trade in units of base currency
1367
1416
  :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1368
1417
  :param dict [params]: extra parameters specific to the exchange API endpoint
1369
- :param float [params.stopPrice]: the price at which a trigger order is triggered at
1418
+ :param float [params.triggerPrice]: the price at which a trigger order is triggered at
1370
1419
  :param str [params.timeInForce]: *spot only* 'fok', 'ioc' or 'post_only'
1371
1420
  :param boolean [params.postOnly]: *spot only* True for post only orders
1421
+ :param float [params.cost]: *spot only* *market orders only* the cost of the order in the quote currency for market orders
1372
1422
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1373
1423
  """
1374
1424
  self.load_markets()
@@ -1379,11 +1429,12 @@ class exmo(Exchange, ImplicitAPI):
1379
1429
  if marginMode == 'cross':
1380
1430
  raise BadRequest(self.id + ' only supports isolated margin')
1381
1431
  isSpot = (marginMode != 'isolated')
1382
- triggerPrice = self.safe_number_n(params, ['triggerPrice', 'stopPrice', 'stop_price'])
1432
+ triggerPrice = self.safe_string_n(params, ['triggerPrice', 'stopPrice', 'stop_price'])
1433
+ cost = self.safe_string(params, 'cost')
1383
1434
  request: dict = {
1384
1435
  'pair': market['id'],
1385
1436
  # 'leverage': 2,
1386
- 'quantity': self.amount_to_precision(market['symbol'], amount),
1437
+ # 'quantity': self.amount_to_precision(market['symbol'], amount),
1387
1438
  # spot - buy, sell, market_buy, market_sell, market_buy_total, market_sell_total
1388
1439
  # margin - limit_buy, limit_sell, market_buy, market_sell, stop_buy, stop_sell, stop_limit_buy, stop_limit_sell, trailing_stop_buy, trailing_stop_sell
1389
1440
  # 'stop_price': self.price_to_precision(symbol, stopPrice),
@@ -1392,6 +1443,10 @@ class exmo(Exchange, ImplicitAPI):
1392
1443
  # 'client_id': 123, # optional, must be a positive integer
1393
1444
  # 'comment': '', # up to 50 latin symbols, whitespaces, underscores
1394
1445
  }
1446
+ if cost is None:
1447
+ request['quantity'] = self.amount_to_precision(market['symbol'], amount)
1448
+ else:
1449
+ request['quantity'] = self.cost_to_precision(market['symbol'], cost)
1395
1450
  clientOrderId = self.safe_value_2(params, 'client_id', 'clientOrderId')
1396
1451
  if clientOrderId is not None:
1397
1452
  clientOrderId = self.safe_integer_2(params, 'client_id', 'clientOrderId')
@@ -1402,7 +1457,7 @@ class exmo(Exchange, ImplicitAPI):
1402
1457
  leverage = self.safe_number(params, 'leverage')
1403
1458
  if not isSpot and (leverage is None):
1404
1459
  raise ArgumentsRequired(self.id + ' createOrder requires an extra param params["leverage"] for margin orders')
1405
- params = self.omit(params, ['stopPrice', 'stop_price', 'triggerPrice', 'timeInForce', 'client_id', 'clientOrderId'])
1460
+ params = self.omit(params, ['stopPrice', 'stop_price', 'triggerPrice', 'timeInForce', 'client_id', 'clientOrderId', 'cost'])
1406
1461
  if price is not None:
1407
1462
  request['price'] = self.price_to_precision(market['symbol'], price)
1408
1463
  response = None
@@ -1423,7 +1478,8 @@ class exmo(Exchange, ImplicitAPI):
1423
1478
  if type == 'limit':
1424
1479
  request['type'] = side
1425
1480
  elif type == 'market':
1426
- request['type'] = 'market_' + side
1481
+ marketSuffix = '_total' if (cost is not None) else ''
1482
+ request['type'] = 'market_' + side + marketSuffix
1427
1483
  if isPostOnly:
1428
1484
  request['exec_type'] = 'post_only'
1429
1485
  elif timeInForce is not None:
@@ -1848,7 +1904,6 @@ class exmo(Exchange, ImplicitAPI):
1848
1904
  'postOnly': None,
1849
1905
  'side': side,
1850
1906
  'price': price,
1851
- 'stopPrice': triggerPrice,
1852
1907
  'triggerPrice': triggerPrice,
1853
1908
  'cost': cost,
1854
1909
  'amount': amount,
ccxt/gate.py CHANGED
@@ -3915,7 +3915,7 @@ class gate(Exchange, ImplicitAPI):
3915
3915
  :param float amount: the amount of currency to trade
3916
3916
  :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
3917
3917
  :param dict [params]: extra parameters specific to the exchange API endpoint
3918
- :param float [params.stopPrice]: The price at which a trigger order is triggered at
3918
+ :param float [params.triggerPrice]: The price at which a trigger order is triggered at
3919
3919
  :param str [params.timeInForce]: "GTC", "IOC", or "PO"
3920
3920
  :param float [params.stopLossPrice]: The price at which a stop loss order is triggered at
3921
3921
  :param float [params.takeProfitPrice]: The price at which a take profit order is triggered at
@@ -4663,7 +4663,6 @@ class gate(Exchange, ImplicitAPI):
4663
4663
  'reduceOnly': self.safe_value(order, 'is_reduce_only'),
4664
4664
  'side': side,
4665
4665
  'price': price,
4666
- 'stopPrice': triggerPrice,
4667
4666
  'triggerPrice': triggerPrice,
4668
4667
  'average': average,
4669
4668
  'amount': Precise.string_abs(amount),
@@ -6487,7 +6486,7 @@ class gate(Exchange, ImplicitAPI):
6487
6486
  # ...
6488
6487
  # ]
6489
6488
  #
6490
- return self.parse_open_interests(response, market, since, limit)
6489
+ return self.parse_open_interests_history(response, market, since, limit)
6491
6490
 
6492
6491
  def parse_open_interest(self, interest, market: Market = None):
6493
6492
  #
ccxt/gemini.py CHANGED
@@ -1300,7 +1300,6 @@ class gemini(Exchange, ImplicitAPI):
1300
1300
  'postOnly': postOnly,
1301
1301
  'side': side,
1302
1302
  'price': price,
1303
- 'stopPrice': None,
1304
1303
  'triggerPrice': None,
1305
1304
  'average': average,
1306
1305
  'cost': None,
@@ -1431,12 +1430,12 @@ class gemini(Exchange, ImplicitAPI):
1431
1430
  }
1432
1431
  type = self.safe_string(params, 'type', type)
1433
1432
  params = self.omit(params, 'type')
1434
- rawStopPrice = self.safe_string_2(params, 'stop_price', 'stopPrice')
1433
+ triggerPrice = self.safe_string_n(params, ['stop_price', 'stopPrice'])
1435
1434
  params = self.omit(params, ['stop_price', 'stopPrice', 'type'])
1436
1435
  if type == 'stopLimit':
1437
- raise ArgumentsRequired(self.id + ' createOrder() requires a stopPrice parameter or a stop_price parameter for ' + type + ' orders')
1438
- if rawStopPrice is not None:
1439
- request['stop_price'] = self.price_to_precision(symbol, rawStopPrice)
1436
+ raise ArgumentsRequired(self.id + ' createOrder() requires a triggerPrice parameter or a stop_price parameter for ' + type + ' orders')
1437
+ if triggerPrice is not None:
1438
+ request['stop_price'] = self.price_to_precision(symbol, triggerPrice)
1440
1439
  request['type'] = 'exchange stop limit'
1441
1440
  else:
1442
1441
  # No options can be applied to stop-limit orders at self time.
ccxt/hashkey.py CHANGED
@@ -361,6 +361,84 @@ class hashkey(Exchange, ImplicitAPI):
361
361
  },
362
362
  'defaultNetwork': 'ERC20',
363
363
  },
364
+ 'features': {
365
+ 'default': {
366
+ 'sandbox': True,
367
+ 'createOrder': {
368
+ 'marginMode': False,
369
+ 'triggerPrice': False,
370
+ 'triggerPriceType': None,
371
+ 'triggerDirection': False,
372
+ 'stopLossPrice': False,
373
+ 'takeProfitPrice': False,
374
+ 'attachedStopLossTakeProfit': None,
375
+ 'timeInForce': {
376
+ 'IOC': True,
377
+ 'FOK': True,
378
+ 'PO': True,
379
+ 'GTD': False,
380
+ },
381
+ 'hedged': False,
382
+ 'trailing': False,
383
+ # exchange-supported features
384
+ # 'marketBuyRequiresPrice': False,
385
+ # 'marketBuyByCost': False,
386
+ # 'selfTradePrevention': True,
387
+ # 'twap': False,
388
+ # 'iceberg': False,
389
+ # 'oco': False,
390
+ },
391
+ 'createOrders': {
392
+ 'max': 20,
393
+ },
394
+ 'fetchMyTrades': {
395
+ 'marginMode': False,
396
+ 'limit': 1000,
397
+ 'daysBack': 30,
398
+ 'untilDays': 30,
399
+ },
400
+ 'fetchOrder': {
401
+ 'marginMode': False,
402
+ 'trigger': False,
403
+ 'trailing': False,
404
+ },
405
+ 'fetchOpenOrders': {
406
+ 'marginMode': False,
407
+ 'limit': 1000,
408
+ 'trigger': False,
409
+ 'trailing': False,
410
+ },
411
+ 'fetchOrders': None,
412
+ 'fetchClosedOrders': None, # todo
413
+ 'fetchOHLCV': {
414
+ 'limit': 1000,
415
+ },
416
+ },
417
+ 'spot': {
418
+ 'extends': 'default',
419
+ },
420
+ 'forDerivatives': {
421
+ 'extends': 'default',
422
+ 'createOrder': {
423
+ 'triggerPrice': True,
424
+ 'selfTradePrevention': True,
425
+ },
426
+ 'fetchOpenOrders': {
427
+ 'trigger': True,
428
+ 'limit': 500,
429
+ },
430
+ },
431
+ 'swap': {
432
+ 'linear': {
433
+ 'extends': 'forDerivatives',
434
+ },
435
+ 'inverse': None,
436
+ },
437
+ 'future': {
438
+ 'linear': None,
439
+ 'inverse': None,
440
+ },
441
+ },
364
442
  'commonCurrencies': {},
365
443
  'exceptions': {
366
444
  'exact': {
@@ -582,11 +660,7 @@ class hashkey(Exchange, ImplicitAPI):
582
660
  :param str [params.symbol]: the id of the market to fetch
583
661
  :returns dict[]: an array of objects representing market data
584
662
  """
585
- symbol: Str = None
586
663
  request: dict = {}
587
- symbol, params = self.handle_option_and_params(params, 'fetchMarkets', 'symbol')
588
- if symbol is not None:
589
- request['symbol'] = symbol
590
664
  response = self.publicGetApiV1ExchangeInfo(self.extend(request, params))
591
665
  #
592
666
  # {
@@ -1254,10 +1328,6 @@ class hashkey(Exchange, ImplicitAPI):
1254
1328
  if marketType == 'spot':
1255
1329
  if market is not None:
1256
1330
  request['symbol'] = market['id']
1257
- clientOrderId: Str = None
1258
- clientOrderId, params = self.handle_option_and_params(params, methodName, 'clientOrderId')
1259
- if clientOrderId is not None:
1260
- request['clientOrderId'] = clientOrderId
1261
1331
  if accountId is not None:
1262
1332
  request['accountId'] = accountId
1263
1333
  response = self.privateGetApiV1AccountTrades(self.extend(request, params))
@@ -1601,10 +1671,6 @@ class hashkey(Exchange, ImplicitAPI):
1601
1671
  self.load_markets()
1602
1672
  symbols = self.market_symbols(symbols)
1603
1673
  request: dict = {}
1604
- symbol: Str = None
1605
- symbol, params = self.handle_option_and_params(params, 'fetchLastPrices', 'symbol')
1606
- if symbol is not None:
1607
- request['symbol'] = symbol
1608
1674
  response = self.publicGetQuoteV1TickerPrice(self.extend(request, params))
1609
1675
  #
1610
1676
  # [
@@ -1662,10 +1728,6 @@ class hashkey(Exchange, ImplicitAPI):
1662
1728
  balance = self.safe_dict(response, 0, {})
1663
1729
  return self.parse_swap_balance(balance)
1664
1730
  elif marketType == 'spot':
1665
- accountId: Str = None
1666
- accountId, params = self.handle_option_and_params(params, methodName, 'accountId')
1667
- if accountId is not None:
1668
- request['accountId'] = accountId
1669
1731
  response = self.privateGetApiV1Account(self.extend(request, params))
1670
1732
  #
1671
1733
  # {
@@ -1931,18 +1993,10 @@ class hashkey(Exchange, ImplicitAPI):
1931
1993
  }
1932
1994
  if tag is not None:
1933
1995
  request['addressExt'] = tag
1934
- clientOrderId: Str = None
1935
- clientOrderId, params = self.handle_option_and_params(params, 'withdraw', 'clientOrderId')
1936
- if clientOrderId is not None:
1937
- request['clientOrderId'] = clientOrderId
1938
1996
  networkCode: Str = None
1939
1997
  networkCode, params = self.handle_network_code_and_params(params)
1940
1998
  if networkCode is not None:
1941
1999
  request['chainType'] = self.network_code_to_id(networkCode)
1942
- platform: Str = None
1943
- platform, params = self.handle_option_and_params(params, 'withdraw', 'platform')
1944
- if platform is not None:
1945
- request['platform'] = platform
1946
2000
  response = self.privatePostApiV1AccountWithdraw(self.extend(request, params))
1947
2001
  #
1948
2002
  # {
@@ -2081,14 +2135,6 @@ class hashkey(Exchange, ImplicitAPI):
2081
2135
  'fromAccountId': fromAccount,
2082
2136
  'toAccountId': toAccount,
2083
2137
  }
2084
- clientOrderId: Str = None
2085
- clientOrderId, params = self.handle_option_and_params(params, 'transfer', 'clientOrderId')
2086
- if clientOrderId is not None:
2087
- request['clientOrderId'] = clientOrderId
2088
- remark: Str = None
2089
- remark, params = self.handle_option_and_params(params, 'transfer', 'remark')
2090
- if remark is not None:
2091
- request['remark'] = remark
2092
2138
  response = self.privatePostApiV1AccountAssetTransfer(self.extend(request, params))
2093
2139
  #
2094
2140
  # {
@@ -2926,10 +2972,6 @@ class hashkey(Exchange, ImplicitAPI):
2926
2972
  if marketType == 'spot':
2927
2973
  if clientOrderId is not None:
2928
2974
  request['origClientOrderId'] = clientOrderId
2929
- accountId: Str = None
2930
- accountId, params = self.handle_option_and_params(params, methodName, 'accountId')
2931
- if accountId is not None:
2932
- request['accountId'] = accountId
2933
2975
  response = self.privateGetApiV1SpotOrder(self.extend(request, params))
2934
2976
  #
2935
2977
  # {
@@ -3065,14 +3107,6 @@ class hashkey(Exchange, ImplicitAPI):
3065
3107
  request['symbol'] = market['id']
3066
3108
  if limit is not None:
3067
3109
  request['limit'] = limit
3068
- orderId: Str = None
3069
- orderId, params = self.handle_option_and_params(params, methodName, 'orderId')
3070
- if orderId is not None:
3071
- request['orderId'] = orderId
3072
- side: Str = None
3073
- side, params = self.handle_option_and_params(params, methodName, 'side')
3074
- if side is not None:
3075
- request['side'] = side.upper()
3076
3110
  response = self.privateGetApiV1SpotOpenOrders(self.extend(request, params))
3077
3111
  #
3078
3112
  # [
@@ -3138,10 +3172,6 @@ class hashkey(Exchange, ImplicitAPI):
3138
3172
  request['type'] = 'LIMIT'
3139
3173
  if limit is not None:
3140
3174
  request['limit'] = limit
3141
- fromOrderId: Str = None
3142
- fromOrderId, params = self.handle_option_and_params(params, methodName, 'fromOrderId')
3143
- if fromOrderId is not None:
3144
- request['fromOrderId'] = fromOrderId
3145
3175
  response = None
3146
3176
  accountId: Str = None
3147
3177
  accountId, params = self.handle_option_and_params(params, methodName, 'accountId')
@@ -3240,14 +3270,6 @@ class hashkey(Exchange, ImplicitAPI):
3240
3270
  if marketType == 'spot':
3241
3271
  if market is not None:
3242
3272
  request['symbol'] = market['id']
3243
- orderId: Str = None
3244
- orderId, params = self.handle_option_and_params(params, methodName, 'orderId')
3245
- if orderId is not None:
3246
- request['orderId'] = orderId
3247
- side: Str = None
3248
- side, params = self.handle_option_and_params(params, methodName, 'side')
3249
- if side is not None:
3250
- request['side'] = side.upper()
3251
3273
  if accountId is not None:
3252
3274
  request['accountId'] = accountId
3253
3275
  response = self.privateGetApiV1SpotTradeOrders(self.extend(request, params))
@@ -3290,10 +3312,6 @@ class hashkey(Exchange, ImplicitAPI):
3290
3312
  request['type'] = 'STOP'
3291
3313
  else:
3292
3314
  request['type'] = 'LIMIT'
3293
- fromOrderId: Str = None
3294
- fromOrderId, params = self.handle_option_and_params(params, methodName, 'fromOrderId')
3295
- if fromOrderId is not None:
3296
- request['fromOrderId'] = fromOrderId
3297
3315
  if accountId is not None:
3298
3316
  request['subAccountId'] = accountId
3299
3317
  response = self.privateGetApiV1FuturesSubAccountHistoryOrders(self.extend(request, params))
@@ -3477,7 +3495,6 @@ class hashkey(Exchange, ImplicitAPI):
3477
3495
  feeCurrncyId = self.safe_string(order, 'feeCoin')
3478
3496
  if feeCurrncyId == '':
3479
3497
  feeCurrncyId = None
3480
- triggerPrice = self.omit_zero(self.safe_string(order, 'stopPrice'))
3481
3498
  return self.safe_order({
3482
3499
  'id': self.safe_string(order, 'orderId'),
3483
3500
  'clientOrderId': self.safe_string(order, 'clientOrderId'),
@@ -3495,8 +3512,7 @@ class hashkey(Exchange, ImplicitAPI):
3495
3512
  'amount': self.omit_zero(self.safe_string(order, 'origQty')),
3496
3513
  'filled': self.safe_string(order, 'executedQty'),
3497
3514
  'remaining': None,
3498
- 'stopPrice': triggerPrice,
3499
- 'triggerPrice': triggerPrice,
3515
+ 'triggerPrice': self.omit_zero(self.safe_string(order, 'stopPrice')),
3500
3516
  'takeProfitPrice': None,
3501
3517
  'stopLossPrice': None,
3502
3518
  'cost': self.omit_zero(self.safe_string_2(order, 'cumulativeQuoteQty', 'cummulativeQuoteQty')),
@@ -3730,10 +3746,6 @@ class hashkey(Exchange, ImplicitAPI):
3730
3746
  request: dict = {
3731
3747
  'symbol': market['id'],
3732
3748
  }
3733
- side: Str = None
3734
- side, params = self.handle_option_and_params(params, methodName, 'side')
3735
- if side is not None:
3736
- request['side'] = side.upper()
3737
3749
  response = self.privateGetApiV1FuturesPositions(self.extend(request, params))
3738
3750
  #
3739
3751
  # [
ccxt/hitbtc.py CHANGED
@@ -92,6 +92,7 @@ class hitbtc(Exchange, ImplicitAPI):
92
92
  'fetchOHLCV': True,
93
93
  'fetchOpenInterest': True,
94
94
  'fetchOpenInterestHistory': False,
95
+ 'fetchOpenInterests': True,
95
96
  'fetchOpenOrder': True,
96
97
  'fetchOpenOrders': True,
97
98
  'fetchOrder': True,
@@ -2254,7 +2255,7 @@ class hitbtc(Exchange, ImplicitAPI):
2254
2255
  elif type == 'market':
2255
2256
  request['type'] = 'stopMarket'
2256
2257
  elif (type == 'stopLimit') or (type == 'stopMarket') or (type == 'takeProfitLimit') or (type == 'takeProfitMarket'):
2257
- raise ExchangeError(self.id + ' createOrder() requires a stopPrice parameter for stop-loss and take-profit orders')
2258
+ raise ExchangeError(self.id + ' createOrder() requires a triggerPrice parameter for stop-loss and take-profit orders')
2258
2259
  params = self.omit(params, ['triggerPrice', 'timeInForce', 'stopPrice', 'stop_price', 'reduceOnly', 'postOnly'])
2259
2260
  if marketType == 'swap':
2260
2261
  # set default margin mode to cross
@@ -2363,7 +2364,6 @@ class hitbtc(Exchange, ImplicitAPI):
2363
2364
  postOnly = self.safe_value(order, 'post_only')
2364
2365
  timeInForce = self.safe_string(order, 'time_in_force')
2365
2366
  rawTrades = self.safe_value(order, 'trades')
2366
- stopPrice = self.safe_string(order, 'stop_price')
2367
2367
  return self.safe_order({
2368
2368
  'info': order,
2369
2369
  'id': id,
@@ -2387,8 +2387,7 @@ class hitbtc(Exchange, ImplicitAPI):
2387
2387
  'average': average,
2388
2388
  'trades': rawTrades,
2389
2389
  'fee': None,
2390
- 'stopPrice': stopPrice,
2391
- 'triggerPrice': stopPrice,
2390
+ 'triggerPrice': self.safe_string(order, 'stop_price'),
2392
2391
  'takeProfitPrice': None,
2393
2392
  'stopLossPrice': None,
2394
2393
  }, market)
@@ -2954,7 +2953,7 @@ class hitbtc(Exchange, ImplicitAPI):
2954
2953
  datetime = self.safe_string(interest, 'timestamp')
2955
2954
  value = self.safe_number(interest, 'open_interest')
2956
2955
  return self.safe_open_interest({
2957
- 'symbol': market['symbol'],
2956
+ 'symbol': self.safe_symbol(None, market),
2958
2957
  'openInterestAmount': None,
2959
2958
  'openInterestValue': value,
2960
2959
  'timestamp': self.parse8601(datetime),
@@ -2962,6 +2961,49 @@ class hitbtc(Exchange, ImplicitAPI):
2962
2961
  'info': interest,
2963
2962
  }, market)
2964
2963
 
2964
+ def fetch_open_interests(self, symbols: Strings = None, params={}):
2965
+ """
2966
+ Retrieves the open interest for a list of symbols
2967
+
2968
+ https://api.hitbtc.com/#futures-info
2969
+
2970
+ :param str[] [symbols]: a list of unified CCXT market symbols
2971
+ :param dict [params]: exchange specific parameters
2972
+ :returns dict[]: a list of `open interest structures <https://docs.ccxt.com/#/?id=open-interest-structure>`
2973
+ """
2974
+ self.load_markets()
2975
+ request: dict = {}
2976
+ symbols = self.market_symbols(symbols)
2977
+ marketIds = None
2978
+ if symbols is not None:
2979
+ marketIds = self.market_ids(symbols)
2980
+ request['symbols'] = ','.join(marketIds)
2981
+ response = self.publicGetPublicFuturesInfo(self.extend(request, params))
2982
+ #
2983
+ # {
2984
+ # "BTCUSDT_PERP": {
2985
+ # "contract_type": "perpetual",
2986
+ # "mark_price": "97291.83",
2987
+ # "index_price": "97298.61",
2988
+ # "funding_rate": "-0.000183473092423284",
2989
+ # "open_interest": "94.1503",
2990
+ # "next_funding_time": "2024-12-20T08:00:00.000Z",
2991
+ # "indicative_funding_rate": "-0.00027495203277752",
2992
+ # "premium_index": "-0.000789474900583786",
2993
+ # "avg_premium_index": "-0.000683473092423284",
2994
+ # "interest_rate": "0.0001",
2995
+ # "timestamp": "2024-12-20T04:57:33.693Z"
2996
+ # }
2997
+ # }
2998
+ #
2999
+ results = []
3000
+ markets = list(response.keys())
3001
+ for i in range(0, len(markets)):
3002
+ marketId = markets[i]
3003
+ marketInner = self.safe_market(marketId)
3004
+ results.append(self.parse_open_interest(response[marketId], marketInner))
3005
+ return self.filter_by_array(results, 'symbol', symbols)
3006
+
2965
3007
  def fetch_open_interest(self, symbol: str, params={}):
2966
3008
  """
2967
3009
  Retrieves the open interest of a derivative trading pair
ccxt/hollaex.py CHANGED
@@ -1098,7 +1098,6 @@ class hollaex(Exchange, ImplicitAPI):
1098
1098
  type = self.safe_string(order, 'type')
1099
1099
  side = self.safe_string(order, 'side')
1100
1100
  price = self.safe_string(order, 'price')
1101
- stopPrice = self.safe_string(order, 'stop')
1102
1101
  amount = self.safe_string(order, 'size')
1103
1102
  filled = self.safe_string(order, 'filled')
1104
1103
  status = self.parse_order_status(self.safe_string(order, 'status'))
@@ -1117,8 +1116,7 @@ class hollaex(Exchange, ImplicitAPI):
1117
1116
  'postOnly': postOnly,
1118
1117
  'side': side,
1119
1118
  'price': price,
1120
- 'stopPrice': stopPrice,
1121
- 'triggerPrice': stopPrice,
1119
+ 'triggerPrice': self.safe_string(order, 'stop'),
1122
1120
  'amount': amount,
1123
1121
  'filled': filled,
1124
1122
  'remaining': None,
@@ -1156,7 +1154,7 @@ class hollaex(Exchange, ImplicitAPI):
1156
1154
  # 'stop': float(self.price_to_precision(symbol, stopPrice)),
1157
1155
  # 'meta': {}, # other options such
1158
1156
  }
1159
- stopPrice = self.safe_number_n(params, ['triggerPrice', 'stopPrice', 'stop'])
1157
+ triggerPrice = self.safe_number_n(params, ['triggerPrice', 'stopPrice', 'stop'])
1160
1158
  meta = self.safe_value(params, 'meta', {})
1161
1159
  exchangeSpecificParam = self.safe_bool(meta, 'post_only', False)
1162
1160
  isMarketOrder = type == 'market'
@@ -1164,8 +1162,8 @@ class hollaex(Exchange, ImplicitAPI):
1164
1162
  if not isMarketOrder:
1165
1163
  convertedPrice = float(self.price_to_precision(symbol, price))
1166
1164
  request['price'] = self.normalize_number_if_needed(convertedPrice)
1167
- if stopPrice is not None:
1168
- request['stop'] = self.normalize_number_if_needed(float(self.price_to_precision(symbol, stopPrice)))
1165
+ if triggerPrice is not None:
1166
+ request['stop'] = self.normalize_number_if_needed(float(self.price_to_precision(symbol, triggerPrice)))
1169
1167
  if postOnly:
1170
1168
  request['meta'] = {'post_only': True}
1171
1169
  params = self.omit(params, ['postOnly', 'timeInForce', 'stopPrice', 'triggerPrice', 'stop'])
ccxt/htx.py CHANGED
@@ -4969,7 +4969,6 @@ class htx(Exchange, ImplicitAPI):
4969
4969
  'cost': feeCost,
4970
4970
  'currency': feeCurrency,
4971
4971
  }
4972
- stopPrice = self.safe_string_2(order, 'stop-price', 'trigger_price')
4973
4972
  average = self.safe_string(order, 'trade_avg_price')
4974
4973
  trades = self.safe_value(order, 'trades')
4975
4974
  reduceOnlyInteger = self.safe_integer(order, 'reduce_only')
@@ -4989,8 +4988,7 @@ class htx(Exchange, ImplicitAPI):
4989
4988
  'postOnly': None,
4990
4989
  'side': side,
4991
4990
  'price': price,
4992
- 'stopPrice': stopPrice,
4993
- 'triggerPrice': stopPrice,
4991
+ 'triggerPrice': self.safe_string_2(order, 'stop-price', 'trigger_price'),
4994
4992
  'average': average,
4995
4993
  'cost': cost,
4996
4994
  'amount': amount,
@@ -8003,7 +8001,7 @@ class htx(Exchange, ImplicitAPI):
8003
8001
  #
8004
8002
  data = self.safe_value(response, 'data')
8005
8003
  tick = self.safe_list(data, 'tick')
8006
- return self.parse_open_interests(tick, market, since, limit)
8004
+ return self.parse_open_interests_history(tick, market, since, limit)
8007
8005
 
8008
8006
  def fetch_open_interest(self, symbol: str, params={}):
8009
8007
  """
ccxt/huobijp.py CHANGED
@@ -1295,7 +1295,6 @@ class huobijp(Exchange, ImplicitAPI):
1295
1295
  'postOnly': None,
1296
1296
  'side': side,
1297
1297
  'price': price,
1298
- 'stopPrice': None,
1299
1298
  'triggerPrice': None,
1300
1299
  'average': None,
1301
1300
  'cost': cost,