ccxt 4.4.41 → 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 (170) 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 +21 -16
  8. package/dist/cjs/src/bigone.js +0 -1
  9. package/dist/cjs/src/binance.js +3 -0
  10. package/dist/cjs/src/bingx.js +3 -0
  11. package/dist/cjs/src/bitfinex.js +123 -0
  12. package/dist/cjs/src/blofin.js +16 -7
  13. package/dist/cjs/src/cex.js +1 -1
  14. package/dist/cjs/src/coinbase.js +8 -9
  15. package/dist/cjs/src/coinbaseexchange.js +5 -6
  16. package/dist/cjs/src/coinbaseinternational.js +7 -8
  17. package/dist/cjs/src/coincatch.js +0 -1
  18. package/dist/cjs/src/coincheck.js +0 -1
  19. package/dist/cjs/src/coinex.js +91 -6
  20. package/dist/cjs/src/coinlist.js +3 -4
  21. package/dist/cjs/src/coinmate.js +1 -3
  22. package/dist/cjs/src/coinmetro.js +4 -5
  23. package/dist/cjs/src/coinone.js +0 -1
  24. package/dist/cjs/src/coinsph.js +7 -8
  25. package/dist/cjs/src/cryptocom.js +3 -0
  26. package/dist/cjs/src/currencycom.js +3 -4
  27. package/dist/cjs/src/defx.js +6 -7
  28. package/dist/cjs/src/deribit.js +1 -3
  29. package/dist/cjs/src/digifinex.js +0 -1
  30. package/dist/cjs/src/ellipx.js +0 -2
  31. package/dist/cjs/src/exmo.js +1 -2
  32. package/dist/cjs/src/gate.js +1 -2
  33. package/dist/cjs/src/gemini.js +4 -5
  34. package/dist/cjs/src/hashkey.js +79 -83
  35. package/dist/cjs/src/hitbtc.js +49 -5
  36. package/dist/cjs/src/hollaex.js +4 -6
  37. package/dist/cjs/src/htx.js +1 -3
  38. package/dist/cjs/src/huobijp.js +0 -1
  39. package/dist/cjs/src/idex.js +8 -8
  40. package/dist/cjs/src/independentreserve.js +0 -1
  41. package/dist/cjs/src/indodax.js +0 -1
  42. package/dist/cjs/src/kraken.js +63 -3
  43. package/dist/cjs/src/krakenfutures.js +75 -3
  44. package/dist/cjs/src/kucoin.js +1 -3
  45. package/dist/cjs/src/kucoinfutures.js +10 -9
  46. package/dist/cjs/src/kuna.js +1 -3
  47. package/dist/cjs/src/latoken.js +1 -3
  48. package/dist/cjs/src/lbank.js +0 -1
  49. package/dist/cjs/src/luno.js +0 -1
  50. package/dist/cjs/src/lykke.js +0 -1
  51. package/dist/cjs/src/mercado.js +0 -1
  52. package/dist/cjs/src/mexc.js +3 -4
  53. package/dist/cjs/src/ndax.js +1 -1
  54. package/dist/cjs/src/novadax.js +4 -6
  55. package/dist/cjs/src/oceanex.js +0 -1
  56. package/dist/cjs/src/okcoin.js +1 -3
  57. package/dist/cjs/src/okx.js +1 -3
  58. package/dist/cjs/src/onetrading.js +1 -3
  59. package/dist/cjs/src/p2b.js +1 -1
  60. package/dist/cjs/src/paradex.js +5 -7
  61. package/dist/cjs/src/phemex.js +8 -10
  62. package/dist/cjs/src/poloniex.js +1 -3
  63. package/dist/cjs/src/poloniexfutures.js +6 -6
  64. package/dist/cjs/src/probit.js +0 -1
  65. package/dist/cjs/src/timex.js +0 -1
  66. package/dist/cjs/src/tokocrypto.js +11 -14
  67. package/dist/cjs/src/tradeogre.js +1 -1
  68. package/dist/cjs/src/upbit.js +0 -1
  69. package/dist/cjs/src/wavesexchange.js +4 -5
  70. package/dist/cjs/src/whitebit.js +8 -9
  71. package/dist/cjs/src/woo.js +99 -13
  72. package/dist/cjs/src/woofipro.js +96 -15
  73. package/dist/cjs/src/xt.js +3 -2
  74. package/dist/cjs/src/yobit.js +0 -1
  75. package/dist/cjs/src/zaif.js +0 -1
  76. package/dist/cjs/src/zonda.js +1 -2
  77. package/js/ccxt.d.ts +1 -1
  78. package/js/ccxt.js +1 -1
  79. package/js/src/abstract/binance.d.ts +3 -0
  80. package/js/src/abstract/binancecoinm.d.ts +3 -0
  81. package/js/src/abstract/binanceus.d.ts +3 -0
  82. package/js/src/abstract/binanceusdm.d.ts +3 -0
  83. package/js/src/ace.js +1 -1
  84. package/js/src/alpaca.js +0 -1
  85. package/js/src/ascendex.js +0 -1
  86. package/js/src/base/Exchange.d.ts +6 -6
  87. package/js/src/base/Exchange.js +21 -16
  88. package/js/src/bigone.js +0 -1
  89. package/js/src/binance.js +3 -0
  90. package/js/src/bingx.js +3 -0
  91. package/js/src/bitfinex.d.ts +11 -1
  92. package/js/src/bitfinex.js +123 -0
  93. package/js/src/blofin.d.ts +1 -1
  94. package/js/src/blofin.js +16 -7
  95. package/js/src/cex.js +1 -1
  96. package/js/src/coinbase.js +8 -9
  97. package/js/src/coinbaseexchange.js +5 -6
  98. package/js/src/coinbaseinternational.d.ts +1 -1
  99. package/js/src/coinbaseinternational.js +7 -8
  100. package/js/src/coincatch.js +0 -1
  101. package/js/src/coincheck.js +0 -1
  102. package/js/src/coinex.js +91 -6
  103. package/js/src/coinlist.js +3 -4
  104. package/js/src/coinmate.js +1 -3
  105. package/js/src/coinmetro.js +4 -5
  106. package/js/src/coinone.js +0 -1
  107. package/js/src/coinsph.js +7 -8
  108. package/js/src/cryptocom.js +3 -0
  109. package/js/src/currencycom.js +3 -4
  110. package/js/src/defx.js +6 -7
  111. package/js/src/deribit.js +1 -3
  112. package/js/src/digifinex.js +0 -1
  113. package/js/src/ellipx.js +0 -2
  114. package/js/src/exmo.d.ts +1 -1
  115. package/js/src/exmo.js +1 -2
  116. package/js/src/gate.d.ts +1 -1
  117. package/js/src/gate.js +1 -2
  118. package/js/src/gemini.js +4 -5
  119. package/js/src/hashkey.js +79 -83
  120. package/js/src/hitbtc.d.ts +11 -1
  121. package/js/src/hitbtc.js +49 -5
  122. package/js/src/hollaex.js +4 -6
  123. package/js/src/htx.js +1 -3
  124. package/js/src/huobijp.js +0 -1
  125. package/js/src/idex.js +8 -8
  126. package/js/src/independentreserve.js +0 -1
  127. package/js/src/indodax.js +0 -1
  128. package/js/src/kraken.d.ts +2 -2
  129. package/js/src/kraken.js +63 -3
  130. package/js/src/krakenfutures.d.ts +2 -2
  131. package/js/src/krakenfutures.js +75 -3
  132. package/js/src/kucoin.js +1 -3
  133. package/js/src/kucoinfutures.d.ts +5 -4
  134. package/js/src/kucoinfutures.js +10 -9
  135. package/js/src/kuna.js +1 -3
  136. package/js/src/latoken.js +1 -3
  137. package/js/src/lbank.js +0 -1
  138. package/js/src/luno.js +0 -1
  139. package/js/src/lykke.js +0 -1
  140. package/js/src/mercado.js +0 -1
  141. package/js/src/mexc.js +3 -4
  142. package/js/src/ndax.js +1 -1
  143. package/js/src/novadax.js +4 -6
  144. package/js/src/oceanex.js +0 -1
  145. package/js/src/okcoin.js +1 -3
  146. package/js/src/okx.js +1 -3
  147. package/js/src/onetrading.js +1 -3
  148. package/js/src/p2b.js +1 -1
  149. package/js/src/paradex.d.ts +1 -1
  150. package/js/src/paradex.js +5 -7
  151. package/js/src/phemex.js +8 -10
  152. package/js/src/poloniex.js +1 -3
  153. package/js/src/poloniexfutures.js +6 -6
  154. package/js/src/probit.js +0 -1
  155. package/js/src/timex.js +0 -1
  156. package/js/src/tokocrypto.js +11 -14
  157. package/js/src/tradeogre.js +1 -1
  158. package/js/src/upbit.js +0 -1
  159. package/js/src/wavesexchange.d.ts +1 -1
  160. package/js/src/wavesexchange.js +4 -5
  161. package/js/src/whitebit.js +8 -9
  162. package/js/src/woo.d.ts +1 -1
  163. package/js/src/woo.js +99 -13
  164. package/js/src/woofipro.js +96 -15
  165. package/js/src/xt.d.ts +2 -1
  166. package/js/src/xt.js +3 -2
  167. package/js/src/yobit.js +0 -1
  168. package/js/src/zaif.js +0 -1
  169. package/js/src/zonda.js +1 -2
  170. package/package.json +1 -1
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,
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,
package/js/src/idex.js CHANGED
@@ -1123,7 +1123,6 @@ export default class idex extends Exchange {
1123
1123
  'postOnly': undefined,
1124
1124
  'side': side,
1125
1125
  'price': price,
1126
- 'stopPrice': undefined,
1127
1126
  'triggerPrice': undefined,
1128
1127
  'amount': amount,
1129
1128
  'cost': undefined,
@@ -1188,12 +1187,13 @@ export default class idex extends Exchange {
1188
1187
  'takeProfit': 5,
1189
1188
  'takeProfitLimit': 6,
1190
1189
  };
1191
- let stopPriceString = undefined;
1192
- if ((type === 'stopLossLimit') || (type === 'takeProfitLimit') || ('stopPrice' in params)) {
1193
- if (!('stopPrice' in params)) {
1194
- throw new BadRequest(this.id + ' createOrder() stopPrice is a required parameter for ' + type + 'orders');
1190
+ const triggerPrice = this.safeString(params, 'triggerPrice', 'stopPrice');
1191
+ let triggerPriceString = undefined;
1192
+ if ((type === 'stopLossLimit') || (type === 'takeProfitLimit')) {
1193
+ if (triggerPrice === undefined) {
1194
+ throw new BadRequest(this.id + ' createOrder() triggerPrice is a required parameter for ' + type + 'orders');
1195
1195
  }
1196
- stopPriceString = this.priceToPrecision(symbol, params['stopPrice']);
1196
+ triggerPriceString = this.priceToPrecision(symbol, triggerPrice);
1197
1197
  }
1198
1198
  const limitTypeEnums = {
1199
1199
  'limit': 1,
@@ -1283,7 +1283,7 @@ export default class idex extends Exchange {
1283
1283
  byteArray.push(encodedPrice);
1284
1284
  }
1285
1285
  if (type in stopLossTypeEnums) {
1286
- const encodedPrice = this.encode(stopPriceString || priceString);
1286
+ const encodedPrice = this.encode(triggerPriceString || priceString);
1287
1287
  byteArray.push(encodedPrice);
1288
1288
  }
1289
1289
  const clientOrderId = this.safeString(params, 'clientOrderId');
@@ -1317,7 +1317,7 @@ export default class idex extends Exchange {
1317
1317
  request['parameters']['price'] = priceString;
1318
1318
  }
1319
1319
  if (type in stopLossTypeEnums) {
1320
- request['parameters']['stopPrice'] = stopPriceString || priceString;
1320
+ request['parameters']['stopPrice'] = triggerPriceString || priceString;
1321
1321
  }
1322
1322
  if (amountEnum === 0) {
1323
1323
  request['parameters']['quantity'] = amountString;
@@ -457,7 +457,6 @@ export default class independentreserve extends Exchange {
457
457
  'postOnly': undefined,
458
458
  'side': side,
459
459
  'price': this.safeString(order, 'Price'),
460
- 'stopPrice': undefined,
461
460
  'triggerPrice': undefined,
462
461
  'cost': this.safeString(order, 'Value'),
463
462
  'average': this.safeString(order, 'AvgPrice'),
package/js/src/indodax.js CHANGED
@@ -719,7 +719,6 @@ export default class indodax extends Exchange {
719
719
  'postOnly': undefined,
720
720
  'side': side,
721
721
  'price': price,
722
- 'stopPrice': undefined,
723
722
  'triggerPrice': undefined,
724
723
  'cost': cost,
725
724
  'average': undefined,
@@ -99,7 +99,7 @@ export default class kraken extends Exchange {
99
99
  * @method
100
100
  * @name kraken#fetchOHLCV
101
101
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
102
- * @see https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getOHLCData
102
+ * @see https://docs.kraken.com/api/docs/rest-api/get-ohlc-data
103
103
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
104
104
  * @param {string} timeframe the length of time each candle represents
105
105
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -266,7 +266,7 @@ export default class kraken extends Exchange {
266
266
  * @method
267
267
  * @name kraken#fetchMyTrades
268
268
  * @description fetch all trades made by the user
269
- * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getTradeHistory
269
+ * @see https://docs.kraken.com/api/docs/rest-api/get-trade-history
270
270
  * @param {string} symbol unified market symbol
271
271
  * @param {int} [since] the earliest time in ms to fetch trades for
272
272
  * @param {int} [limit] the maximum number of trades structures to retrieve
package/js/src/kraken.js CHANGED
@@ -430,6 +430,67 @@ export default class kraken extends Exchange {
430
430
  'Celestia': 'TIA',
431
431
  },
432
432
  },
433
+ 'features': {
434
+ 'spot': {
435
+ 'sandbox': false,
436
+ 'createOrder': {
437
+ 'marginMode': false,
438
+ 'triggerPrice': false,
439
+ 'triggerPriceType': undefined,
440
+ 'triggerDirection': false,
441
+ 'stopLossPrice': true,
442
+ 'takeProfitPrice': true,
443
+ 'attachedStopLossTakeProfit': undefined,
444
+ 'timeInForce': {
445
+ 'IOC': true,
446
+ 'FOK': true,
447
+ 'PO': true,
448
+ 'GTD': false,
449
+ },
450
+ 'hedged': false,
451
+ 'trailing': true,
452
+ },
453
+ 'createOrders': undefined,
454
+ 'fetchMyTrades': {
455
+ 'marginMode': false,
456
+ 'limit': undefined,
457
+ 'daysBack': undefined,
458
+ 'untilDays': undefined,
459
+ },
460
+ 'fetchOrder': {
461
+ 'marginMode': false,
462
+ 'trigger': false,
463
+ 'trailing': false,
464
+ },
465
+ 'fetchOpenOrders': {
466
+ 'marginMode': false,
467
+ 'limit': undefined,
468
+ 'trigger': false,
469
+ 'trailing': false,
470
+ },
471
+ 'fetchOrders': undefined,
472
+ 'fetchClosedOrders': {
473
+ 'marginMode': false,
474
+ 'limit': undefined,
475
+ 'daysBackClosed': undefined,
476
+ 'daysBackCanceled': undefined,
477
+ 'untilDays': 100000,
478
+ 'trigger': false,
479
+ 'trailing': false,
480
+ },
481
+ 'fetchOHLCV': {
482
+ 'limit': 720,
483
+ },
484
+ },
485
+ 'swap': {
486
+ 'linear': undefined,
487
+ 'inverse': undefined,
488
+ },
489
+ 'future': {
490
+ 'linear': undefined,
491
+ 'inverse': undefined,
492
+ },
493
+ },
433
494
  'precisionMode': TICK_SIZE,
434
495
  'exceptions': {
435
496
  'exact': {
@@ -1011,7 +1072,7 @@ export default class kraken extends Exchange {
1011
1072
  * @method
1012
1073
  * @name kraken#fetchOHLCV
1013
1074
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1014
- * @see https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getOHLCData
1075
+ * @see https://docs.kraken.com/api/docs/rest-api/get-ohlc-data
1015
1076
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1016
1077
  * @param {string} timeframe the length of time each candle represents
1017
1078
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -1836,7 +1897,6 @@ export default class kraken extends Exchange {
1836
1897
  'postOnly': isPostOnly,
1837
1898
  'side': side,
1838
1899
  'price': price,
1839
- 'stopPrice': triggerPrice,
1840
1900
  'triggerPrice': triggerPrice,
1841
1901
  'takeProfitPrice': takeProfitPrice,
1842
1902
  'stopLossPrice': stopLossPrice,
@@ -2235,7 +2295,7 @@ export default class kraken extends Exchange {
2235
2295
  * @method
2236
2296
  * @name kraken#fetchMyTrades
2237
2297
  * @description fetch all trades made by the user
2238
- * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getTradeHistory
2298
+ * @see https://docs.kraken.com/api/docs/rest-api/get-trade-history
2239
2299
  * @param {string} symbol unified market symbol
2240
2300
  * @param {int} [since] the earliest time in ms to fetch trades for
2241
2301
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -74,7 +74,7 @@ export default class krakenfutures extends Exchange {
74
74
  * @method
75
75
  * @name krakenfutures#createOrder
76
76
  * @description Create an order on the exchange
77
- * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-send-order
77
+ * @see https://docs.kraken.com/api/docs/futures-api/trading/send-order
78
78
  * @param {string} symbol unified market symbol
79
79
  * @param {string} type 'limit' or 'market'
80
80
  * @param {string} side 'buy' or 'sell'
@@ -95,7 +95,7 @@ export default class krakenfutures extends Exchange {
95
95
  * @method
96
96
  * @name krakenfutures#createOrders
97
97
  * @description create a list of trade orders
98
- * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-batch-order-management
98
+ * @see https://docs.kraken.com/api/docs/futures-api/trading/send-batch-order
99
99
  * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
100
100
  * @param {object} [params] extra parameters specific to the exchange API endpoint
101
101
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}