ccxt 4.2.13 → 4.2.14

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 (47) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +624 -130
  3. package/dist/ccxt.browser.min.js +7 -7
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/js/ccxt.js +1 -1
  6. package/dist/cjs/js/src/base/Exchange.js +148 -1
  7. package/dist/cjs/js/src/bigone.js +36 -32
  8. package/dist/cjs/js/src/binance.js +108 -0
  9. package/dist/cjs/js/src/binanceus.js +8 -0
  10. package/dist/cjs/js/src/bingx.js +4 -0
  11. package/dist/cjs/js/src/bitget.js +4 -0
  12. package/dist/cjs/js/src/bybit.js +4 -0
  13. package/dist/cjs/js/src/coinex.js +3 -0
  14. package/dist/cjs/js/src/delta.js +7 -1
  15. package/dist/cjs/js/src/gate.js +5 -0
  16. package/dist/cjs/js/src/htx.js +126 -1
  17. package/dist/cjs/js/src/kraken.js +19 -7
  18. package/dist/cjs/js/src/kucoin.js +5 -0
  19. package/dist/cjs/js/src/kucoinfutures.js +131 -77
  20. package/dist/cjs/js/src/okx.js +9 -8
  21. package/dist/cjs/js/src/woo.js +6 -2
  22. package/js/ccxt.d.ts +1 -1
  23. package/js/ccxt.js +1 -1
  24. package/js/src/abstract/bigone.d.ts +1 -0
  25. package/js/src/abstract/kucoin.d.ts +4 -0
  26. package/js/src/abstract/kucoinfutures.d.ts +4 -0
  27. package/js/src/base/Exchange.d.ts +8 -0
  28. package/js/src/base/Exchange.js +148 -1
  29. package/js/src/bigone.js +36 -32
  30. package/js/src/binance.d.ts +9 -0
  31. package/js/src/binance.js +108 -0
  32. package/js/src/binanceus.js +8 -0
  33. package/js/src/bingx.js +4 -0
  34. package/js/src/bitget.js +4 -0
  35. package/js/src/bybit.js +4 -0
  36. package/js/src/coinex.js +3 -0
  37. package/js/src/delta.js +7 -1
  38. package/js/src/gate.js +5 -0
  39. package/js/src/htx.d.ts +9 -0
  40. package/js/src/htx.js +126 -1
  41. package/js/src/kraken.js +19 -7
  42. package/js/src/kucoin.js +5 -0
  43. package/js/src/kucoinfutures.d.ts +4 -2
  44. package/js/src/kucoinfutures.js +131 -77
  45. package/js/src/okx.js +9 -8
  46. package/js/src/woo.js +6 -2
  47. package/package.json +1 -1
@@ -7352,13 +7352,17 @@ class Exchange {
7352
7352
  'createMarketOrderWithCost': undefined,
7353
7353
  'createMarketSellOrderWithCost': undefined,
7354
7354
  'createOrders': undefined,
7355
+ 'createOrderWithTakeProfitAndStopLoss': undefined,
7355
7356
  'createPostOnlyOrder': undefined,
7356
7357
  'createReduceOnlyOrder': undefined,
7358
+ 'createStopLossOrder': undefined,
7357
7359
  'createStopOrder': undefined,
7358
7360
  'createStopLimitOrder': undefined,
7359
7361
  'createStopMarketOrder': undefined,
7362
+ 'createTakeProfitOrder': undefined,
7360
7363
  'createTrailingAmountOrder': undefined,
7361
7364
  'createTrailingPercentOrder': undefined,
7365
+ 'createTriggerOrder': undefined,
7362
7366
  'createOrderWs': undefined,
7363
7367
  'editOrderWs': undefined,
7364
7368
  'fetchOpenOrdersWs': undefined,
@@ -10861,11 +10865,154 @@ class Exchange {
10861
10865
  * @param {object} [params] extra parameters specific to the exchange API endpoint
10862
10866
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
10863
10867
  */
10864
- if (this.options['createMarketSellOrderRequiresPrice'] || this.options['createMarketSellOrderWithCost']) {
10868
+ if (this.options['createMarketSellOrderRequiresPrice'] || this.has['createMarketSellOrderWithCost']) {
10865
10869
  return await this.createOrder(symbol, 'market', 'sell', cost, 1, params);
10866
10870
  }
10867
10871
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createMarketSellOrderWithCost() is not supported yet');
10868
10872
  }
10873
+ async createTriggerOrder(symbol, type, side, amount, price = undefined, triggerPrice = undefined, params = {}) {
10874
+ /**
10875
+ * @method
10876
+ * @name createTriggerOrder
10877
+ * @description create a trigger stop order (type 1)
10878
+ * @param {string} symbol unified symbol of the market to create an order in
10879
+ * @param {string} type 'market' or 'limit'
10880
+ * @param {string} side 'buy' or 'sell'
10881
+ * @param {float} amount how much you want to trade in units of the base currency or the number of contracts
10882
+ * @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
10883
+ * @param {float} triggerPrice the price to trigger the stop order, in units of the quote currency
10884
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
10885
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
10886
+ */
10887
+ if (triggerPrice === undefined) {
10888
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' createTriggerOrder() requires a triggerPrice argument');
10889
+ }
10890
+ params['triggerPrice'] = triggerPrice;
10891
+ if (this.has['createTriggerOrder']) {
10892
+ return await this.createOrder(symbol, type, side, amount, price, params);
10893
+ }
10894
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createTriggerOrder() is not supported yet');
10895
+ }
10896
+ async createStopLossOrder(symbol, type, side, amount, price = undefined, stopLossPrice = undefined, params = {}) {
10897
+ /**
10898
+ * @method
10899
+ * @name createStopLossOrder
10900
+ * @description create a trigger stop loss order (type 2)
10901
+ * @param {string} symbol unified symbol of the market to create an order in
10902
+ * @param {string} type 'market' or 'limit'
10903
+ * @param {string} side 'buy' or 'sell'
10904
+ * @param {float} amount how much you want to trade in units of the base currency or the number of contracts
10905
+ * @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
10906
+ * @param {float} stopLossPrice the price to trigger the stop loss order, in units of the quote currency
10907
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
10908
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
10909
+ */
10910
+ if (stopLossPrice === undefined) {
10911
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' createStopLossOrder() requires a stopLossPrice argument');
10912
+ }
10913
+ params['stopLossPrice'] = stopLossPrice;
10914
+ if (this.has['createStopLossOrder']) {
10915
+ return await this.createOrder(symbol, type, side, amount, price, params);
10916
+ }
10917
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createStopLossOrder() is not supported yet');
10918
+ }
10919
+ async createTakeProfitOrder(symbol, type, side, amount, price = undefined, takeProfitPrice = undefined, params = {}) {
10920
+ /**
10921
+ * @method
10922
+ * @name createTakeProfitOrder
10923
+ * @description create a trigger take profit order (type 2)
10924
+ * @param {string} symbol unified symbol of the market to create an order in
10925
+ * @param {string} type 'market' or 'limit'
10926
+ * @param {string} side 'buy' or 'sell'
10927
+ * @param {float} amount how much you want to trade in units of the base currency or the number of contracts
10928
+ * @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
10929
+ * @param {float} takeProfitPrice the price to trigger the take profit order, in units of the quote currency
10930
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
10931
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
10932
+ */
10933
+ if (takeProfitPrice === undefined) {
10934
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' createTakeProfitOrder() requires a takeProfitPrice argument');
10935
+ }
10936
+ params['takeProfitPrice'] = takeProfitPrice;
10937
+ if (this.has['createTakeProfitOrder']) {
10938
+ return await this.createOrder(symbol, type, side, amount, price, params);
10939
+ }
10940
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createTakeProfitOrder() is not supported yet');
10941
+ }
10942
+ async createOrderWithTakeProfitAndStopLoss(symbol, type, side, amount, price = undefined, takeProfit = undefined, stopLoss = undefined, params = {}) {
10943
+ /**
10944
+ * @method
10945
+ * @name createOrderWithTakeProfitAndStopLoss
10946
+ * @description create an order with a stop loss or take profit attached (type 3)
10947
+ * @param {string} symbol unified symbol of the market to create an order in
10948
+ * @param {string} type 'market' or 'limit'
10949
+ * @param {string} side 'buy' or 'sell'
10950
+ * @param {float} amount how much you want to trade in units of the base currency or the number of contracts
10951
+ * @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
10952
+ * @param {float} [takeProfit] the take profit price, in units of the quote currency
10953
+ * @param {float} [stopLoss] the stop loss price, in units of the quote currency
10954
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
10955
+ * @param {string} [params.takeProfitType] *not available on all exchanges* 'limit' or 'market'
10956
+ * @param {string} [params.stopLossType] *not available on all exchanges* 'limit' or 'market'
10957
+ * @param {string} [params.takeProfitPriceType] *not available on all exchanges* 'last', 'mark' or 'index'
10958
+ * @param {string} [params.stopLossPriceType] *not available on all exchanges* 'last', 'mark' or 'index'
10959
+ * @param {float} [params.takeProfitLimitPrice] *not available on all exchanges* limit price for a limit take profit order
10960
+ * @param {float} [params.stopLossLimitPrice] *not available on all exchanges* stop loss for a limit stop loss order
10961
+ * @param {float} [params.takeProfitAmount] *not available on all exchanges* the amount for a take profit
10962
+ * @param {float} [params.stopLossAmount] *not available on all exchanges* the amount for a stop loss
10963
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
10964
+ */
10965
+ if ((takeProfit === undefined) && (stopLoss === undefined)) {
10966
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' createOrderWithTakeProfitAndStopLoss() requires either a takeProfit or stopLoss argument');
10967
+ }
10968
+ if (takeProfit !== undefined) {
10969
+ params['takeProfit'] = {
10970
+ 'triggerPrice': takeProfit,
10971
+ };
10972
+ }
10973
+ if (stopLoss !== undefined) {
10974
+ params['stopLoss'] = {
10975
+ 'triggerPrice': stopLoss,
10976
+ };
10977
+ }
10978
+ const takeProfitType = this.safeString(params, 'takeProfitType');
10979
+ const takeProfitPriceType = this.safeString(params, 'takeProfitPriceType');
10980
+ const takeProfitLimitPrice = this.safeString(params, 'takeProfitLimitPrice');
10981
+ const takeProfitAmount = this.safeString(params, 'takeProfitAmount');
10982
+ const stopLossType = this.safeString(params, 'stopLossType');
10983
+ const stopLossPriceType = this.safeString(params, 'stopLossPriceType');
10984
+ const stopLossLimitPrice = this.safeString(params, 'stopLossLimitPrice');
10985
+ const stopLossAmount = this.safeString(params, 'stopLossAmount');
10986
+ if (takeProfitType !== undefined) {
10987
+ params['takeProfit']['type'] = takeProfitType;
10988
+ }
10989
+ if (takeProfitPriceType !== undefined) {
10990
+ params['takeProfit']['priceType'] = takeProfitPriceType;
10991
+ }
10992
+ if (takeProfitLimitPrice !== undefined) {
10993
+ params['takeProfit']['price'] = this.parseToNumeric(takeProfitLimitPrice);
10994
+ }
10995
+ if (takeProfitAmount !== undefined) {
10996
+ params['takeProfit']['amount'] = this.parseToNumeric(takeProfitAmount);
10997
+ }
10998
+ if (stopLossType !== undefined) {
10999
+ params['stopLoss']['type'] = stopLossType;
11000
+ }
11001
+ if (stopLossPriceType !== undefined) {
11002
+ params['stopLoss']['priceType'] = stopLossPriceType;
11003
+ }
11004
+ if (stopLossLimitPrice !== undefined) {
11005
+ params['stopLoss']['price'] = this.parseToNumeric(stopLossLimitPrice);
11006
+ }
11007
+ if (stopLossAmount !== undefined) {
11008
+ params['stopLoss']['amount'] = this.parseToNumeric(stopLossAmount);
11009
+ }
11010
+ params = this.omit(params, ['takeProfitType', 'takeProfitPriceType', 'takeProfitLimitPrice', 'takeProfitAmount', 'stopLossType', 'stopLossPriceType', 'stopLossLimitPrice', 'stopLossAmount']);
11011
+ if (this.has['createOrderWithTakeProfitAndStopLoss']) {
11012
+ return await this.createOrder(symbol, type, side, amount, price, params);
11013
+ }
11014
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createOrderWithTakeProfitAndStopLoss() is not supported yet');
11015
+ }
10869
11016
  async createOrders(orders, params = {}) {
10870
11017
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createOrders() is not supported yet');
10871
11018
  }
@@ -15453,6 +15600,7 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
15453
15600
  },
15454
15601
  'contractPublic': {
15455
15602
  'get': [
15603
+ 'symbols',
15456
15604
  'instruments',
15457
15605
  'depth@{symbol}/snapshot',
15458
15606
  'instruments/difference',
@@ -15848,7 +15996,10 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
15848
15996
  * @param {object} [params] extra parameters specific to the exchange API endpoint
15849
15997
  * @returns {object[]} an array of objects representing market data
15850
15998
  */
15851
- const response = await this.publicGetAssetPairs(params);
15999
+ const promises = [this.publicGetAssetPairs(params), this.contractPublicGetSymbols(params)];
16000
+ const promisesResult = await Promise.all(promises);
16001
+ const response = promisesResult[0];
16002
+ const contractResponse = promisesResult[1];
15852
16003
  //
15853
16004
  // {
15854
16005
  // "code":0,
@@ -15874,29 +16025,30 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
15874
16025
  // ]
15875
16026
  // }
15876
16027
  //
15877
- const contractResponse = await this.contractPublicGetInstruments(params);
15878
16028
  //
15879
16029
  // [
15880
16030
  // {
15881
- // "usdtPrice": 1.00031998,
16031
+ // "baseCurrency": "BTC",
16032
+ // "multiplier": 1,
16033
+ // "enable": true,
16034
+ // "priceStep": 0.5,
16035
+ // "maxRiskLimit": 1000,
16036
+ // "pricePrecision": 1,
16037
+ // "maintenanceMargin": 0.00500,
15882
16038
  // "symbol": "BTCUSD",
15883
- // "btcPrice": 34700.4,
15884
- // "ethPrice": 1787.83,
15885
- // "nextFundingRate": 0.00010,
15886
- // "fundingRate": 0.00010,
15887
- // "latestPrice": 34708.5,
15888
- // "last24hPriceChange": 0.0321,
15889
- // "indexPrice": 34700.4,
15890
- // "volume24h": 261319063,
15891
- // "turnover24h": 8204.129380685496,
15892
- // "nextFundingTime": 1698285600000,
15893
- // "markPrice": 34702.4646738,
15894
- // "last24hMaxPrice": 35127.5,
15895
- // "volume24hInUsd": 0.0,
15896
- // "openValue": 32.88054722085945,
15897
- // "last24hMinPrice": 33552.0,
15898
- // "openInterest": 1141372.0
15899
- // }
16039
+ // "valuePrecision": 4,
16040
+ // "minRiskLimit": 100,
16041
+ // "riskLimit": 100,
16042
+ // "isInverse": true,
16043
+ // "riskStep": 1,
16044
+ // "settleCurrency": "BTC",
16045
+ // "baseName": "Bitcoin",
16046
+ // "feePrecision": 8,
16047
+ // "priceMin": 0.5,
16048
+ // "priceMax": 1E+6,
16049
+ // "initialMargin": 0.01000,
16050
+ // "quoteCurrency": "USD"
16051
+ // },
15900
16052
  // ...
15901
16053
  // ]
15902
16054
  //
@@ -15963,15 +16115,14 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
15963
16115
  }
15964
16116
  for (let i = 0; i < contractResponse.length; i++) {
15965
16117
  const market = contractResponse[i];
16118
+ const baseId = this.safeString(market, 'baseCurrency');
16119
+ const quoteId = this.safeString(market, 'quoteCurrency');
16120
+ const settleId = this.safeString(market, 'settleCurrency');
15966
16121
  const marketId = this.safeString(market, 'symbol');
15967
- const index = marketId.indexOf('USD');
15968
- const baseId = marketId.slice(0, index);
15969
- const quoteId = marketId.slice(index);
15970
- const inverse = (quoteId === 'USD');
15971
- const settleId = inverse ? baseId : quoteId;
15972
16122
  const base = this.safeCurrencyCode(baseId);
15973
16123
  const quote = this.safeCurrencyCode(quoteId);
15974
16124
  const settle = this.safeCurrencyCode(settleId);
16125
+ const inverse = this.safeValue(market, 'isInverse');
15975
16126
  result.push(this.safeMarketStructure({
15976
16127
  'id': marketId,
15977
16128
  'symbol': base + '/' + quote + ':' + settle,
@@ -15987,18 +16138,18 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
15987
16138
  'swap': true,
15988
16139
  'future': false,
15989
16140
  'option': false,
15990
- 'active': true,
16141
+ 'active': this.safeValue(market, 'enable'),
15991
16142
  'contract': true,
15992
16143
  'linear': !inverse,
15993
16144
  'inverse': inverse,
15994
- 'contractSize': 1,
16145
+ 'contractSize': this.safeNumber(market, 'multiplier'),
15995
16146
  'expiry': undefined,
15996
16147
  'expiryDatetime': undefined,
15997
16148
  'strike': undefined,
15998
16149
  'optionType': undefined,
15999
16150
  'precision': {
16000
- 'amount': undefined,
16001
- 'price': undefined,
16151
+ 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'valuePrecision'))),
16152
+ 'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'pricePrecision'))),
16002
16153
  },
16003
16154
  'limits': {
16004
16155
  'leverage': {
@@ -16010,11 +16161,11 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
16010
16161
  'max': undefined,
16011
16162
  },
16012
16163
  'price': {
16013
- 'min': undefined,
16014
- 'max': undefined,
16164
+ 'min': this.safeNumber(market, 'priceMin'),
16165
+ 'max': this.safeNumber(market, 'priceMax'),
16015
16166
  },
16016
16167
  'cost': {
16017
- 'min': undefined,
16168
+ 'min': this.safeNumber(market, 'initialMargin'),
16018
16169
  'max': undefined,
16019
16170
  },
16020
16171
  },
@@ -17603,6 +17754,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
17603
17754
  'createStopMarketOrder': false,
17604
17755
  'createStopOrder': true,
17605
17756
  'createTrailingPercentOrder': true,
17757
+ 'createTriggerOrder': true,
17758
+ 'createTakeProfitOrder': true,
17759
+ 'createStopLossOrder': true,
17606
17760
  'editOrder': true,
17607
17761
  'fetchAccounts': undefined,
17608
17762
  'fetchBalance': true,
@@ -17633,6 +17787,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
17633
17787
  'fetchIsolatedBorrowRate': false,
17634
17788
  'fetchIsolatedBorrowRates': false,
17635
17789
  'fetchL3OrderBook': false,
17790
+ 'fetchLastPrices': true,
17636
17791
  'fetchLedger': true,
17637
17792
  'fetchLeverage': false,
17638
17793
  'fetchLeverageTiers': true,
@@ -20708,6 +20863,110 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
20708
20863
  }
20709
20864
  return this.parseTickers(response, symbols);
20710
20865
  }
20866
+ async fetchLastPrices(symbols = undefined, params = {}) {
20867
+ /**
20868
+ * @method
20869
+ * @name binance#fetchLastPrices
20870
+ * @description fetches the last price for multiple markets
20871
+ * @see https://binance-docs.github.io/apidocs/spot/en/#symbol-price-ticker // spot
20872
+ * @see https://binance-docs.github.io/apidocs/future/en/#symbol-price-ticker // swap
20873
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#symbol-price-ticker // future
20874
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the last prices
20875
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
20876
+ * @returns {object} a dictionary of lastprices structures
20877
+ */
20878
+ await this.loadMarkets();
20879
+ symbols = this.marketSymbols(symbols);
20880
+ const market = this.getMarketFromSymbols(symbols);
20881
+ let type = undefined;
20882
+ let subType = undefined;
20883
+ [subType, params] = this.handleSubTypeAndParams('fetchLastPrices', market, params);
20884
+ [type, params] = this.handleMarketTypeAndParams('fetchLastPrices', market, params);
20885
+ let response = undefined;
20886
+ if (this.isLinear(type, subType)) {
20887
+ response = await this.fapiPublicV2GetTickerPrice(params);
20888
+ //
20889
+ // [
20890
+ // {
20891
+ // "symbol": "LTCBTC",
20892
+ // "price": "4.00000200"
20893
+ // "time": 1589437530011
20894
+ // },
20895
+ // ...
20896
+ // ]
20897
+ //
20898
+ }
20899
+ else if (this.isInverse(type, subType)) {
20900
+ response = await this.dapiPublicGetTickerPrice(params);
20901
+ //
20902
+ // [
20903
+ // {
20904
+ // "symbol": "BTCUSD_200626",
20905
+ // "ps": "9647.8",
20906
+ // "price": "9647.8",
20907
+ // "time": 1591257246176
20908
+ // }
20909
+ // ]
20910
+ //
20911
+ }
20912
+ else if (type === 'spot') {
20913
+ response = await this.publicGetTickerPrice(params);
20914
+ //
20915
+ // [
20916
+ // {
20917
+ // "symbol": "LTCBTC",
20918
+ // "price": "4.00000200"
20919
+ // },
20920
+ // ...
20921
+ // ]
20922
+ //
20923
+ }
20924
+ else {
20925
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchLastPrices() does not support ' + type + ' markets yet');
20926
+ }
20927
+ return this.parseLastPrices(response, symbols);
20928
+ }
20929
+ parseLastPrice(entry, market = undefined) {
20930
+ //
20931
+ // spot
20932
+ //
20933
+ // {
20934
+ // "symbol": "LTCBTC",
20935
+ // "price": "4.00000200"
20936
+ // }
20937
+ //
20938
+ // usdm (swap/future)
20939
+ //
20940
+ // {
20941
+ // "symbol": "BTCUSDT",
20942
+ // "price": "6000.01",
20943
+ // "time": 1589437530011 // Transaction time
20944
+ // }
20945
+ //
20946
+ //
20947
+ // coinm (swap/future)
20948
+ //
20949
+ // {
20950
+ // "symbol": "BTCUSD_200626", // symbol ("BTCUSD_200626", "BTCUSD_PERP", etc..)
20951
+ // "ps": "BTCUSD", // pair
20952
+ // "price": "9647.8",
20953
+ // "time": 1591257246176
20954
+ // }
20955
+ //
20956
+ const timestamp = this.safeInteger(entry, 'time');
20957
+ const type = (timestamp === undefined) ? 'spot' : 'swap';
20958
+ const marketId = this.safeString(entry, 'symbol');
20959
+ market = this.safeMarket(marketId, market, undefined, type);
20960
+ const price = this.safeNumber(entry, 'price');
20961
+ return {
20962
+ 'symbol': market['symbol'],
20963
+ 'timestamp': timestamp,
20964
+ 'datetime': this.iso8601(timestamp),
20965
+ 'price': price,
20966
+ 'side': undefined,
20967
+ 'info': entry,
20968
+ };
20969
+ }
20711
20970
  async fetchTickers(symbols = undefined, params = {}) {
20712
20971
  /**
20713
20972
  * @method
@@ -27354,6 +27613,7 @@ class binanceus extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
27354
27613
  'id': 'binanceus',
27355
27614
  'name': 'Binance US',
27356
27615
  'countries': ['US'],
27616
+ 'rateLimit': 50,
27357
27617
  'certified': false,
27358
27618
  'pro': true,
27359
27619
  'urls': {
@@ -27421,6 +27681,13 @@ class binanceus extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
27421
27681
  'setMarginMode': false,
27422
27682
  'setPositionMode': false,
27423
27683
  },
27684
+ 'api': {
27685
+ 'public': {
27686
+ 'get': {
27687
+ 'ticker/price': { 'cost': 1, 'noSymbol': 2 },
27688
+ },
27689
+ },
27690
+ },
27424
27691
  });
27425
27692
  }
27426
27693
  }
@@ -27541,6 +27808,10 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
27541
27808
  'createOrders': true,
27542
27809
  'createTrailingAmountOrder': true,
27543
27810
  'createTrailingPercentOrder': true,
27811
+ 'createTriggerOrder': true,
27812
+ 'createTakeProfitOrder': true,
27813
+ 'createStopLossOrder': true,
27814
+ 'createOrderWithTakeProfitAndStopLoss': true,
27544
27815
  'fetchBalance': true,
27545
27816
  'fetchClosedOrders': true,
27546
27817
  'fetchCurrencies': true,
@@ -41171,6 +41442,10 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41171
41442
  'createOrders': true,
41172
41443
  'createReduceOnlyOrder': false,
41173
41444
  'createTrailingPercentOrder': true,
41445
+ 'createTriggerOrder': true,
41446
+ 'createTakeProfitOrder': true,
41447
+ 'createStopLossOrder': true,
41448
+ 'createOrderWithTakeProfitAndStopLoss': true,
41174
41449
  'editOrder': true,
41175
41450
  'fetchAccounts': false,
41176
41451
  'fetchBalance': true,
@@ -78524,6 +78799,10 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
78524
78799
  'createStopMarketOrder': true,
78525
78800
  'createStopOrder': true,
78526
78801
  'createTrailingAmountOrder': true,
78802
+ 'createTriggerOrder': true,
78803
+ 'createTakeProfitOrder': true,
78804
+ 'createStopLossOrder': true,
78805
+ 'createOrderWithTakeProfitAndStopLoss': true,
78527
78806
  'editOrder': true,
78528
78807
  'fetchBalance': true,
78529
78808
  'fetchBorrowInterest': false,
@@ -94051,6 +94330,9 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94051
94330
  'createMarketBuyOrderWithCost': true,
94052
94331
  'createMarketOrderWithCost': false,
94053
94332
  'createMarketSellOrderWithCost': false,
94333
+ 'createTriggerOrder': true,
94334
+ 'createTakeProfitOrder': true,
94335
+ 'createStopLossOrder': true,
94054
94336
  'createOrder': true,
94055
94337
  'createOrders': true,
94056
94338
  'createReduceOnlyOrder': true,
@@ -113574,7 +113856,13 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
113574
113856
  if (limit !== undefined) {
113575
113857
  request['page_size'] = limit;
113576
113858
  }
113577
- const response = await this[method](this.extend(request, params));
113859
+ let response = undefined;
113860
+ if (method === 'privateGetOrders') {
113861
+ response = await this.privateGetOrders(this.extend(request, params));
113862
+ }
113863
+ else if (method === 'privateGetOrdersHistory') {
113864
+ response = await this.privateGetOrdersHistory(this.extend(request, params));
113865
+ }
113578
113866
  //
113579
113867
  // {
113580
113868
  // "success": true,
@@ -125215,6 +125503,9 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
125215
125503
  'createReduceOnlyOrder': true,
125216
125504
  'createStopLimitOrder': true,
125217
125505
  'createStopMarketOrder': false,
125506
+ 'createTriggerOrder': true,
125507
+ 'createTakeProfitOrder': true,
125508
+ 'createStopLossOrder': true,
125218
125509
  'createStopOrder': true,
125219
125510
  'editOrder': true,
125220
125511
  'fetchBalance': true,
@@ -128891,6 +129182,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
128891
129182
  * @param {object} [params] extra parameters specific to the exchange API endpoint
128892
129183
  * @param {float} [params.stopPrice] The price at which a trigger order is triggered at
128893
129184
  * @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
129185
+ * @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
129186
+ * @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
128894
129187
  * @param {string} [params.marginMode] 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
128895
129188
  * @param {int} [params.iceberg] Amount to display for the iceberg order, Null or 0 for normal orders, Set to -1 to hide the order completely
128896
129189
  * @param {string} [params.text] User defined information
@@ -139675,6 +139968,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
139675
139968
  'createStopMarketOrder': true,
139676
139969
  'createStopOrder': true,
139677
139970
  'createTrailingPercentOrder': true,
139971
+ 'createTriggerOrder': true,
139972
+ 'createTakeProfitOrder': true,
139973
+ 'createStopLossOrder': true,
139678
139974
  'fetchAccounts': true,
139679
139975
  'fetchBalance': true,
139680
139976
  'fetchBidsAsks': undefined,
@@ -139702,6 +139998,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
139702
139998
  'fetchIsolatedBorrowRate': false,
139703
139999
  'fetchIsolatedBorrowRates': true,
139704
140000
  'fetchL3OrderBook': undefined,
140001
+ 'fetchLastPrices': true,
139705
140002
  'fetchLedger': true,
139706
140003
  'fetchLedgerEntry': undefined,
139707
140004
  'fetchLeverage': false,
@@ -141894,6 +142191,127 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
141894
142191
  }
141895
142192
  return this.filterByArrayTickers(result, 'symbol', symbols);
141896
142193
  }
142194
+ async fetchLastPrices(symbols = undefined, params = {}) {
142195
+ /**
142196
+ * @method
142197
+ * @name binance#fetchLastPrices
142198
+ * @description fetches the last price for multiple markets
142199
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=8cb81024-77b5-11ed-9966-0242ac110003 linear swap & linear future
142200
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=28c2e8fc-77ae-11ed-9966-0242ac110003 inverse future
142201
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=5d517ef5-77b6-11ed-9966-0242ac110003 inverse swap
142202
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the last prices
142203
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
142204
+ * @returns {object} a dictionary of lastprices structures
142205
+ */
142206
+ await this.loadMarkets();
142207
+ symbols = this.marketSymbols(symbols);
142208
+ const market = this.getMarketFromSymbols(symbols);
142209
+ let type = undefined;
142210
+ let subType = undefined;
142211
+ [subType, params] = this.handleSubTypeAndParams('fetchLastPrices', market, params);
142212
+ [type, params] = this.handleMarketTypeAndParams('fetchLastPrices', market, params);
142213
+ let response = undefined;
142214
+ if (((type === 'swap') || (type === 'future')) && (subType === 'linear')) {
142215
+ response = await this.contractPublicGetLinearSwapExMarketTrade(params);
142216
+ //
142217
+ // {
142218
+ // "ch": "market.*.trade.detail",
142219
+ // "status": "ok",
142220
+ // "tick": {
142221
+ // "data": [
142222
+ // {
142223
+ // "amount": "4",
142224
+ // "quantity": "40",
142225
+ // "trade_turnover": "22.176",
142226
+ // "ts": 1703697705028,
142227
+ // "id": 1000003558478170000,
142228
+ // "price": "0.5544",
142229
+ // "direction": "buy",
142230
+ // "contract_code": "MANA-USDT",
142231
+ // "business_type": "swap",
142232
+ // "trade_partition": "USDT"
142233
+ // },
142234
+ // ],
142235
+ // "id": 1703697740147,
142236
+ // "ts": 1703697740147
142237
+ // },
142238
+ // "ts": 1703697740147
142239
+ // }
142240
+ //
142241
+ }
142242
+ else if ((type === 'swap') && (subType === 'inverse')) {
142243
+ response = await this.contractPublicGetSwapExMarketTrade(params);
142244
+ //
142245
+ // {
142246
+ // "ch": "market.*.trade.detail",
142247
+ // "status": "ok",
142248
+ // "tick": {
142249
+ // "data": [
142250
+ // {
142251
+ // "amount": "6",
142252
+ // "quantity": "94.5000945000945000945000945000945000945",
142253
+ // "ts": 1703698704594,
142254
+ // "id": 1000001187811060000,
142255
+ // "price": "0.63492",
142256
+ // "direction": "buy",
142257
+ // "contract_code": "XRP-USD"
142258
+ // },
142259
+ // ],
142260
+ // "id": 1703698706589,
142261
+ // "ts": 1703698706589
142262
+ // },
142263
+ // "ts": 1703698706589
142264
+ // }
142265
+ //
142266
+ }
142267
+ else if ((type === 'future') && (subType === 'inverse')) {
142268
+ response = await this.contractPublicGetMarketTrade(params);
142269
+ //
142270
+ // {
142271
+ // "ch": "market.*.trade.detail",
142272
+ // "status": "ok",
142273
+ // "tick": {
142274
+ // "data": [
142275
+ // {
142276
+ // "amount": "20",
142277
+ // "quantity": "44.4444444444444444444444444444444444444",
142278
+ // "ts": 1686134498885,
142279
+ // "id": 2323000000174820000,
142280
+ // "price": "4.5",
142281
+ // "direction": "sell",
142282
+ // "symbol": "DORA_CW"
142283
+ // },
142284
+ // ],
142285
+ // "id": 1703698855142,
142286
+ // "ts": 1703698855142
142287
+ // },
142288
+ // "ts": 1703698855142
142289
+ // }
142290
+ //
142291
+ }
142292
+ else {
142293
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchLastPrices() does not support ' + type + ' markets yet');
142294
+ }
142295
+ const tick = this.safeValue(response, 'tick', {});
142296
+ const data = this.safeValue(tick, 'data', []);
142297
+ return this.parseLastPrices(data, symbols);
142298
+ }
142299
+ parseLastPrice(entry, market = undefined) {
142300
+ // example responses are documented in fetchLastPrices
142301
+ const marketId = this.safeString2(entry, 'symbol', 'contract_code');
142302
+ market = this.safeMarket(marketId, market);
142303
+ const price = this.safeNumber(entry, 'price');
142304
+ const direction = this.safeString(entry, 'direction'); // "buy" or "sell"
142305
+ // group timestamp should not be assigned to the individual trades' times
142306
+ return {
142307
+ 'symbol': market['symbol'],
142308
+ 'timestamp': undefined,
142309
+ 'datetime': undefined,
142310
+ 'price': price,
142311
+ 'side': direction,
142312
+ 'info': entry,
142313
+ };
142314
+ }
141897
142315
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
141898
142316
  /**
141899
142317
  * @method
@@ -144599,7 +145017,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
144599
145017
  async createTrailingPercentOrder(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
144600
145018
  /**
144601
145019
  * @method
144602
- * @name createTrailingPercentOrder
145020
+ * @name htx#createTrailingPercentOrder
144603
145021
  * @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
144604
145022
  * @param {string} symbol unified symbol of the market to create an order in
144605
145023
  * @param {string} type 'market' or 'limit'
@@ -155888,27 +156306,39 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
155888
156306
  const trailingAmount = this.safeString(params, 'trailingAmount');
155889
156307
  const trailingLimitAmount = this.safeString(params, 'trailingLimitAmount');
155890
156308
  const isTrailingAmountOrder = trailingAmount !== undefined;
155891
- if ((type === 'limit') && !isTrailingAmountOrder) {
156309
+ const isLimitOrder = type.endsWith('limit'); // supporting limit, stop-loss-limit, take-profit-limit, etc
156310
+ if (isLimitOrder && !isTrailingAmountOrder) {
155892
156311
  request['price'] = this.priceToPrecision(symbol, price);
155893
156312
  }
155894
- let reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only');
156313
+ const reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only');
155895
156314
  if (isStopLossOrTakeProfitTrigger) {
155896
156315
  if (isStopLossTriggerOrder) {
155897
156316
  request['price'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
155898
- request['ordertype'] = 'stop-loss-limit';
156317
+ if (isLimitOrder) {
156318
+ request['ordertype'] = 'stop-loss-limit';
156319
+ }
156320
+ else {
156321
+ request['ordertype'] = 'stop-loss';
156322
+ }
155899
156323
  }
155900
156324
  else if (isTakeProfitTriggerOrder) {
155901
156325
  request['price'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
155902
- request['ordertype'] = 'take-profit-limit';
156326
+ if (isLimitOrder) {
156327
+ request['ordertype'] = 'take-profit-limit';
156328
+ }
156329
+ else {
156330
+ request['ordertype'] = 'take-profit';
156331
+ }
156332
+ }
156333
+ if (isLimitOrder) {
156334
+ request['price2'] = this.priceToPrecision(symbol, price);
155903
156335
  }
155904
- request['price2'] = this.priceToPrecision(symbol, price);
155905
- reduceOnly = true;
155906
156336
  }
155907
156337
  else if (isTrailingAmountOrder) {
155908
156338
  const trailingActivationPriceType = this.safeString(params, 'trigger', 'last');
155909
156339
  const trailingAmountString = '+' + trailingAmount;
155910
156340
  request['trigger'] = trailingActivationPriceType;
155911
- if ((type === 'limit') || (trailingLimitAmount !== undefined)) {
156341
+ if (isLimitOrder || (trailingLimitAmount !== undefined)) {
155912
156342
  const offset = this.safeString(params, 'offset', '-');
155913
156343
  const trailingLimitAmountString = offset + this.numberToString(trailingLimitAmount);
155914
156344
  request['price'] = trailingAmountString;
@@ -159599,6 +160029,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
159599
160029
  'createPostOnlyOrder': true,
159600
160030
  'createStopLimitOrder': true,
159601
160031
  'createStopMarketOrder': true,
160032
+ 'createTriggerOrder': true,
159602
160033
  'createStopOrder': true,
159603
160034
  'editOrder': true,
159604
160035
  'fetchAccounts': true,
@@ -159866,6 +160297,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
159866
160297
  'premium/query': 4.5,
159867
160298
  'trade-statistics': 4.5,
159868
160299
  'funding-rate/{symbol}/current': 3,
160300
+ 'contract/funding-rates': 7.5,
159869
160301
  'timestamp': 3,
159870
160302
  'status': 6,
159871
160303
  // ?
@@ -159895,6 +160327,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
159895
160327
  'openOrderStatistics': 15,
159896
160328
  'position': 3,
159897
160329
  'positions': 3,
160330
+ 'margin/maxWithdrawMargin': 15,
159898
160331
  'contracts/risk-limit/{symbol}': 7.5,
159899
160332
  'funding-history': 7.5, // 5FW
159900
160333
  },
@@ -159905,7 +160338,9 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
159905
160338
  // futures
159906
160339
  'orders': 3,
159907
160340
  'orders/test': 3,
160341
+ 'orders/multi': 4.5,
159908
160342
  'position/margin/auto-deposit-status': 6,
160343
+ 'margin/withdrawMargin': 15,
159909
160344
  'position/margin/deposit-margin': 6,
159910
160345
  'position/risk-limit-level/change': 6,
159911
160346
  // ws
@@ -164084,10 +164519,14 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
164084
164519
  'closePositions': false,
164085
164520
  'createDepositAddress': true,
164086
164521
  'createOrder': true,
164522
+ 'createOrders': true,
164087
164523
  'createReduceOnlyOrder': true,
164088
164524
  'createStopLimitOrder': true,
164089
164525
  'createStopMarketOrder': true,
164090
164526
  'createStopOrder': true,
164527
+ 'createTriggerOrder': true,
164528
+ 'createTakeProfitOrder': true,
164529
+ 'createStopLossOrder': true,
164091
164530
  'fetchAccounts': true,
164092
164531
  'fetchBalance': true,
164093
164532
  'fetchBorrowRateHistories': false,
@@ -164102,7 +164541,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
164102
164541
  'fetchDepositWithdrawFees': false,
164103
164542
  'fetchFundingHistory': true,
164104
164543
  'fetchFundingRate': true,
164105
- 'fetchFundingRateHistory': false,
164544
+ 'fetchFundingRateHistory': true,
164106
164545
  'fetchIndexOHLCV': false,
164107
164546
  'fetchIsolatedBorrowRate': false,
164108
164547
  'fetchIsolatedBorrowRates': false,
@@ -165163,6 +165602,78 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
165163
165602
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
165164
165603
  */
165165
165604
  await this.loadMarkets();
165605
+ const market = this.market(symbol);
165606
+ const testOrder = this.safeValue(params, 'test', false);
165607
+ params = this.omit(params, 'test');
165608
+ const orderRequest = this.createContractOrderRequest(symbol, type, side, amount, price, params);
165609
+ let response = undefined;
165610
+ if (testOrder) {
165611
+ response = await this.futuresPrivatePostOrdersTest(orderRequest);
165612
+ }
165613
+ else {
165614
+ response = await this.futuresPrivatePostOrders(orderRequest);
165615
+ }
165616
+ //
165617
+ // {
165618
+ // "code": "200000",
165619
+ // "data": {
165620
+ // "orderId": "619717484f1d010001510cde",
165621
+ // },
165622
+ // }
165623
+ //
165624
+ const data = this.safeValue(response, 'data', {});
165625
+ return this.parseOrder(data, market);
165626
+ }
165627
+ async createOrders(orders, params = {}) {
165628
+ /**
165629
+ * @method
165630
+ * @name kucoinfutures#createOrders
165631
+ * @description create a list of trade orders
165632
+ * @see https://www.kucoin.com/docs/rest/futures-trading/orders/place-multiple-orders
165633
+ * @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
165634
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
165635
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
165636
+ */
165637
+ await this.loadMarkets();
165638
+ const ordersRequests = [];
165639
+ for (let i = 0; i < orders.length; i++) {
165640
+ const rawOrder = orders[i];
165641
+ const symbol = this.safeString(rawOrder, 'symbol');
165642
+ const market = this.market(symbol);
165643
+ const type = this.safeString(rawOrder, 'type');
165644
+ const side = this.safeString(rawOrder, 'side');
165645
+ const amount = this.safeValue(rawOrder, 'amount');
165646
+ const price = this.safeValue(rawOrder, 'price');
165647
+ const orderParams = this.safeValue(rawOrder, 'params', {});
165648
+ const orderRequest = this.createContractOrderRequest(market['id'], type, side, amount, price, orderParams);
165649
+ ordersRequests.push(orderRequest);
165650
+ }
165651
+ const response = await this.futuresPrivatePostOrdersMulti(ordersRequests);
165652
+ //
165653
+ // {
165654
+ // "code": "200000",
165655
+ // "data": [
165656
+ // {
165657
+ // "orderId": "135241412609331200",
165658
+ // "clientOid": "3d8fcc13-0b13-447f-ad30-4b3441e05213",
165659
+ // "symbol": "LTCUSDTM",
165660
+ // "code": "200000",
165661
+ // "msg": "success"
165662
+ // },
165663
+ // {
165664
+ // "orderId": "135241412747743234",
165665
+ // "clientOid": "b878c7ee-ae3e-4d63-a20b-038acbb7306f",
165666
+ // "symbol": "LTCUSDTM",
165667
+ // "code": "200000",
165668
+ // "msg": "success"
165669
+ // }
165670
+ // ]
165671
+ // }
165672
+ //
165673
+ const data = this.safeValue(response, 'data', []);
165674
+ return this.parseOrders(data);
165675
+ }
165676
+ createContractOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
165166
165677
  const market = this.market(symbol);
165167
165678
  // required param, cannot be used twice
165168
165679
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId', this.uuid());
@@ -165235,48 +165746,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
165235
165746
  }
165236
165747
  }
165237
165748
  params = this.omit(params, ['timeInForce', 'stopPrice', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']); // Time in force only valid for limit orders, exchange error when gtc for market orders
165238
- let response = undefined;
165239
- const testOrder = this.safeValue(params, 'test', false);
165240
- params = this.omit(params, 'test');
165241
- if (testOrder) {
165242
- response = await this.futuresPrivatePostOrdersTest(this.extend(request, params));
165243
- }
165244
- else {
165245
- response = await this.futuresPrivatePostOrders(this.extend(request, params));
165246
- }
165247
- //
165248
- // {
165249
- // "code": "200000",
165250
- // "data": {
165251
- // "orderId": "619717484f1d010001510cde",
165252
- // },
165253
- // }
165254
- //
165255
- const data = this.safeValue(response, 'data', {});
165256
- return this.safeOrder({
165257
- 'id': this.safeString(data, 'orderId'),
165258
- 'clientOrderId': undefined,
165259
- 'timestamp': undefined,
165260
- 'datetime': undefined,
165261
- 'lastTradeTimestamp': undefined,
165262
- 'symbol': undefined,
165263
- 'type': undefined,
165264
- 'side': undefined,
165265
- 'price': undefined,
165266
- 'amount': undefined,
165267
- 'cost': undefined,
165268
- 'average': undefined,
165269
- 'filled': undefined,
165270
- 'remaining': undefined,
165271
- 'status': undefined,
165272
- 'fee': undefined,
165273
- 'trades': undefined,
165274
- 'timeInForce': undefined,
165275
- 'postOnly': undefined,
165276
- 'stopPrice': undefined,
165277
- 'triggerPrice': undefined,
165278
- 'info': response,
165279
- }, market);
165749
+ return this.extend(request, params);
165280
165750
  }
165281
165751
  async cancelOrder(id, symbol = undefined, params = {}) {
165282
165752
  /**
@@ -165749,10 +166219,26 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
165749
166219
  // "reduceOnly": false
165750
166220
  // }
165751
166221
  //
166222
+ // createOrder
166223
+ //
166224
+ // {
166225
+ // "orderId": "619717484f1d010001510cde"
166226
+ // }
166227
+ //
166228
+ // createOrders
166229
+ //
166230
+ // {
166231
+ // "orderId": "80465574458560512",
166232
+ // "clientOid": "5c52e11203aa677f33e491",
166233
+ // "symbol": "ETHUSDTM",
166234
+ // "code": "200000",
166235
+ // "msg": "success"
166236
+ // }
166237
+ //
165752
166238
  const marketId = this.safeString(order, 'symbol');
165753
166239
  market = this.safeMarket(marketId, market);
165754
166240
  const symbol = market['symbol'];
165755
- const orderId = this.safeString(order, 'id');
166241
+ const orderId = this.safeString2(order, 'id', 'orderId');
165756
166242
  const type = this.safeString(order, 'type');
165757
166243
  const timestamp = this.safeInteger(order, 'createdAt');
165758
166244
  const datetime = this.iso8601(timestamp);
@@ -165779,9 +166265,12 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
165779
166265
  // precision reported by their api is 8 d.p.
165780
166266
  // const average = Precise.stringDiv (cost, Precise.stringMul (filled, market['contractSize']));
165781
166267
  // bool
165782
- const isActive = this.safeValue(order, 'isActive', false);
166268
+ const isActive = this.safeValue(order, 'isActive');
165783
166269
  const cancelExist = this.safeValue(order, 'cancelExist', false);
165784
- let status = isActive ? 'open' : 'closed';
166270
+ let status = undefined;
166271
+ if (isActive !== undefined) {
166272
+ status = isActive ? 'open' : 'closed';
166273
+ }
165785
166274
  status = cancelExist ? 'canceled' : status;
165786
166275
  let fee = undefined;
165787
166276
  if (feeCost !== undefined) {
@@ -166426,62 +166915,62 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
166426
166915
  /**
166427
166916
  * @method
166428
166917
  * @name kucoinfutures#fetchFundingRateHistory
166918
+ * @see https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-public-funding-history#request-url
166429
166919
  * @description fetches historical funding rate prices
166430
166920
  * @param {string} symbol unified symbol of the market to fetch the funding rate history for
166431
166921
  * @param {int} [since] not used by kucuoinfutures
166432
166922
  * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
166433
166923
  * @param {object} [params] extra parameters specific to the exchange API endpoint
166434
- * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
166924
+ * @param {int} [params.until] end time in ms
166435
166925
  * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
166436
166926
  */
166437
166927
  if (symbol === undefined) {
166438
166928
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
166439
166929
  }
166440
166930
  await this.loadMarkets();
166441
- let paginate = false;
166442
- [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
166443
- if (paginate) {
166444
- return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params);
166445
- }
166446
166931
  const market = this.market(symbol);
166447
166932
  const request = {
166448
166933
  'symbol': market['id'],
166934
+ 'from': 0,
166935
+ 'to': this.milliseconds(),
166449
166936
  };
166450
- if (limit !== undefined) {
166451
- request['maxCount'] = limit;
166937
+ const until = this.safeInteger2(params, 'until', 'till');
166938
+ params = this.omit(params, ['until', 'till']);
166939
+ if (since !== undefined) {
166940
+ request['from'] = since;
166941
+ if (until === undefined) {
166942
+ request['to'] = since + 1000 * 8 * 60 * 60 * 100;
166943
+ }
166944
+ }
166945
+ if (until !== undefined) {
166946
+ request['to'] = until;
166947
+ if (since === undefined) {
166948
+ request['to'] = until - 1000 * 8 * 60 * 60 * 100;
166949
+ }
166452
166950
  }
166453
- const response = await this.webExchangeGetContractSymbolFundingRates(this.extend(request, params));
166951
+ const response = await this.futuresPublicGetContractFundingRates(this.extend(request, params));
166454
166952
  //
166455
- // {
166456
- // "success": true,
166457
- // "code": "200",
166458
- // "msg": "success",
166459
- // "retry": false,
166460
- // "data": {
166461
- // "dataList": [
166462
- // {
166463
- // "symbol": "XBTUSDTM",
166464
- // "granularity": 28800000,
166465
- // "timePoint": 1675108800000,
166466
- // "value": 0.0001
166467
- // },
166468
- // ...
166469
- // ],
166470
- // "hasMore": true
166471
- // }
166472
- // }
166953
+ // {
166954
+ // "code": "200000",
166955
+ // "data": [
166956
+ // {
166957
+ // "symbol": "IDUSDTM",
166958
+ // "fundingRate": 2.26E-4,
166959
+ // "timepoint": 1702296000000
166960
+ // }
166961
+ // ]
166962
+ // }
166473
166963
  //
166474
166964
  const data = this.safeValue(response, 'data');
166475
- const dataList = this.safeValue(data, 'dataList');
166476
- return this.parseFundingRateHistories(dataList, market, since, limit);
166965
+ return this.parseFundingRateHistories(data, market, since, limit);
166477
166966
  }
166478
166967
  parseFundingRateHistory(info, market = undefined) {
166479
- const timestamp = this.safeInteger(info, 'timePoint');
166968
+ const timestamp = this.safeInteger(info, 'timepoint');
166480
166969
  const marketId = this.safeString(info, 'symbol');
166481
166970
  return {
166482
166971
  'info': info,
166483
166972
  'symbol': this.safeSymbol(marketId, market),
166484
- 'fundingRate': this.safeNumber(info, 'value'),
166973
+ 'fundingRate': this.safeNumber(info, 'fundingRate'),
166485
166974
  'timestamp': timestamp,
166486
166975
  'datetime': this.iso8601(timestamp),
166487
166976
  };
@@ -189953,12 +190442,16 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
189953
190442
  'createMarketSellOrderWithCost': true,
189954
190443
  'createOrder': true,
189955
190444
  'createOrders': true,
190445
+ 'createOrderWithTakeProfitAndStopLoss': true,
189956
190446
  'createPostOnlyOrder': true,
189957
190447
  'createReduceOnlyOrder': true,
190448
+ 'createStopLossOrder': true,
189958
190449
  'createStopLimitOrder': true,
189959
190450
  'createStopMarketOrder': true,
189960
190451
  'createStopOrder': true,
190452
+ 'createTakeProfitOrder': true,
189961
190453
  'createTrailingPercentOrder': true,
190454
+ 'createTriggerOrder': true,
189962
190455
  'editOrder': true,
189963
190456
  'fetchAccounts': true,
189964
190457
  'fetchBalance': true,
@@ -192046,17 +192539,14 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
192046
192539
  let defaultType = 'Candles';
192047
192540
  if (since !== undefined) {
192048
192541
  const now = this.milliseconds();
192049
- const difference = now - since;
192050
192542
  const durationInMilliseconds = duration * 1000;
192051
- // if the since timestamp is more than limit candles back in the past
192052
- // additional one bar for max offset to round the current day to UTC
192053
- const calc = (1440 - limit - 1) * durationInMilliseconds;
192054
- if (difference > calc) {
192543
+ // switch to history candles if since is past the cutoff for current candles
192544
+ const historyBorder = now - ((1440 - 1) * durationInMilliseconds);
192545
+ if (since < historyBorder) {
192055
192546
  defaultType = 'HistoryCandles';
192056
192547
  }
192057
- const startTime = Math.max(since - 1, 0);
192058
- request['before'] = startTime;
192059
- request['after'] = this.sum(startTime, durationInMilliseconds * limit);
192548
+ request['before'] = since;
192549
+ request['after'] = this.sum(since, durationInMilliseconds * limit);
192060
192550
  }
192061
192551
  const until = this.safeInteger(params, 'until');
192062
192552
  if (until !== undefined) {
@@ -280899,6 +281389,10 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
280899
281389
  'createStopOrder': false,
280900
281390
  'createTrailingAmountOrder': true,
280901
281391
  'createTrailingPercentOrder': true,
281392
+ 'createTriggerOrder': true,
281393
+ 'createTakeProfitOrder': true,
281394
+ 'createStopLossOrder': true,
281395
+ 'createOrderWithTakeProfitAndStopLoss': true,
280902
281396
  'fetchAccounts': true,
280903
281397
  'fetchBalance': true,
280904
281398
  'fetchCanceledOrders': false,
@@ -281617,7 +282111,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
281617
282111
  async createTrailingAmountOrder(symbol, type, side, amount, price = undefined, trailingAmount = undefined, trailingTriggerPrice = undefined, params = {}) {
281618
282112
  /**
281619
282113
  * @method
281620
- * @name createTrailingAmountOrder
282114
+ * @name woo#createTrailingAmountOrder
281621
282115
  * @description create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
281622
282116
  * @param {string} symbol unified symbol of the market to create an order in
281623
282117
  * @param {string} type 'market' or 'limit'
@@ -281642,7 +282136,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
281642
282136
  async createTrailingPercentOrder(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
281643
282137
  /**
281644
282138
  * @method
281645
- * @name createTrailingPercentOrder
282139
+ * @name woo#createTrailingPercentOrder
281646
282140
  * @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
281647
282141
  * @param {string} symbol unified symbol of the market to create an order in
281648
282142
  * @param {string} type 'market' or 'limit'
@@ -293132,7 +293626,7 @@ SOFTWARE.
293132
293626
 
293133
293627
  //-----------------------------------------------------------------------------
293134
293628
  // this is updated by vss.js when building
293135
- const version = '4.2.13';
293629
+ const version = '4.2.14';
293136
293630
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
293137
293631
  //-----------------------------------------------------------------------------
293138
293632