ccxt 4.4.39__py2.py3-none-any.whl → 4.4.41__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 (137) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bitmart.py +2 -0
  3. ccxt/abstract/okx.py +5 -0
  4. ccxt/ascendex.py +9 -9
  5. ccxt/async_support/__init__.py +1 -1
  6. ccxt/async_support/ascendex.py +9 -9
  7. ccxt/async_support/base/exchange.py +10 -3
  8. ccxt/async_support/base/ws/aiohttp_client.py +2 -2
  9. ccxt/async_support/binance.py +37 -41
  10. ccxt/async_support/bingx.py +4 -3
  11. ccxt/async_support/bit2c.py +0 -1
  12. ccxt/async_support/bitbank.py +0 -1
  13. ccxt/async_support/bitbns.py +0 -1
  14. ccxt/async_support/bitfinex.py +16 -17
  15. ccxt/async_support/bitfinex1.py +0 -1
  16. ccxt/async_support/bitflyer.py +0 -1
  17. ccxt/async_support/bitget.py +2 -2
  18. ccxt/async_support/bithumb.py +0 -1
  19. ccxt/async_support/bitmart.py +246 -6
  20. ccxt/async_support/bitmex.py +5 -6
  21. ccxt/async_support/bitopro.py +4 -5
  22. ccxt/async_support/bitrue.py +5 -7
  23. ccxt/async_support/bitso.py +1 -2
  24. ccxt/async_support/bitstamp.py +1 -2
  25. ccxt/async_support/bitteam.py +1 -3
  26. ccxt/async_support/bitvavo.py +2 -4
  27. ccxt/async_support/blockchaincom.py +5 -5
  28. ccxt/async_support/blofin.py +10 -10
  29. ccxt/async_support/btcalpha.py +0 -1
  30. ccxt/async_support/btcbox.py +0 -1
  31. ccxt/async_support/btcmarkets.py +1 -3
  32. ccxt/async_support/bybit.py +10 -11
  33. ccxt/async_support/cex.py +1 -1
  34. ccxt/async_support/coinbase.py +77 -1
  35. ccxt/async_support/coinbaseexchange.py +1 -1
  36. ccxt/async_support/coinbaseinternational.py +62 -0
  37. ccxt/async_support/coincatch.py +1 -1
  38. ccxt/async_support/coinex.py +9 -9
  39. ccxt/async_support/coinlist.py +1 -1
  40. ccxt/async_support/coinmetro.py +1 -1
  41. ccxt/async_support/cryptocom.py +91 -2
  42. ccxt/async_support/currencycom.py +1 -1
  43. ccxt/async_support/defx.py +1 -2
  44. ccxt/async_support/delta.py +1 -1
  45. ccxt/async_support/digifinex.py +1 -1
  46. ccxt/async_support/exmo.py +62 -6
  47. ccxt/async_support/gate.py +2 -2
  48. ccxt/async_support/hashkey.py +3 -5
  49. ccxt/async_support/htx.py +2 -2
  50. ccxt/async_support/hyperliquid.py +61 -2
  51. ccxt/async_support/kraken.py +124 -26
  52. ccxt/async_support/kucoin.py +29 -25
  53. ccxt/async_support/luno.py +1 -1
  54. ccxt/async_support/mexc.py +137 -1
  55. ccxt/async_support/ndax.py +1 -1
  56. ccxt/async_support/okcoin.py +18 -18
  57. ccxt/async_support/okx.py +27 -22
  58. ccxt/async_support/phemex.py +12 -8
  59. ccxt/async_support/poloniex.py +1 -1
  60. ccxt/async_support/poloniexfutures.py +6 -6
  61. ccxt/async_support/vertex.py +11 -11
  62. ccxt/async_support/woo.py +33 -33
  63. ccxt/async_support/woofipro.py +24 -24
  64. ccxt/async_support/xt.py +29 -27
  65. ccxt/async_support/zonda.py +1 -1
  66. ccxt/base/exchange.py +31 -19
  67. ccxt/base/types.py +10 -0
  68. ccxt/binance.py +37 -41
  69. ccxt/bingx.py +4 -3
  70. ccxt/bit2c.py +0 -1
  71. ccxt/bitbank.py +0 -1
  72. ccxt/bitbns.py +0 -1
  73. ccxt/bitfinex.py +16 -17
  74. ccxt/bitfinex1.py +0 -1
  75. ccxt/bitflyer.py +0 -1
  76. ccxt/bitget.py +2 -2
  77. ccxt/bithumb.py +0 -1
  78. ccxt/bitmart.py +246 -6
  79. ccxt/bitmex.py +5 -6
  80. ccxt/bitopro.py +4 -5
  81. ccxt/bitrue.py +5 -7
  82. ccxt/bitso.py +1 -2
  83. ccxt/bitstamp.py +1 -2
  84. ccxt/bitteam.py +1 -3
  85. ccxt/bitvavo.py +2 -4
  86. ccxt/blockchaincom.py +5 -5
  87. ccxt/blofin.py +10 -10
  88. ccxt/btcalpha.py +0 -1
  89. ccxt/btcbox.py +0 -1
  90. ccxt/btcmarkets.py +1 -3
  91. ccxt/bybit.py +10 -11
  92. ccxt/cex.py +1 -1
  93. ccxt/coinbase.py +77 -1
  94. ccxt/coinbaseexchange.py +1 -1
  95. ccxt/coinbaseinternational.py +62 -0
  96. ccxt/coincatch.py +1 -1
  97. ccxt/coinex.py +9 -9
  98. ccxt/coinlist.py +1 -1
  99. ccxt/coinmetro.py +1 -1
  100. ccxt/cryptocom.py +91 -2
  101. ccxt/currencycom.py +1 -1
  102. ccxt/defx.py +1 -2
  103. ccxt/delta.py +1 -1
  104. ccxt/digifinex.py +1 -1
  105. ccxt/exmo.py +62 -6
  106. ccxt/gate.py +2 -2
  107. ccxt/hashkey.py +3 -5
  108. ccxt/htx.py +2 -2
  109. ccxt/hyperliquid.py +61 -2
  110. ccxt/kraken.py +124 -26
  111. ccxt/kucoin.py +29 -25
  112. ccxt/luno.py +1 -1
  113. ccxt/mexc.py +137 -1
  114. ccxt/ndax.py +1 -1
  115. ccxt/okcoin.py +18 -18
  116. ccxt/okx.py +27 -22
  117. ccxt/phemex.py +12 -8
  118. ccxt/poloniex.py +1 -1
  119. ccxt/poloniexfutures.py +6 -6
  120. ccxt/pro/__init__.py +1 -1
  121. ccxt/pro/bitget.py +1 -1
  122. ccxt/pro/bybit.py +12 -1
  123. ccxt/pro/coinex.py +2 -2
  124. ccxt/pro/gate.py +6 -6
  125. ccxt/pro/kucoin.py +3 -3
  126. ccxt/pro/okx.py +11 -11
  127. ccxt/pro/upbit.py +2 -2
  128. ccxt/vertex.py +11 -11
  129. ccxt/woo.py +33 -33
  130. ccxt/woofipro.py +24 -24
  131. ccxt/xt.py +29 -27
  132. ccxt/zonda.py +1 -1
  133. {ccxt-4.4.39.dist-info → ccxt-4.4.41.dist-info}/METADATA +4 -4
  134. {ccxt-4.4.39.dist-info → ccxt-4.4.41.dist-info}/RECORD +137 -137
  135. {ccxt-4.4.39.dist-info → ccxt-4.4.41.dist-info}/LICENSE.txt +0 -0
  136. {ccxt-4.4.39.dist-info → ccxt-4.4.41.dist-info}/WHEEL +0 -0
  137. {ccxt-4.4.39.dist-info → ccxt-4.4.41.dist-info}/top_level.txt +0 -0
@@ -366,6 +366,95 @@ class cryptocom(Exchange, ImplicitAPI):
366
366
  },
367
367
  'broker': 'CCXT',
368
368
  },
369
+ 'features': {
370
+ 'default': {
371
+ 'sandbox': True,
372
+ 'createOrder': {
373
+ 'marginMode': True,
374
+ 'triggerPrice': True,
375
+ # todo: implementation fix
376
+ 'triggerPriceType': {
377
+ 'last': True,
378
+ 'mark': True,
379
+ 'index': True,
380
+ },
381
+ 'triggerDirection': False,
382
+ 'stopLossPrice': True,
383
+ 'takeProfitPrice': True,
384
+ 'attachedStopLossTakeProfit': None,
385
+ 'timeInForce': {
386
+ 'IOC': True,
387
+ 'FOK': True,
388
+ 'PO': True,
389
+ 'GTD': False,
390
+ },
391
+ 'hedged': False,
392
+ # exchange-supported features
393
+ 'selfTradePrevention': True,
394
+ 'trailing': False,
395
+ 'iceberg': False,
396
+ },
397
+ 'createOrders': {
398
+ 'max': 10,
399
+ },
400
+ 'fetchMyTrades': {
401
+ 'marginMode': False,
402
+ 'limit': 100,
403
+ 'daysBack': None,
404
+ 'untilDays': 1,
405
+ },
406
+ 'fetchOrder': {
407
+ 'marginMode': False,
408
+ 'trigger': False,
409
+ 'trailing': False,
410
+ },
411
+ 'fetchOpenOrders': {
412
+ 'marginMode': True,
413
+ 'limit': 100,
414
+ 'trigger': False,
415
+ 'trailing': False,
416
+ },
417
+ 'fetchOrders': {
418
+ 'marginMode': False,
419
+ 'limit': 100,
420
+ 'daysBack': None,
421
+ 'untilDays': 1,
422
+ 'trigger': False,
423
+ 'trailing': False,
424
+ },
425
+ 'fetchClosedOrders': {
426
+ 'marginMode': False,
427
+ 'limit': 100,
428
+ 'daysBackClosed': None,
429
+ 'daysBackCanceled': None,
430
+ 'untilDays': 1,
431
+ 'trigger': False,
432
+ 'trailing': False,
433
+ },
434
+ 'fetchOHLCV': {
435
+ 'limit': 300,
436
+ },
437
+ },
438
+ 'spot': {
439
+ 'extends': 'default',
440
+ },
441
+ 'swap': {
442
+ 'linear': {
443
+ 'extends': 'default',
444
+ },
445
+ 'inverse': {
446
+ 'extends': 'default',
447
+ },
448
+ },
449
+ 'future': {
450
+ 'linear': {
451
+ 'extends': 'default',
452
+ },
453
+ 'inverse': {
454
+ 'extends': 'default',
455
+ },
456
+ },
457
+ },
369
458
  # https://exchange-docs.crypto.com/spot/index.html#response-and-reason-codes
370
459
  'commonCurrencies': {
371
460
  'USD_STABLE_COIN': 'USDC',
@@ -1147,7 +1236,7 @@ class cryptocom(Exchange, ImplicitAPI):
1147
1236
  :param dict [params]: extra parameters specific to the exchange API endpoint
1148
1237
  :param str [params.timeInForce]: 'GTC', 'IOC', 'FOK' or 'PO'
1149
1238
  :param str [params.ref_price_type]: 'MARK_PRICE', 'INDEX_PRICE', 'LAST_PRICE' which trigger price type to use, default is MARK_PRICE
1150
- :param float [params.triggerPrice]: price to trigger a stop order
1239
+ :param float [params.triggerPrice]: price to trigger a trigger order
1151
1240
  :param float [params.stopLossPrice]: price to trigger a stop-loss trigger order
1152
1241
  :param float [params.takeProfitPrice]: price to trigger a take-profit trigger order
1153
1242
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
@@ -2283,7 +2372,7 @@ class cryptocom(Exchange, ImplicitAPI):
2283
2372
  :param int [limit]: max number of ledger entries to return
2284
2373
  :param dict [params]: extra parameters specific to the exchange API endpoint
2285
2374
  :param int [params.until]: timestamp in ms for the ending date filter, default is the current time
2286
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2375
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
2287
2376
  """
2288
2377
  await self.load_markets()
2289
2378
  request: dict = {}
@@ -1668,7 +1668,7 @@ class currencycom(Exchange, ImplicitAPI):
1668
1668
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
1669
1669
  :param int [limit]: max number of ledger entries to return, default is None
1670
1670
  :param dict [params]: extra parameters specific to the exchange API endpoint
1671
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
1671
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
1672
1672
  """
1673
1673
  await self.load_markets()
1674
1674
  request: dict = {}
@@ -1317,7 +1317,6 @@ class defx(Exchange, ImplicitAPI):
1317
1317
  :param str id: order id
1318
1318
  :param str symbol: unified symbol of the market the order was made in
1319
1319
  :param dict [params]: extra parameters specific to the exchange API endpoint
1320
- :param boolean [params.stop]: whether the order is a stop/algo order
1321
1320
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1322
1321
  """
1323
1322
  await self.load_markets()
@@ -1734,7 +1733,7 @@ class defx(Exchange, ImplicitAPI):
1734
1733
  :param dict [params]: extra parameters specific to the exchange API endpoint
1735
1734
  :param int [params.until]: timestamp in ms of the latest ledger entry
1736
1735
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1737
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
1736
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
1738
1737
  """
1739
1738
  await self.load_markets()
1740
1739
  paginate = False
@@ -2152,7 +2152,7 @@ class delta(Exchange, ImplicitAPI):
2152
2152
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
2153
2153
  :param int [limit]: max number of ledger entries to return, default is None
2154
2154
  :param dict [params]: extra parameters specific to the exchange API endpoint
2155
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2155
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
2156
2156
  """
2157
2157
  await self.load_markets()
2158
2158
  request: dict = {
@@ -2478,7 +2478,7 @@ class digifinex(Exchange, ImplicitAPI):
2478
2478
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
2479
2479
  :param int [limit]: max number of ledger entries to return, default is None
2480
2480
  :param dict [params]: extra parameters specific to the exchange API endpoint
2481
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2481
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
2482
2482
  """
2483
2483
  await self.load_markets()
2484
2484
  request: dict = {}
@@ -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
+ async 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
+ await self.load_markets()
1371
+ params = self.extend(params, {'cost': cost})
1372
+ return await self.create_order(symbol, 'market', side, cost, None, params)
1373
+
1374
+ async 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
+ await self.load_markets()
1386
+ params = self.extend(params, {'cost': cost})
1387
+ return await self.create_order(symbol, 'market', 'buy', cost, None, params)
1388
+
1389
+ async 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
+ await self.load_markets()
1401
+ params = self.extend(params, {'cost': cost})
1402
+ return await self.create_order(symbol, 'market', 'sell', cost, None, params)
1403
+
1355
1404
  async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1356
1405
  """
1357
1406
  create a trade order
@@ -1369,6 +1418,7 @@ class exmo(Exchange, ImplicitAPI):
1369
1418
  :param float [params.stopPrice]: 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
  await 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:
@@ -1463,7 +1519,7 @@ class exmo(Exchange, ImplicitAPI):
1463
1519
  """
1464
1520
  await self.load_markets()
1465
1521
  request: dict = {}
1466
- stop = self.safe_value_2(params, 'trigger', 'stop')
1522
+ trigger = self.safe_value_2(params, 'trigger', 'stop')
1467
1523
  params = self.omit(params, ['trigger', 'stop'])
1468
1524
  marginMode = None
1469
1525
  marginMode, params = self.handle_margin_mode_and_params('cancelOrder', params)
@@ -1477,7 +1533,7 @@ class exmo(Exchange, ImplicitAPI):
1477
1533
  # {}
1478
1534
  #
1479
1535
  else:
1480
- if stop:
1536
+ if trigger:
1481
1537
  request['parent_order_id'] = id
1482
1538
  response = await self.privatePostStopMarketOrderCancel(self.extend(request, params))
1483
1539
  #
@@ -6488,7 +6488,7 @@ class gate(Exchange, ImplicitAPI):
6488
6488
  # ...
6489
6489
  # ]
6490
6490
  #
6491
- return self.parse_open_interests(response, market, since, limit)
6491
+ return self.parse_open_interests_history(response, market, since, limit)
6492
6492
 
6493
6493
  def parse_open_interest(self, interest, market: Market = None):
6494
6494
  #
@@ -6706,7 +6706,7 @@ class gate(Exchange, ImplicitAPI):
6706
6706
  :param dict [params]: extra parameters specific to the exchange API endpoint
6707
6707
  :param int [params.until]: end time in ms
6708
6708
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6709
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
6709
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
6710
6710
  """
6711
6711
  await self.load_markets()
6712
6712
  paginate = False
@@ -2199,7 +2199,7 @@ class hashkey(Exchange, ImplicitAPI):
2199
2199
  :param int [params.until]: the latest time in ms to fetch entries for
2200
2200
  :param int [params.flowType]: trade, fee, transfer, deposit, withdrawal
2201
2201
  :param int [params.accountType]: spot, swap, custody
2202
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2202
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
2203
2203
  """
2204
2204
  methodName = 'fetchLedger'
2205
2205
  if since is None:
@@ -3337,10 +3337,8 @@ class hashkey(Exchange, ImplicitAPI):
3337
3337
  raise BadRequest(self.id + ' ' + methodName + '() type parameter can not be "' + paramsType + '". It should define the type of the market("spot" or "swap"). To define the type of an order use the trigger parameter(True for trigger orders)')
3338
3338
 
3339
3339
  def handle_trigger_option_and_params(self, params: object, methodName: str, defaultValue=None):
3340
- isStop = defaultValue
3341
- isStop, params = self.handle_option_and_params(params, methodName, 'stop', isStop)
3342
- isTrigger = isStop
3343
- isTrigger, params = self.handle_option_and_params(params, methodName, 'trigger', isTrigger)
3340
+ isTrigger = defaultValue
3341
+ isTrigger, params = self.handle_option_and_params_2(params, methodName, 'stop', 'trigger', isTrigger)
3344
3342
  return [isTrigger, params]
3345
3343
 
3346
3344
  def parse_order(self, order: dict, market: Market = None) -> Order:
ccxt/async_support/htx.py CHANGED
@@ -7764,7 +7764,7 @@ class htx(Exchange, ImplicitAPI):
7764
7764
  :param dict [params]: extra parameters specific to the exchange API endpoint
7765
7765
  :param int [params.until]: the latest time in ms to fetch entries for
7766
7766
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
7767
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
7767
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
7768
7768
  """
7769
7769
  await self.load_markets()
7770
7770
  paginate = False
@@ -8004,7 +8004,7 @@ class htx(Exchange, ImplicitAPI):
8004
8004
  #
8005
8005
  data = self.safe_value(response, 'data')
8006
8006
  tick = self.safe_list(data, 'tick')
8007
- return self.parse_open_interests(tick, market, since, limit)
8007
+ return self.parse_open_interests_history(tick, market, since, limit)
8008
8008
 
8009
8009
  async def fetch_open_interest(self, symbol: str, params={}):
8010
8010
  """
@@ -95,8 +95,9 @@ class hyperliquid(Exchange, ImplicitAPI):
95
95
  'fetchMyLiquidations': False,
96
96
  'fetchMyTrades': True,
97
97
  'fetchOHLCV': True,
98
- 'fetchOpenInterest': False,
98
+ 'fetchOpenInterest': True,
99
99
  'fetchOpenInterestHistory': False,
100
+ 'fetchOpenInterests': True,
100
101
  'fetchOpenOrders': True,
101
102
  'fetchOrder': True,
102
103
  'fetchOrderBook': True,
@@ -2971,7 +2972,7 @@ class hyperliquid(Exchange, ImplicitAPI):
2971
2972
  :param int [limit]: max number of ledger entries to return
2972
2973
  :param dict [params]: extra parameters specific to the exchange API endpoint
2973
2974
  :param int [params.until]: timestamp in ms of the latest ledger entry
2974
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2975
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
2975
2976
  """
2976
2977
  await self.load_markets()
2977
2978
  userAddress = None
@@ -3132,6 +3133,64 @@ class hyperliquid(Exchange, ImplicitAPI):
3132
3133
  withdrawals = self.filter_by_array(records, 'type', ['withdraw'], False)
3133
3134
  return self.parse_transactions(withdrawals, None, since, limit)
3134
3135
 
3136
+ async def fetch_open_interests(self, symbols: Strings = None, params={}):
3137
+ """
3138
+ Retrieves the open interest for a list of symbols
3139
+ :param str[] [symbols]: Unified CCXT market symbol
3140
+ :param dict [params]: exchange specific parameters
3141
+ :returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure:
3142
+ """
3143
+ await self.load_markets()
3144
+ symbols = self.market_symbols(symbols)
3145
+ swapMarkets = await self.fetch_swap_markets()
3146
+ result = self.parse_open_interests(swapMarkets)
3147
+ return self.filter_by_array(result, 'symbol', symbols)
3148
+
3149
+ async def fetch_open_interest(self, symbol: str, params={}):
3150
+ """
3151
+ retrieves the open interest of a contract trading pair
3152
+ :param str symbol: unified CCXT market symbol
3153
+ :param dict [params]: exchange specific parameters
3154
+ :returns dict: an `open interest structure <https://docs.ccxt.com/#/?id=open-interest-structure>`
3155
+ """
3156
+ symbol = self.symbol(symbol)
3157
+ await self.load_markets()
3158
+ ois = await self.fetch_open_interests([symbol], params)
3159
+ return ois[symbol]
3160
+
3161
+ def parse_open_interest(self, interest, market: Market = None):
3162
+ #
3163
+ # {
3164
+ # szDecimals: '2',
3165
+ # name: 'HYPE',
3166
+ # maxLeverage: '3',
3167
+ # funding: '0.00014735',
3168
+ # openInterest: '14677900.74',
3169
+ # prevDayPx: '26.145',
3170
+ # dayNtlVlm: '299643445.12560016',
3171
+ # premium: '0.00081613',
3172
+ # oraclePx: '27.569',
3173
+ # markPx: '27.63',
3174
+ # midPx: '27.599',
3175
+ # impactPxs: ['27.5915', '27.6319'],
3176
+ # dayBaseVlm: '10790652.83',
3177
+ # baseId: 159
3178
+ # }
3179
+ #
3180
+ interest = self.safe_dict(interest, 'info', {})
3181
+ coin = self.safe_string(interest, 'name')
3182
+ marketId = None
3183
+ if coin is not None:
3184
+ marketId = self.coin_to_market_id(coin)
3185
+ return self.safe_open_interest({
3186
+ 'symbol': self.safe_symbol(marketId),
3187
+ 'openInterestAmount': self.safe_number(interest, 'openInterest'),
3188
+ 'openInterestValue': None,
3189
+ 'timestamp': None,
3190
+ 'datetime': None,
3191
+ 'info': interest,
3192
+ }, market)
3193
+
3135
3194
  def extract_type_from_delta(self, data=[]):
3136
3195
  records = []
3137
3196
  for i in range(0, len(data)):