ccxt 4.4.40 → 4.4.42

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 (183) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/ace.js +1 -1
  5. package/dist/cjs/src/alpaca.js +0 -1
  6. package/dist/cjs/src/ascendex.js +0 -1
  7. package/dist/cjs/src/base/Exchange.js +41 -19
  8. package/dist/cjs/src/bigone.js +0 -1
  9. package/dist/cjs/src/binance.js +27 -24
  10. package/dist/cjs/src/bingx.js +6 -1
  11. package/dist/cjs/src/bitfinex.js +124 -1
  12. package/dist/cjs/src/bitget.js +1 -0
  13. package/dist/cjs/src/bitmart.js +254 -1
  14. package/dist/cjs/src/blofin.js +16 -7
  15. package/dist/cjs/src/bybit.js +8 -8
  16. package/dist/cjs/src/cex.js +1 -1
  17. package/dist/cjs/src/coinbase.js +8 -9
  18. package/dist/cjs/src/coinbaseexchange.js +5 -6
  19. package/dist/cjs/src/coinbaseinternational.js +7 -8
  20. package/dist/cjs/src/coincatch.js +0 -1
  21. package/dist/cjs/src/coincheck.js +0 -1
  22. package/dist/cjs/src/coinex.js +91 -6
  23. package/dist/cjs/src/coinlist.js +3 -4
  24. package/dist/cjs/src/coinmate.js +1 -3
  25. package/dist/cjs/src/coinmetro.js +4 -5
  26. package/dist/cjs/src/coinone.js +0 -1
  27. package/dist/cjs/src/coinsph.js +7 -8
  28. package/dist/cjs/src/cryptocom.js +3 -0
  29. package/dist/cjs/src/currencycom.js +3 -4
  30. package/dist/cjs/src/defx.js +6 -7
  31. package/dist/cjs/src/deribit.js +1 -3
  32. package/dist/cjs/src/digifinex.js +0 -1
  33. package/dist/cjs/src/ellipx.js +0 -2
  34. package/dist/cjs/src/exmo.js +63 -6
  35. package/dist/cjs/src/gate.js +2 -3
  36. package/dist/cjs/src/gemini.js +4 -5
  37. package/dist/cjs/src/hashkey.js +79 -83
  38. package/dist/cjs/src/hitbtc.js +49 -5
  39. package/dist/cjs/src/hollaex.js +4 -6
  40. package/dist/cjs/src/htx.js +2 -4
  41. package/dist/cjs/src/huobijp.js +0 -1
  42. package/dist/cjs/src/hyperliquid.js +65 -1
  43. package/dist/cjs/src/idex.js +8 -8
  44. package/dist/cjs/src/independentreserve.js +0 -1
  45. package/dist/cjs/src/indodax.js +0 -1
  46. package/dist/cjs/src/kraken.js +192 -29
  47. package/dist/cjs/src/krakenfutures.js +75 -3
  48. package/dist/cjs/src/kucoin.js +7 -4
  49. package/dist/cjs/src/kucoinfutures.js +10 -9
  50. package/dist/cjs/src/kuna.js +1 -3
  51. package/dist/cjs/src/latoken.js +1 -3
  52. package/dist/cjs/src/lbank.js +0 -1
  53. package/dist/cjs/src/luno.js +0 -1
  54. package/dist/cjs/src/lykke.js +0 -1
  55. package/dist/cjs/src/mercado.js +0 -1
  56. package/dist/cjs/src/mexc.js +6 -7
  57. package/dist/cjs/src/ndax.js +1 -1
  58. package/dist/cjs/src/novadax.js +4 -6
  59. package/dist/cjs/src/oceanex.js +0 -1
  60. package/dist/cjs/src/okcoin.js +1 -3
  61. package/dist/cjs/src/okx.js +7 -4
  62. package/dist/cjs/src/onetrading.js +1 -3
  63. package/dist/cjs/src/p2b.js +1 -1
  64. package/dist/cjs/src/paradex.js +5 -7
  65. package/dist/cjs/src/phemex.js +8 -10
  66. package/dist/cjs/src/poloniex.js +1 -3
  67. package/dist/cjs/src/poloniexfutures.js +6 -6
  68. package/dist/cjs/src/probit.js +0 -1
  69. package/dist/cjs/src/timex.js +0 -1
  70. package/dist/cjs/src/tokocrypto.js +11 -14
  71. package/dist/cjs/src/tradeogre.js +1 -1
  72. package/dist/cjs/src/upbit.js +0 -1
  73. package/dist/cjs/src/wavesexchange.js +4 -5
  74. package/dist/cjs/src/whitebit.js +8 -9
  75. package/dist/cjs/src/woo.js +99 -13
  76. package/dist/cjs/src/woofipro.js +96 -15
  77. package/dist/cjs/src/xt.js +8 -4
  78. package/dist/cjs/src/yobit.js +0 -1
  79. package/dist/cjs/src/zaif.js +0 -1
  80. package/dist/cjs/src/zonda.js +1 -2
  81. package/js/ccxt.d.ts +3 -3
  82. package/js/ccxt.js +1 -1
  83. package/js/src/abstract/binance.d.ts +3 -0
  84. package/js/src/abstract/binancecoinm.d.ts +3 -0
  85. package/js/src/abstract/binanceus.d.ts +3 -0
  86. package/js/src/abstract/binanceusdm.d.ts +3 -0
  87. package/js/src/abstract/bitmart.d.ts +2 -0
  88. package/js/src/abstract/okx.d.ts +5 -0
  89. package/js/src/ace.js +1 -1
  90. package/js/src/alpaca.js +0 -1
  91. package/js/src/ascendex.js +0 -1
  92. package/js/src/base/Exchange.d.ts +12 -9
  93. package/js/src/base/Exchange.js +41 -19
  94. package/js/src/base/types.d.ts +2 -0
  95. package/js/src/bigone.js +0 -1
  96. package/js/src/binance.js +27 -24
  97. package/js/src/bingx.js +6 -1
  98. package/js/src/bitfinex.d.ts +11 -1
  99. package/js/src/bitfinex.js +124 -1
  100. package/js/src/bitget.js +1 -0
  101. package/js/src/bitmart.d.ts +52 -1
  102. package/js/src/bitmart.js +254 -1
  103. package/js/src/blofin.d.ts +1 -1
  104. package/js/src/blofin.js +16 -7
  105. package/js/src/bybit.js +8 -8
  106. package/js/src/cex.js +1 -1
  107. package/js/src/coinbase.js +8 -9
  108. package/js/src/coinbaseexchange.js +5 -6
  109. package/js/src/coinbaseinternational.d.ts +1 -1
  110. package/js/src/coinbaseinternational.js +7 -8
  111. package/js/src/coincatch.js +0 -1
  112. package/js/src/coincheck.js +0 -1
  113. package/js/src/coinex.js +91 -6
  114. package/js/src/coinlist.js +3 -4
  115. package/js/src/coinmate.js +1 -3
  116. package/js/src/coinmetro.js +4 -5
  117. package/js/src/coinone.js +0 -1
  118. package/js/src/coinsph.js +7 -8
  119. package/js/src/cryptocom.js +3 -0
  120. package/js/src/currencycom.js +3 -4
  121. package/js/src/defx.js +6 -7
  122. package/js/src/deribit.js +1 -3
  123. package/js/src/digifinex.js +0 -1
  124. package/js/src/ellipx.js +0 -2
  125. package/js/src/exmo.d.ts +36 -1
  126. package/js/src/exmo.js +63 -6
  127. package/js/src/gate.d.ts +1 -1
  128. package/js/src/gate.js +2 -3
  129. package/js/src/gemini.js +4 -5
  130. package/js/src/hashkey.js +79 -83
  131. package/js/src/hitbtc.d.ts +11 -1
  132. package/js/src/hitbtc.js +49 -5
  133. package/js/src/hollaex.js +4 -6
  134. package/js/src/htx.js +2 -4
  135. package/js/src/huobijp.js +0 -1
  136. package/js/src/hyperliquid.d.ts +20 -1
  137. package/js/src/hyperliquid.js +65 -1
  138. package/js/src/idex.js +8 -8
  139. package/js/src/independentreserve.js +0 -1
  140. package/js/src/indodax.js +0 -1
  141. package/js/src/kraken.d.ts +15 -9
  142. package/js/src/kraken.js +192 -29
  143. package/js/src/krakenfutures.d.ts +2 -2
  144. package/js/src/krakenfutures.js +75 -3
  145. package/js/src/kucoin.js +7 -4
  146. package/js/src/kucoinfutures.d.ts +5 -4
  147. package/js/src/kucoinfutures.js +10 -9
  148. package/js/src/kuna.js +1 -3
  149. package/js/src/latoken.js +1 -3
  150. package/js/src/lbank.js +0 -1
  151. package/js/src/luno.js +0 -1
  152. package/js/src/lykke.js +0 -1
  153. package/js/src/mercado.js +0 -1
  154. package/js/src/mexc.js +6 -7
  155. package/js/src/ndax.js +1 -1
  156. package/js/src/novadax.js +4 -6
  157. package/js/src/oceanex.js +0 -1
  158. package/js/src/okcoin.js +1 -3
  159. package/js/src/okx.js +7 -4
  160. package/js/src/onetrading.js +1 -3
  161. package/js/src/p2b.js +1 -1
  162. package/js/src/paradex.d.ts +1 -1
  163. package/js/src/paradex.js +5 -7
  164. package/js/src/phemex.js +8 -10
  165. package/js/src/poloniex.js +1 -3
  166. package/js/src/poloniexfutures.js +6 -6
  167. package/js/src/probit.js +0 -1
  168. package/js/src/timex.js +0 -1
  169. package/js/src/tokocrypto.js +11 -14
  170. package/js/src/tradeogre.js +1 -1
  171. package/js/src/upbit.js +0 -1
  172. package/js/src/wavesexchange.d.ts +1 -1
  173. package/js/src/wavesexchange.js +4 -5
  174. package/js/src/whitebit.js +8 -9
  175. package/js/src/woo.d.ts +1 -1
  176. package/js/src/woo.js +99 -13
  177. package/js/src/woofipro.js +96 -15
  178. package/js/src/xt.d.ts +2 -1
  179. package/js/src/xt.js +8 -4
  180. package/js/src/yobit.js +0 -1
  181. package/js/src/zaif.js +0 -1
  182. package/js/src/zonda.js +1 -2
  183. package/package.json +2 -2
package/js/src/exmo.js CHANGED
@@ -34,6 +34,9 @@ export default class exmo extends Exchange {
34
34
  'cancelOrder': true,
35
35
  'cancelOrders': false,
36
36
  'createDepositAddress': false,
37
+ 'createMarketBuyOrder': true,
38
+ 'createMarketBuyOrderWithCost': true,
39
+ 'createMarketOrderWithCost': true,
37
40
  'createOrder': true,
38
41
  'createStopLimitOrder': true,
39
42
  'createStopMarketOrder': true,
@@ -1409,6 +1412,52 @@ export default class exmo extends Exchange {
1409
1412
  }
1410
1413
  return this.filterBySinceLimit(result, since, limit);
1411
1414
  }
1415
+ /**
1416
+ * @method
1417
+ * @name exmo#createMarketOrderWithCost
1418
+ * @description create a market order by providing the symbol, side and cost
1419
+ * @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd
1420
+ * @param {string} symbol unified symbol of the market to create an order in
1421
+ * @param {string} side 'buy' or 'sell'
1422
+ * @param {float} cost how much you want to trade in units of the quote currency
1423
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1424
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1425
+ */
1426
+ async createMarketOrderWithCost(symbol, side, cost, params = {}) {
1427
+ await this.loadMarkets();
1428
+ params = this.extend(params, { 'cost': cost });
1429
+ return await this.createOrder(symbol, 'market', side, cost, undefined, params);
1430
+ }
1431
+ /**
1432
+ * @method
1433
+ * @name exmo#createMarketBuyOrderWithCost
1434
+ * @description create a market buy order by providing the symbol and cost
1435
+ * @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd
1436
+ * @param {string} symbol unified symbol of the market to create an order in
1437
+ * @param {float} cost how much you want to trade in units of the quote currency
1438
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1439
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1440
+ */
1441
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
1442
+ await this.loadMarkets();
1443
+ params = this.extend(params, { 'cost': cost });
1444
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
1445
+ }
1446
+ /**
1447
+ * @method
1448
+ * @name exmo#createMarketSellOrderWithCost
1449
+ * @description create a market sell order by providing the symbol and cost
1450
+ * @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd
1451
+ * @param {string} symbol unified symbol of the market to create an order in
1452
+ * @param {float} cost how much you want to trade in units of the quote currency
1453
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1454
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1455
+ */
1456
+ async createMarketSellOrderWithCost(symbol, cost, params = {}) {
1457
+ await this.loadMarkets();
1458
+ params = this.extend(params, { 'cost': cost });
1459
+ return await this.createOrder(symbol, 'market', 'sell', cost, undefined, params);
1460
+ }
1412
1461
  /**
1413
1462
  * @method
1414
1463
  * @name exmo#createOrder
@@ -1422,9 +1471,10 @@ export default class exmo extends Exchange {
1422
1471
  * @param {float} amount how much of currency you want to trade in units of base currency
1423
1472
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1424
1473
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1425
- * @param {float} [params.stopPrice] the price at which a trigger order is triggered at
1474
+ * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
1426
1475
  * @param {string} [params.timeInForce] *spot only* 'fok', 'ioc' or 'post_only'
1427
1476
  * @param {boolean} [params.postOnly] *spot only* true for post only orders
1477
+ * @param {float} [params.cost] *spot only* *market orders only* the cost of the order in the quote currency for market orders
1428
1478
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1429
1479
  */
1430
1480
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -1437,11 +1487,12 @@ export default class exmo extends Exchange {
1437
1487
  throw new BadRequest(this.id + ' only supports isolated margin');
1438
1488
  }
1439
1489
  const isSpot = (marginMode !== 'isolated');
1440
- const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
1490
+ const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
1491
+ const cost = this.safeString(params, 'cost');
1441
1492
  const request = {
1442
1493
  'pair': market['id'],
1443
1494
  // 'leverage': 2,
1444
- 'quantity': this.amountToPrecision(market['symbol'], amount),
1495
+ // 'quantity': this.amountToPrecision (market['symbol'], amount),
1445
1496
  // spot - buy, sell, market_buy, market_sell, market_buy_total, market_sell_total
1446
1497
  // 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
1447
1498
  // 'stop_price': this.priceToPrecision (symbol, stopPrice),
@@ -1450,6 +1501,12 @@ export default class exmo extends Exchange {
1450
1501
  // 'client_id': 123, // optional, must be a positive integer
1451
1502
  // 'comment': '', // up to 50 latin symbols, whitespaces, underscores
1452
1503
  };
1504
+ if (cost === undefined) {
1505
+ request['quantity'] = this.amountToPrecision(market['symbol'], amount);
1506
+ }
1507
+ else {
1508
+ request['quantity'] = this.costToPrecision(market['symbol'], cost);
1509
+ }
1453
1510
  let clientOrderId = this.safeValue2(params, 'client_id', 'clientOrderId');
1454
1511
  if (clientOrderId !== undefined) {
1455
1512
  clientOrderId = this.safeInteger2(params, 'client_id', 'clientOrderId');
@@ -1464,7 +1521,7 @@ export default class exmo extends Exchange {
1464
1521
  if (!isSpot && (leverage === undefined)) {
1465
1522
  throw new ArgumentsRequired(this.id + ' createOrder requires an extra param params["leverage"] for margin orders');
1466
1523
  }
1467
- params = this.omit(params, ['stopPrice', 'stop_price', 'triggerPrice', 'timeInForce', 'client_id', 'clientOrderId']);
1524
+ params = this.omit(params, ['stopPrice', 'stop_price', 'triggerPrice', 'timeInForce', 'client_id', 'clientOrderId', 'cost']);
1468
1525
  if (price !== undefined) {
1469
1526
  request['price'] = this.priceToPrecision(market['symbol'], price);
1470
1527
  }
@@ -1490,7 +1547,8 @@ export default class exmo extends Exchange {
1490
1547
  request['type'] = side;
1491
1548
  }
1492
1549
  else if (type === 'market') {
1493
- request['type'] = 'market_' + side;
1550
+ const marketSuffix = (cost !== undefined) ? '_total' : '';
1551
+ request['type'] = 'market_' + side + marketSuffix;
1494
1552
  }
1495
1553
  if (isPostOnly) {
1496
1554
  request['exec_type'] = 'post_only';
@@ -1950,7 +2008,6 @@ export default class exmo extends Exchange {
1950
2008
  'postOnly': undefined,
1951
2009
  'side': side,
1952
2010
  'price': price,
1953
- 'stopPrice': triggerPrice,
1954
2011
  'triggerPrice': triggerPrice,
1955
2012
  'cost': cost,
1956
2013
  'amount': amount,
package/js/src/gate.d.ts CHANGED
@@ -427,7 +427,7 @@ export default class gate extends Exchange {
427
427
  * @param {float} amount the amount of currency to trade
428
428
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
429
429
  * @param {object} [params] extra parameters specific to the exchange API endpoint
430
- * @param {float} [params.stopPrice] The price at which a trigger order is triggered at
430
+ * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
431
431
  * @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
432
432
  * @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
433
433
  * @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
package/js/src/gate.js CHANGED
@@ -4085,7 +4085,7 @@ export default class gate extends Exchange {
4085
4085
  * @param {float} amount the amount of currency to trade
4086
4086
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
4087
4087
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4088
- * @param {float} [params.stopPrice] The price at which a trigger order is triggered at
4088
+ * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
4089
4089
  * @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
4090
4090
  * @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
4091
4091
  * @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
@@ -4925,7 +4925,6 @@ export default class gate extends Exchange {
4925
4925
  'reduceOnly': this.safeValue(order, 'is_reduce_only'),
4926
4926
  'side': side,
4927
4927
  'price': price,
4928
- 'stopPrice': triggerPrice,
4929
4928
  'triggerPrice': triggerPrice,
4930
4929
  'average': average,
4931
4930
  'amount': Precise.stringAbs(amount),
@@ -6899,7 +6898,7 @@ export default class gate extends Exchange {
6899
6898
  // ...
6900
6899
  // ]
6901
6900
  //
6902
- return this.parseOpenInterests(response, market, since, limit);
6901
+ return this.parseOpenInterestsHistory(response, market, since, limit);
6903
6902
  }
6904
6903
  parseOpenInterest(interest, market = undefined) {
6905
6904
  //
package/js/src/gemini.js CHANGED
@@ -1347,7 +1347,6 @@ export default class gemini extends Exchange {
1347
1347
  'postOnly': postOnly,
1348
1348
  'side': side,
1349
1349
  'price': price,
1350
- 'stopPrice': undefined,
1351
1350
  'triggerPrice': undefined,
1352
1351
  'average': average,
1353
1352
  'cost': undefined,
@@ -1481,13 +1480,13 @@ export default class gemini extends Exchange {
1481
1480
  };
1482
1481
  type = this.safeString(params, 'type', type);
1483
1482
  params = this.omit(params, 'type');
1484
- const rawStopPrice = this.safeString2(params, 'stop_price', 'stopPrice');
1483
+ const triggerPrice = this.safeStringN(params, ['stop_price', 'stopPrice']);
1485
1484
  params = this.omit(params, ['stop_price', 'stopPrice', 'type']);
1486
1485
  if (type === 'stopLimit') {
1487
- throw new ArgumentsRequired(this.id + ' createOrder() requires a stopPrice parameter or a stop_price parameter for ' + type + ' orders');
1486
+ throw new ArgumentsRequired(this.id + ' createOrder() requires a triggerPrice parameter or a stop_price parameter for ' + type + ' orders');
1488
1487
  }
1489
- if (rawStopPrice !== undefined) {
1490
- request['stop_price'] = this.priceToPrecision(symbol, rawStopPrice);
1488
+ if (triggerPrice !== undefined) {
1489
+ request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
1491
1490
  request['type'] = 'exchange stop limit';
1492
1491
  }
1493
1492
  else {
package/js/src/hashkey.js CHANGED
@@ -339,6 +339,84 @@ export default class hashkey extends Exchange {
339
339
  },
340
340
  'defaultNetwork': 'ERC20',
341
341
  },
342
+ 'features': {
343
+ 'default': {
344
+ 'sandbox': true,
345
+ 'createOrder': {
346
+ 'marginMode': false,
347
+ 'triggerPrice': false,
348
+ 'triggerPriceType': undefined,
349
+ 'triggerDirection': false,
350
+ 'stopLossPrice': false,
351
+ 'takeProfitPrice': false,
352
+ 'attachedStopLossTakeProfit': undefined,
353
+ 'timeInForce': {
354
+ 'IOC': true,
355
+ 'FOK': true,
356
+ 'PO': true,
357
+ 'GTD': false,
358
+ },
359
+ 'hedged': false,
360
+ 'trailing': false,
361
+ // exchange-supported features
362
+ // 'marketBuyRequiresPrice': false,
363
+ // 'marketBuyByCost': false,
364
+ // 'selfTradePrevention': true,
365
+ // 'twap': false,
366
+ // 'iceberg': false,
367
+ // 'oco': false,
368
+ },
369
+ 'createOrders': {
370
+ 'max': 20,
371
+ },
372
+ 'fetchMyTrades': {
373
+ 'marginMode': false,
374
+ 'limit': 1000,
375
+ 'daysBack': 30,
376
+ 'untilDays': 30,
377
+ },
378
+ 'fetchOrder': {
379
+ 'marginMode': false,
380
+ 'trigger': false,
381
+ 'trailing': false,
382
+ },
383
+ 'fetchOpenOrders': {
384
+ 'marginMode': false,
385
+ 'limit': 1000,
386
+ 'trigger': false,
387
+ 'trailing': false,
388
+ },
389
+ 'fetchOrders': undefined,
390
+ 'fetchClosedOrders': undefined,
391
+ 'fetchOHLCV': {
392
+ 'limit': 1000,
393
+ },
394
+ },
395
+ 'spot': {
396
+ 'extends': 'default',
397
+ },
398
+ 'forDerivatives': {
399
+ 'extends': 'default',
400
+ 'createOrder': {
401
+ 'triggerPrice': true,
402
+ 'selfTradePrevention': true,
403
+ },
404
+ 'fetchOpenOrders': {
405
+ 'trigger': true,
406
+ 'limit': 500,
407
+ },
408
+ },
409
+ 'swap': {
410
+ 'linear': {
411
+ 'extends': 'forDerivatives',
412
+ },
413
+ 'inverse': undefined,
414
+ },
415
+ 'future': {
416
+ 'linear': undefined,
417
+ 'inverse': undefined,
418
+ },
419
+ },
342
420
  'commonCurrencies': {},
343
421
  'exceptions': {
344
422
  'exact': {
@@ -560,12 +638,7 @@ export default class hashkey extends Exchange {
560
638
  * @returns {object[]} an array of objects representing market data
561
639
  */
562
640
  async fetchMarkets(params = {}) {
563
- let symbol = undefined;
564
641
  const request = {};
565
- [symbol, params] = this.handleOptionAndParams(params, 'fetchMarkets', 'symbol');
566
- if (symbol !== undefined) {
567
- request['symbol'] = symbol;
568
- }
569
642
  const response = await this.publicGetApiV1ExchangeInfo(this.extend(request, params));
570
643
  //
571
644
  // {
@@ -1250,11 +1323,6 @@ export default class hashkey extends Exchange {
1250
1323
  if (market !== undefined) {
1251
1324
  request['symbol'] = market['id'];
1252
1325
  }
1253
- let clientOrderId = undefined;
1254
- [clientOrderId, params] = this.handleOptionAndParams(params, methodName, 'clientOrderId');
1255
- if (clientOrderId !== undefined) {
1256
- request['clientOrderId'] = clientOrderId;
1257
- }
1258
1326
  if (accountId !== undefined) {
1259
1327
  request['accountId'] = accountId;
1260
1328
  }
@@ -1614,11 +1682,6 @@ export default class hashkey extends Exchange {
1614
1682
  await this.loadMarkets();
1615
1683
  symbols = this.marketSymbols(symbols);
1616
1684
  const request = {};
1617
- let symbol = undefined;
1618
- [symbol, params] = this.handleOptionAndParams(params, 'fetchLastPrices', 'symbol');
1619
- if (symbol !== undefined) {
1620
- request['symbol'] = symbol;
1621
- }
1622
1685
  const response = await this.publicGetQuoteV1TickerPrice(this.extend(request, params));
1623
1686
  //
1624
1687
  // [
@@ -1677,11 +1740,6 @@ export default class hashkey extends Exchange {
1677
1740
  return this.parseSwapBalance(balance);
1678
1741
  }
1679
1742
  else if (marketType === 'spot') {
1680
- let accountId = undefined;
1681
- [accountId, params] = this.handleOptionAndParams(params, methodName, 'accountId');
1682
- if (accountId !== undefined) {
1683
- request['accountId'] = accountId;
1684
- }
1685
1743
  const response = await this.privateGetApiV1Account(this.extend(request, params));
1686
1744
  //
1687
1745
  // {
@@ -1961,21 +2019,11 @@ export default class hashkey extends Exchange {
1961
2019
  if (tag !== undefined) {
1962
2020
  request['addressExt'] = tag;
1963
2021
  }
1964
- let clientOrderId = undefined;
1965
- [clientOrderId, params] = this.handleOptionAndParams(params, 'withdraw', 'clientOrderId');
1966
- if (clientOrderId !== undefined) {
1967
- request['clientOrderId'] = clientOrderId;
1968
- }
1969
2022
  let networkCode = undefined;
1970
2023
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
1971
2024
  if (networkCode !== undefined) {
1972
2025
  request['chainType'] = this.networkCodeToId(networkCode);
1973
2026
  }
1974
- let platform = undefined;
1975
- [platform, params] = this.handleOptionAndParams(params, 'withdraw', 'platform');
1976
- if (platform !== undefined) {
1977
- request['platform'] = platform;
1978
- }
1979
2027
  const response = await this.privatePostApiV1AccountWithdraw(this.extend(request, params));
1980
2028
  //
1981
2029
  // {
@@ -2119,16 +2167,6 @@ export default class hashkey extends Exchange {
2119
2167
  'fromAccountId': fromAccount,
2120
2168
  'toAccountId': toAccount,
2121
2169
  };
2122
- let clientOrderId = undefined;
2123
- [clientOrderId, params] = this.handleOptionAndParams(params, 'transfer', 'clientOrderId');
2124
- if (clientOrderId !== undefined) {
2125
- request['clientOrderId'] = clientOrderId;
2126
- }
2127
- let remark = undefined;
2128
- [remark, params] = this.handleOptionAndParams(params, 'transfer', 'remark');
2129
- if (remark !== undefined) {
2130
- request['remark'] = remark;
2131
- }
2132
2170
  const response = await this.privatePostApiV1AccountAssetTransfer(this.extend(request, params));
2133
2171
  //
2134
2172
  // {
@@ -3031,11 +3069,6 @@ export default class hashkey extends Exchange {
3031
3069
  if (clientOrderId !== undefined) {
3032
3070
  request['origClientOrderId'] = clientOrderId;
3033
3071
  }
3034
- let accountId = undefined;
3035
- [accountId, params] = this.handleOptionAndParams(params, methodName, 'accountId');
3036
- if (accountId !== undefined) {
3037
- request['accountId'] = accountId;
3038
- }
3039
3072
  response = await this.privateGetApiV1SpotOrder(this.extend(request, params));
3040
3073
  //
3041
3074
  // {
@@ -3182,16 +3215,6 @@ export default class hashkey extends Exchange {
3182
3215
  if (limit !== undefined) {
3183
3216
  request['limit'] = limit;
3184
3217
  }
3185
- let orderId = undefined;
3186
- [orderId, params] = this.handleOptionAndParams(params, methodName, 'orderId');
3187
- if (orderId !== undefined) {
3188
- request['orderId'] = orderId;
3189
- }
3190
- let side = undefined;
3191
- [side, params] = this.handleOptionAndParams(params, methodName, 'side');
3192
- if (side !== undefined) {
3193
- request['side'] = side.toUpperCase();
3194
- }
3195
3218
  response = await this.privateGetApiV1SpotOpenOrders(this.extend(request, params));
3196
3219
  //
3197
3220
  // [
@@ -3262,11 +3285,6 @@ export default class hashkey extends Exchange {
3262
3285
  if (limit !== undefined) {
3263
3286
  request['limit'] = limit;
3264
3287
  }
3265
- let fromOrderId = undefined;
3266
- [fromOrderId, params] = this.handleOptionAndParams(params, methodName, 'fromOrderId');
3267
- if (fromOrderId !== undefined) {
3268
- request['fromOrderId'] = fromOrderId;
3269
- }
3270
3288
  let response = undefined;
3271
3289
  let accountId = undefined;
3272
3290
  [accountId, params] = this.handleOptionAndParams(params, methodName, 'accountId');
@@ -3372,16 +3390,6 @@ export default class hashkey extends Exchange {
3372
3390
  if (market !== undefined) {
3373
3391
  request['symbol'] = market['id'];
3374
3392
  }
3375
- let orderId = undefined;
3376
- [orderId, params] = this.handleOptionAndParams(params, methodName, 'orderId');
3377
- if (orderId !== undefined) {
3378
- request['orderId'] = orderId;
3379
- }
3380
- let side = undefined;
3381
- [side, params] = this.handleOptionAndParams(params, methodName, 'side');
3382
- if (side !== undefined) {
3383
- request['side'] = side.toUpperCase();
3384
- }
3385
3393
  if (accountId !== undefined) {
3386
3394
  request['accountId'] = accountId;
3387
3395
  }
@@ -3429,11 +3437,6 @@ export default class hashkey extends Exchange {
3429
3437
  else {
3430
3438
  request['type'] = 'LIMIT';
3431
3439
  }
3432
- let fromOrderId = undefined;
3433
- [fromOrderId, params] = this.handleOptionAndParams(params, methodName, 'fromOrderId');
3434
- if (fromOrderId !== undefined) {
3435
- request['fromOrderId'] = fromOrderId;
3436
- }
3437
3440
  if (accountId !== undefined) {
3438
3441
  request['subAccountId'] = accountId;
3439
3442
  response = await this.privateGetApiV1FuturesSubAccountHistoryOrders(this.extend(request, params));
@@ -3628,7 +3631,6 @@ export default class hashkey extends Exchange {
3628
3631
  if (feeCurrncyId === '') {
3629
3632
  feeCurrncyId = undefined;
3630
3633
  }
3631
- const triggerPrice = this.omitZero(this.safeString(order, 'stopPrice'));
3632
3634
  return this.safeOrder({
3633
3635
  'id': this.safeString(order, 'orderId'),
3634
3636
  'clientOrderId': this.safeString(order, 'clientOrderId'),
@@ -3646,8 +3648,7 @@ export default class hashkey extends Exchange {
3646
3648
  'amount': this.omitZero(this.safeString(order, 'origQty')),
3647
3649
  'filled': this.safeString(order, 'executedQty'),
3648
3650
  'remaining': undefined,
3649
- 'stopPrice': triggerPrice,
3650
- 'triggerPrice': triggerPrice,
3651
+ 'triggerPrice': this.omitZero(this.safeString(order, 'stopPrice')),
3651
3652
  'takeProfitPrice': undefined,
3652
3653
  'stopLossPrice': undefined,
3653
3654
  'cost': this.omitZero(this.safeString2(order, 'cumulativeQuoteQty', 'cummulativeQuoteQty')),
@@ -3893,11 +3894,6 @@ export default class hashkey extends Exchange {
3893
3894
  const request = {
3894
3895
  'symbol': market['id'],
3895
3896
  };
3896
- let side = undefined;
3897
- [side, params] = this.handleOptionAndParams(params, methodName, 'side');
3898
- if (side !== undefined) {
3899
- request['side'] = side.toUpperCase();
3900
- }
3901
3897
  const response = await this.privateGetApiV1FuturesPositions(this.extend(request, params));
3902
3898
  //
3903
3899
  // [
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/hitbtc.js';
2
- import type { TransferEntry, Int, OrderSide, OrderType, FundingRateHistory, OHLCV, Ticker, Order, OrderBook, Dict, Position, Str, Trade, Balances, Transaction, MarginMode, Tickers, Strings, Market, Currency, MarginModes, Leverage, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Dictionary, int, FundingRate, FundingRates, DepositAddress } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, OrderType, FundingRateHistory, OHLCV, Ticker, Order, OrderBook, Dict, Position, Str, Trade, Balances, Transaction, MarginMode, Tickers, Strings, Market, Currency, MarginModes, Leverage, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Dictionary, int, FundingRate, FundingRates, DepositAddress, OpenInterests } from './base/types.js';
3
3
  /**
4
4
  * @class hitbtc
5
5
  * @augments Exchange
@@ -443,6 +443,16 @@ export default class hitbtc extends Exchange {
443
443
  fetchPosition(symbol: string, params?: {}): Promise<Position>;
444
444
  parsePosition(position: Dict, market?: Market): Position;
445
445
  parseOpenInterest(interest: any, market?: Market): import("./base/types.js").OpenInterest;
446
+ /**
447
+ * @method
448
+ * @name hitbtc#fetchOpenInterests
449
+ * @description Retrieves the open interest for a list of symbols
450
+ * @see https://api.hitbtc.com/#futures-info
451
+ * @param {string[]} [symbols] a list of unified CCXT market symbols
452
+ * @param {object} [params] exchange specific parameters
453
+ * @returns {object[]} a list of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
454
+ */
455
+ fetchOpenInterests(symbols?: Strings, params?: {}): Promise<OpenInterests>;
446
456
  /**
447
457
  * @method
448
458
  * @name hitbtc#fetchOpenInterest
package/js/src/hitbtc.js CHANGED
@@ -78,6 +78,7 @@ export default class hitbtc extends Exchange {
78
78
  'fetchOHLCV': true,
79
79
  'fetchOpenInterest': true,
80
80
  'fetchOpenInterestHistory': false,
81
+ 'fetchOpenInterests': true,
81
82
  'fetchOpenOrder': true,
82
83
  'fetchOpenOrders': true,
83
84
  'fetchOrder': true,
@@ -2377,7 +2378,7 @@ export default class hitbtc extends Exchange {
2377
2378
  }
2378
2379
  }
2379
2380
  else if ((type === 'stopLimit') || (type === 'stopMarket') || (type === 'takeProfitLimit') || (type === 'takeProfitMarket')) {
2380
- throw new ExchangeError(this.id + ' createOrder() requires a stopPrice parameter for stop-loss and take-profit orders');
2381
+ throw new ExchangeError(this.id + ' createOrder() requires a triggerPrice parameter for stop-loss and take-profit orders');
2381
2382
  }
2382
2383
  params = this.omit(params, ['triggerPrice', 'timeInForce', 'stopPrice', 'stop_price', 'reduceOnly', 'postOnly']);
2383
2384
  if (marketType === 'swap') {
@@ -2490,7 +2491,6 @@ export default class hitbtc extends Exchange {
2490
2491
  const postOnly = this.safeValue(order, 'post_only');
2491
2492
  const timeInForce = this.safeString(order, 'time_in_force');
2492
2493
  const rawTrades = this.safeValue(order, 'trades');
2493
- const stopPrice = this.safeString(order, 'stop_price');
2494
2494
  return this.safeOrder({
2495
2495
  'info': order,
2496
2496
  'id': id,
@@ -2514,8 +2514,7 @@ export default class hitbtc extends Exchange {
2514
2514
  'average': average,
2515
2515
  'trades': rawTrades,
2516
2516
  'fee': undefined,
2517
- 'stopPrice': stopPrice,
2518
- 'triggerPrice': stopPrice,
2517
+ 'triggerPrice': this.safeString(order, 'stop_price'),
2519
2518
  'takeProfitPrice': undefined,
2520
2519
  'stopLossPrice': undefined,
2521
2520
  }, market);
@@ -3116,7 +3115,7 @@ export default class hitbtc extends Exchange {
3116
3115
  const datetime = this.safeString(interest, 'timestamp');
3117
3116
  const value = this.safeNumber(interest, 'open_interest');
3118
3117
  return this.safeOpenInterest({
3119
- 'symbol': market['symbol'],
3118
+ 'symbol': this.safeSymbol(undefined, market),
3120
3119
  'openInterestAmount': undefined,
3121
3120
  'openInterestValue': value,
3122
3121
  'timestamp': this.parse8601(datetime),
@@ -3124,6 +3123,51 @@ export default class hitbtc extends Exchange {
3124
3123
  'info': interest,
3125
3124
  }, market);
3126
3125
  }
3126
+ /**
3127
+ * @method
3128
+ * @name hitbtc#fetchOpenInterests
3129
+ * @description Retrieves the open interest for a list of symbols
3130
+ * @see https://api.hitbtc.com/#futures-info
3131
+ * @param {string[]} [symbols] a list of unified CCXT market symbols
3132
+ * @param {object} [params] exchange specific parameters
3133
+ * @returns {object[]} a list of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
3134
+ */
3135
+ async fetchOpenInterests(symbols = undefined, params = {}) {
3136
+ await this.loadMarkets();
3137
+ const request = {};
3138
+ symbols = this.marketSymbols(symbols);
3139
+ let marketIds = undefined;
3140
+ if (symbols !== undefined) {
3141
+ marketIds = this.marketIds(symbols);
3142
+ request['symbols'] = marketIds.join(',');
3143
+ }
3144
+ const response = await this.publicGetPublicFuturesInfo(this.extend(request, params));
3145
+ //
3146
+ // {
3147
+ // "BTCUSDT_PERP": {
3148
+ // "contract_type": "perpetual",
3149
+ // "mark_price": "97291.83",
3150
+ // "index_price": "97298.61",
3151
+ // "funding_rate": "-0.000183473092423284",
3152
+ // "open_interest": "94.1503",
3153
+ // "next_funding_time": "2024-12-20T08:00:00.000Z",
3154
+ // "indicative_funding_rate": "-0.00027495203277752",
3155
+ // "premium_index": "-0.000789474900583786",
3156
+ // "avg_premium_index": "-0.000683473092423284",
3157
+ // "interest_rate": "0.0001",
3158
+ // "timestamp": "2024-12-20T04:57:33.693Z"
3159
+ // }
3160
+ // }
3161
+ //
3162
+ const results = [];
3163
+ const markets = Object.keys(response);
3164
+ for (let i = 0; i < markets.length; i++) {
3165
+ const marketId = markets[i];
3166
+ const marketInner = this.safeMarket(marketId);
3167
+ results.push(this.parseOpenInterest(response[marketId], marketInner));
3168
+ }
3169
+ return this.filterByArray(results, 'symbol', symbols);
3170
+ }
3127
3171
  /**
3128
3172
  * @method
3129
3173
  * @name hitbtc#fetchOpenInterest
package/js/src/hollaex.js CHANGED
@@ -1109,7 +1109,6 @@ export default class hollaex extends Exchange {
1109
1109
  const type = this.safeString(order, 'type');
1110
1110
  const side = this.safeString(order, 'side');
1111
1111
  const price = this.safeString(order, 'price');
1112
- const stopPrice = this.safeString(order, 'stop');
1113
1112
  const amount = this.safeString(order, 'size');
1114
1113
  const filled = this.safeString(order, 'filled');
1115
1114
  const status = this.parseOrderStatus(this.safeString(order, 'status'));
@@ -1128,8 +1127,7 @@ export default class hollaex extends Exchange {
1128
1127
  'postOnly': postOnly,
1129
1128
  'side': side,
1130
1129
  'price': price,
1131
- 'stopPrice': stopPrice,
1132
- 'triggerPrice': stopPrice,
1130
+ 'triggerPrice': this.safeString(order, 'stop'),
1133
1131
  'amount': amount,
1134
1132
  'filled': filled,
1135
1133
  'remaining': undefined,
@@ -1167,7 +1165,7 @@ export default class hollaex extends Exchange {
1167
1165
  // 'stop': parseFloat (this.priceToPrecision (symbol, stopPrice)),
1168
1166
  // 'meta': {}, // other options such as post_only
1169
1167
  };
1170
- const stopPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'stop']);
1168
+ const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'stop']);
1171
1169
  const meta = this.safeValue(params, 'meta', {});
1172
1170
  const exchangeSpecificParam = this.safeBool(meta, 'post_only', false);
1173
1171
  const isMarketOrder = type === 'market';
@@ -1176,8 +1174,8 @@ export default class hollaex extends Exchange {
1176
1174
  const convertedPrice = parseFloat(this.priceToPrecision(symbol, price));
1177
1175
  request['price'] = this.normalizeNumberIfNeeded(convertedPrice);
1178
1176
  }
1179
- if (stopPrice !== undefined) {
1180
- request['stop'] = this.normalizeNumberIfNeeded(parseFloat(this.priceToPrecision(symbol, stopPrice)));
1177
+ if (triggerPrice !== undefined) {
1178
+ request['stop'] = this.normalizeNumberIfNeeded(parseFloat(this.priceToPrecision(symbol, triggerPrice)));
1181
1179
  }
1182
1180
  if (postOnly) {
1183
1181
  request['meta'] = { 'post_only': true };
package/js/src/htx.js CHANGED
@@ -5265,7 +5265,6 @@ export default class htx extends Exchange {
5265
5265
  'currency': feeCurrency,
5266
5266
  };
5267
5267
  }
5268
- const stopPrice = this.safeString2(order, 'stop-price', 'trigger_price');
5269
5268
  const average = this.safeString(order, 'trade_avg_price');
5270
5269
  const trades = this.safeValue(order, 'trades');
5271
5270
  const reduceOnlyInteger = this.safeInteger(order, 'reduce_only');
@@ -5286,8 +5285,7 @@ export default class htx extends Exchange {
5286
5285
  'postOnly': undefined,
5287
5286
  'side': side,
5288
5287
  'price': price,
5289
- 'stopPrice': stopPrice,
5290
- 'triggerPrice': stopPrice,
5288
+ 'triggerPrice': this.safeString2(order, 'stop-price', 'trigger_price'),
5291
5289
  'average': average,
5292
5290
  'cost': cost,
5293
5291
  'amount': amount,
@@ -8643,7 +8641,7 @@ export default class htx extends Exchange {
8643
8641
  //
8644
8642
  const data = this.safeValue(response, 'data');
8645
8643
  const tick = this.safeList(data, 'tick');
8646
- return this.parseOpenInterests(tick, market, since, limit);
8644
+ return this.parseOpenInterestsHistory(tick, market, since, limit);
8647
8645
  }
8648
8646
  /**
8649
8647
  * @method
package/js/src/huobijp.js CHANGED
@@ -1354,7 +1354,6 @@ export default class huobijp extends Exchange {
1354
1354
  'postOnly': undefined,
1355
1355
  'side': side,
1356
1356
  'price': price,
1357
- 'stopPrice': undefined,
1358
1357
  'triggerPrice': undefined,
1359
1358
  'average': undefined,
1360
1359
  'cost': cost,