ccxt 4.2.13 → 4.2.15

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 (53) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +781 -133
  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 +5 -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 +43 -9
  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/pro/htx.js +6 -1
  22. package/dist/cjs/js/src/pro/woo.js +126 -0
  23. package/dist/cjs/js/src/woo.js +6 -2
  24. package/js/ccxt.d.ts +1 -1
  25. package/js/ccxt.js +1 -1
  26. package/js/src/abstract/bigone.d.ts +1 -0
  27. package/js/src/abstract/kucoin.d.ts +4 -0
  28. package/js/src/abstract/kucoinfutures.d.ts +4 -0
  29. package/js/src/base/Exchange.d.ts +8 -0
  30. package/js/src/base/Exchange.js +148 -1
  31. package/js/src/bigone.js +36 -32
  32. package/js/src/binance.d.ts +9 -0
  33. package/js/src/binance.js +108 -0
  34. package/js/src/binanceus.js +8 -0
  35. package/js/src/bingx.js +5 -0
  36. package/js/src/bitget.js +4 -0
  37. package/js/src/bybit.js +4 -0
  38. package/js/src/coinex.js +3 -0
  39. package/js/src/delta.js +7 -1
  40. package/js/src/gate.js +5 -0
  41. package/js/src/htx.d.ts +9 -0
  42. package/js/src/htx.js +126 -1
  43. package/js/src/kraken.d.ts +1 -0
  44. package/js/src/kraken.js +43 -9
  45. package/js/src/kucoin.js +5 -0
  46. package/js/src/kucoinfutures.d.ts +4 -2
  47. package/js/src/kucoinfutures.js +131 -77
  48. package/js/src/okx.js +9 -8
  49. package/js/src/pro/htx.js +6 -1
  50. package/js/src/pro/woo.d.ts +5 -1
  51. package/js/src/pro/woo.js +127 -1
  52. package/js/src/woo.js +6 -2
  53. 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
  },
@@ -17600,9 +17751,12 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
17600
17751
  'createPostOnlyOrder': true,
17601
17752
  'createReduceOnlyOrder': true,
17602
17753
  'createStopLimitOrder': true,
17754
+ 'createStopLossOrder': true,
17603
17755
  'createStopMarketOrder': false,
17604
17756
  'createStopOrder': true,
17757
+ 'createTakeProfitOrder': true,
17605
17758
  'createTrailingPercentOrder': true,
17759
+ 'createTriggerOrder': 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
  }
@@ -27539,8 +27806,12 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
27539
27806
  'createMarketSellOrderWithCost': true,
27540
27807
  'createOrder': true,
27541
27808
  'createOrders': true,
27809
+ 'createOrderWithTakeProfitAndStopLoss': true,
27810
+ 'createStopLossOrder': true,
27811
+ 'createTakeProfitOrder': true,
27542
27812
  'createTrailingAmountOrder': true,
27543
27813
  'createTrailingPercentOrder': true,
27814
+ 'createTriggerOrder': true,
27544
27815
  'fetchBalance': true,
27545
27816
  'fetchClosedOrders': true,
27546
27817
  'fetchCurrencies': true,
@@ -27860,6 +28131,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
27860
28131
  '80016': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
27861
28132
  '80017': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
27862
28133
  '100414': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AccountSuspended,
28134
+ '100419': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
27863
28135
  '100437': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest, // {"code":100437,"msg":"The withdrawal amount is lower than the minimum limit, please re-enter.","timestamp":1689258588845}
27864
28136
  },
27865
28137
  'broad': {},
@@ -41169,8 +41441,12 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41169
41441
  'createMarketSellOrderWithCost': false,
41170
41442
  'createOrder': true,
41171
41443
  'createOrders': true,
41444
+ 'createOrderWithTakeProfitAndStopLoss': true,
41172
41445
  'createReduceOnlyOrder': false,
41446
+ 'createStopLossOrder': true,
41447
+ 'createTakeProfitOrder': true,
41173
41448
  'createTrailingPercentOrder': true,
41449
+ 'createTriggerOrder': true,
41174
41450
  'editOrder': true,
41175
41451
  'fetchAccounts': false,
41176
41452
  'fetchBalance': true,
@@ -78518,12 +78794,16 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
78518
78794
  'createMarketSellOrderWithCost': false,
78519
78795
  'createOrder': true,
78520
78796
  'createOrders': true,
78797
+ 'createOrderWithTakeProfitAndStopLoss': true,
78521
78798
  'createPostOnlyOrder': true,
78522
78799
  'createReduceOnlyOrder': true,
78523
78800
  'createStopLimitOrder': true,
78801
+ 'createStopLossOrder': true,
78524
78802
  'createStopMarketOrder': true,
78525
78803
  'createStopOrder': true,
78804
+ 'createTakeProfitOrder': true,
78526
78805
  'createTrailingAmountOrder': true,
78806
+ 'createTriggerOrder': true,
78527
78807
  'editOrder': true,
78528
78808
  'fetchBalance': true,
78529
78809
  'fetchBorrowInterest': false,
@@ -94054,6 +94334,9 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94054
94334
  'createOrder': true,
94055
94335
  'createOrders': true,
94056
94336
  'createReduceOnlyOrder': true,
94337
+ 'createStopLossOrder': true,
94338
+ 'createTakeProfitOrder': true,
94339
+ 'createTriggerOrder': true,
94057
94340
  'editOrder': true,
94058
94341
  'fetchBalance': true,
94059
94342
  'fetchBorrowInterest': true,
@@ -113574,7 +113857,13 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
113574
113857
  if (limit !== undefined) {
113575
113858
  request['page_size'] = limit;
113576
113859
  }
113577
- const response = await this[method](this.extend(request, params));
113860
+ let response = undefined;
113861
+ if (method === 'privateGetOrders') {
113862
+ response = await this.privateGetOrders(this.extend(request, params));
113863
+ }
113864
+ else if (method === 'privateGetOrdersHistory') {
113865
+ response = await this.privateGetOrdersHistory(this.extend(request, params));
113866
+ }
113578
113867
  //
113579
113868
  // {
113580
113869
  // "success": true,
@@ -125214,8 +125503,11 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
125214
125503
  'createPostOnlyOrder': true,
125215
125504
  'createReduceOnlyOrder': true,
125216
125505
  'createStopLimitOrder': true,
125506
+ 'createStopLossOrder': true,
125217
125507
  'createStopMarketOrder': false,
125218
125508
  'createStopOrder': true,
125509
+ 'createTakeProfitOrder': true,
125510
+ 'createTriggerOrder': true,
125219
125511
  'editOrder': true,
125220
125512
  'fetchBalance': true,
125221
125513
  'fetchBorrowRateHistories': false,
@@ -128891,6 +129183,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
128891
129183
  * @param {object} [params] extra parameters specific to the exchange API endpoint
128892
129184
  * @param {float} [params.stopPrice] The price at which a trigger order is triggered at
128893
129185
  * @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
129186
+ * @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
129187
+ * @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
128894
129188
  * @param {string} [params.marginMode] 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
128895
129189
  * @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
129190
  * @param {string} [params.text] User defined information
@@ -139672,9 +139966,12 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
139672
139966
  'createOrders': true,
139673
139967
  'createReduceOnlyOrder': false,
139674
139968
  'createStopLimitOrder': true,
139969
+ 'createStopLossOrder': true,
139675
139970
  'createStopMarketOrder': true,
139676
139971
  'createStopOrder': true,
139972
+ 'createTakeProfitOrder': true,
139677
139973
  'createTrailingPercentOrder': true,
139974
+ 'createTriggerOrder': true,
139678
139975
  'fetchAccounts': true,
139679
139976
  'fetchBalance': true,
139680
139977
  'fetchBidsAsks': undefined,
@@ -139702,6 +139999,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
139702
139999
  'fetchIsolatedBorrowRate': false,
139703
140000
  'fetchIsolatedBorrowRates': true,
139704
140001
  'fetchL3OrderBook': undefined,
140002
+ 'fetchLastPrices': true,
139705
140003
  'fetchLedger': true,
139706
140004
  'fetchLedgerEntry': undefined,
139707
140005
  'fetchLeverage': false,
@@ -141894,6 +142192,127 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
141894
142192
  }
141895
142193
  return this.filterByArrayTickers(result, 'symbol', symbols);
141896
142194
  }
142195
+ async fetchLastPrices(symbols = undefined, params = {}) {
142196
+ /**
142197
+ * @method
142198
+ * @name binance#fetchLastPrices
142199
+ * @description fetches the last price for multiple markets
142200
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=8cb81024-77b5-11ed-9966-0242ac110003 linear swap & linear future
142201
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=28c2e8fc-77ae-11ed-9966-0242ac110003 inverse future
142202
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=5d517ef5-77b6-11ed-9966-0242ac110003 inverse swap
142203
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the last prices
142204
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
142205
+ * @returns {object} a dictionary of lastprices structures
142206
+ */
142207
+ await this.loadMarkets();
142208
+ symbols = this.marketSymbols(symbols);
142209
+ const market = this.getMarketFromSymbols(symbols);
142210
+ let type = undefined;
142211
+ let subType = undefined;
142212
+ [subType, params] = this.handleSubTypeAndParams('fetchLastPrices', market, params);
142213
+ [type, params] = this.handleMarketTypeAndParams('fetchLastPrices', market, params);
142214
+ let response = undefined;
142215
+ if (((type === 'swap') || (type === 'future')) && (subType === 'linear')) {
142216
+ response = await this.contractPublicGetLinearSwapExMarketTrade(params);
142217
+ //
142218
+ // {
142219
+ // "ch": "market.*.trade.detail",
142220
+ // "status": "ok",
142221
+ // "tick": {
142222
+ // "data": [
142223
+ // {
142224
+ // "amount": "4",
142225
+ // "quantity": "40",
142226
+ // "trade_turnover": "22.176",
142227
+ // "ts": 1703697705028,
142228
+ // "id": 1000003558478170000,
142229
+ // "price": "0.5544",
142230
+ // "direction": "buy",
142231
+ // "contract_code": "MANA-USDT",
142232
+ // "business_type": "swap",
142233
+ // "trade_partition": "USDT"
142234
+ // },
142235
+ // ],
142236
+ // "id": 1703697740147,
142237
+ // "ts": 1703697740147
142238
+ // },
142239
+ // "ts": 1703697740147
142240
+ // }
142241
+ //
142242
+ }
142243
+ else if ((type === 'swap') && (subType === 'inverse')) {
142244
+ response = await this.contractPublicGetSwapExMarketTrade(params);
142245
+ //
142246
+ // {
142247
+ // "ch": "market.*.trade.detail",
142248
+ // "status": "ok",
142249
+ // "tick": {
142250
+ // "data": [
142251
+ // {
142252
+ // "amount": "6",
142253
+ // "quantity": "94.5000945000945000945000945000945000945",
142254
+ // "ts": 1703698704594,
142255
+ // "id": 1000001187811060000,
142256
+ // "price": "0.63492",
142257
+ // "direction": "buy",
142258
+ // "contract_code": "XRP-USD"
142259
+ // },
142260
+ // ],
142261
+ // "id": 1703698706589,
142262
+ // "ts": 1703698706589
142263
+ // },
142264
+ // "ts": 1703698706589
142265
+ // }
142266
+ //
142267
+ }
142268
+ else if ((type === 'future') && (subType === 'inverse')) {
142269
+ response = await this.contractPublicGetMarketTrade(params);
142270
+ //
142271
+ // {
142272
+ // "ch": "market.*.trade.detail",
142273
+ // "status": "ok",
142274
+ // "tick": {
142275
+ // "data": [
142276
+ // {
142277
+ // "amount": "20",
142278
+ // "quantity": "44.4444444444444444444444444444444444444",
142279
+ // "ts": 1686134498885,
142280
+ // "id": 2323000000174820000,
142281
+ // "price": "4.5",
142282
+ // "direction": "sell",
142283
+ // "symbol": "DORA_CW"
142284
+ // },
142285
+ // ],
142286
+ // "id": 1703698855142,
142287
+ // "ts": 1703698855142
142288
+ // },
142289
+ // "ts": 1703698855142
142290
+ // }
142291
+ //
142292
+ }
142293
+ else {
142294
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchLastPrices() does not support ' + type + ' markets yet');
142295
+ }
142296
+ const tick = this.safeValue(response, 'tick', {});
142297
+ const data = this.safeValue(tick, 'data', []);
142298
+ return this.parseLastPrices(data, symbols);
142299
+ }
142300
+ parseLastPrice(entry, market = undefined) {
142301
+ // example responses are documented in fetchLastPrices
142302
+ const marketId = this.safeString2(entry, 'symbol', 'contract_code');
142303
+ market = this.safeMarket(marketId, market);
142304
+ const price = this.safeNumber(entry, 'price');
142305
+ const direction = this.safeString(entry, 'direction'); // "buy" or "sell"
142306
+ // group timestamp should not be assigned to the individual trades' times
142307
+ return {
142308
+ 'symbol': market['symbol'],
142309
+ 'timestamp': undefined,
142310
+ 'datetime': undefined,
142311
+ 'price': price,
142312
+ 'side': direction,
142313
+ 'info': entry,
142314
+ };
142315
+ }
141897
142316
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
141898
142317
  /**
141899
142318
  * @method
@@ -144599,7 +145018,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
144599
145018
  async createTrailingPercentOrder(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
144600
145019
  /**
144601
145020
  * @method
144602
- * @name createTrailingPercentOrder
145021
+ * @name htx#createTrailingPercentOrder
144603
145022
  * @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
144604
145023
  * @param {string} symbol unified symbol of the market to create an order in
144605
145024
  * @param {string} type 'market' or 'limit'
@@ -155706,6 +156125,16 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
155706
156125
  };
155707
156126
  return this.safeString(statuses, status, status);
155708
156127
  }
156128
+ parseOrderType(status) {
156129
+ const statuses = {
156130
+ 'take-profit': 'market',
156131
+ 'stop-loss-limit': 'limit',
156132
+ 'stop-loss': 'market',
156133
+ 'take-profit-limit': 'limit',
156134
+ 'trailing-stop-limit': 'limit',
156135
+ };
156136
+ return this.safeString(statuses, status, status);
156137
+ }
155709
156138
  parseOrder(order, market = undefined) {
155710
156139
  //
155711
156140
  // createOrder for regular orders
@@ -155848,7 +156277,17 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
155848
156277
  trades.push(rawTrade);
155849
156278
  }
155850
156279
  }
155851
- stopPrice = this.safeNumber(order, 'stopprice', stopPrice);
156280
+ stopPrice = this.omitZero(this.safeString(order, 'stopprice', stopPrice));
156281
+ let stopLossPrice = undefined;
156282
+ let takeProfitPrice = undefined;
156283
+ if (type.startsWith('take-profit')) {
156284
+ takeProfitPrice = this.safeString(description, 'price');
156285
+ price = this.omitZero(this.safeString(description, 'price2'));
156286
+ }
156287
+ else if (type.startsWith('stop-loss')) {
156288
+ stopLossPrice = this.safeString(description, 'price');
156289
+ price = this.omitZero(this.safeString(description, 'price2'));
156290
+ }
155852
156291
  return this.safeOrder({
155853
156292
  'id': id,
155854
156293
  'clientOrderId': clientOrderId,
@@ -155858,13 +156297,15 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
155858
156297
  'lastTradeTimestamp': undefined,
155859
156298
  'status': status,
155860
156299
  'symbol': symbol,
155861
- 'type': type,
156300
+ 'type': this.parseOrderType(type),
155862
156301
  'timeInForce': undefined,
155863
156302
  'postOnly': isPostOnly,
155864
156303
  'side': side,
155865
156304
  'price': price,
155866
156305
  'stopPrice': stopPrice,
155867
156306
  'triggerPrice': stopPrice,
156307
+ 'takeProfitPrice': takeProfitPrice,
156308
+ 'stopLossPrice': stopLossPrice,
155868
156309
  'cost': undefined,
155869
156310
  'amount': amount,
155870
156311
  'filled': filled,
@@ -155888,27 +156329,39 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
155888
156329
  const trailingAmount = this.safeString(params, 'trailingAmount');
155889
156330
  const trailingLimitAmount = this.safeString(params, 'trailingLimitAmount');
155890
156331
  const isTrailingAmountOrder = trailingAmount !== undefined;
155891
- if ((type === 'limit') && !isTrailingAmountOrder) {
156332
+ const isLimitOrder = type.endsWith('limit'); // supporting limit, stop-loss-limit, take-profit-limit, etc
156333
+ if (isLimitOrder && !isTrailingAmountOrder) {
155892
156334
  request['price'] = this.priceToPrecision(symbol, price);
155893
156335
  }
155894
- let reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only');
156336
+ const reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only');
155895
156337
  if (isStopLossOrTakeProfitTrigger) {
155896
156338
  if (isStopLossTriggerOrder) {
155897
156339
  request['price'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
155898
- request['ordertype'] = 'stop-loss-limit';
156340
+ if (isLimitOrder) {
156341
+ request['ordertype'] = 'stop-loss-limit';
156342
+ }
156343
+ else {
156344
+ request['ordertype'] = 'stop-loss';
156345
+ }
155899
156346
  }
155900
156347
  else if (isTakeProfitTriggerOrder) {
155901
156348
  request['price'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
155902
- request['ordertype'] = 'take-profit-limit';
156349
+ if (isLimitOrder) {
156350
+ request['ordertype'] = 'take-profit-limit';
156351
+ }
156352
+ else {
156353
+ request['ordertype'] = 'take-profit';
156354
+ }
156355
+ }
156356
+ if (isLimitOrder) {
156357
+ request['price2'] = this.priceToPrecision(symbol, price);
155903
156358
  }
155904
- request['price2'] = this.priceToPrecision(symbol, price);
155905
- reduceOnly = true;
155906
156359
  }
155907
156360
  else if (isTrailingAmountOrder) {
155908
156361
  const trailingActivationPriceType = this.safeString(params, 'trigger', 'last');
155909
156362
  const trailingAmountString = '+' + trailingAmount;
155910
156363
  request['trigger'] = trailingActivationPriceType;
155911
- if ((type === 'limit') || (trailingLimitAmount !== undefined)) {
156364
+ if (isLimitOrder || (trailingLimitAmount !== undefined)) {
155912
156365
  const offset = this.safeString(params, 'offset', '-');
155913
156366
  const trailingLimitAmountString = offset + this.numberToString(trailingLimitAmount);
155914
156367
  request['price'] = trailingAmountString;
@@ -159600,6 +160053,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
159600
160053
  'createStopLimitOrder': true,
159601
160054
  'createStopMarketOrder': true,
159602
160055
  'createStopOrder': true,
160056
+ 'createTriggerOrder': true,
159603
160057
  'editOrder': true,
159604
160058
  'fetchAccounts': true,
159605
160059
  'fetchBalance': true,
@@ -159866,6 +160320,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
159866
160320
  'premium/query': 4.5,
159867
160321
  'trade-statistics': 4.5,
159868
160322
  'funding-rate/{symbol}/current': 3,
160323
+ 'contract/funding-rates': 7.5,
159869
160324
  'timestamp': 3,
159870
160325
  'status': 6,
159871
160326
  // ?
@@ -159895,6 +160350,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
159895
160350
  'openOrderStatistics': 15,
159896
160351
  'position': 3,
159897
160352
  'positions': 3,
160353
+ 'margin/maxWithdrawMargin': 15,
159898
160354
  'contracts/risk-limit/{symbol}': 7.5,
159899
160355
  'funding-history': 7.5, // 5FW
159900
160356
  },
@@ -159905,7 +160361,9 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
159905
160361
  // futures
159906
160362
  'orders': 3,
159907
160363
  'orders/test': 3,
160364
+ 'orders/multi': 4.5,
159908
160365
  'position/margin/auto-deposit-status': 6,
160366
+ 'margin/withdrawMargin': 15,
159909
160367
  'position/margin/deposit-margin': 6,
159910
160368
  'position/risk-limit-level/change': 6,
159911
160369
  // ws
@@ -164084,10 +164542,14 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
164084
164542
  'closePositions': false,
164085
164543
  'createDepositAddress': true,
164086
164544
  'createOrder': true,
164545
+ 'createOrders': true,
164087
164546
  'createReduceOnlyOrder': true,
164088
164547
  'createStopLimitOrder': true,
164548
+ 'createStopLossOrder': true,
164089
164549
  'createStopMarketOrder': true,
164090
164550
  'createStopOrder': true,
164551
+ 'createTakeProfitOrder': true,
164552
+ 'createTriggerOrder': true,
164091
164553
  'fetchAccounts': true,
164092
164554
  'fetchBalance': true,
164093
164555
  'fetchBorrowRateHistories': false,
@@ -164102,7 +164564,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
164102
164564
  'fetchDepositWithdrawFees': false,
164103
164565
  'fetchFundingHistory': true,
164104
164566
  'fetchFundingRate': true,
164105
- 'fetchFundingRateHistory': false,
164567
+ 'fetchFundingRateHistory': true,
164106
164568
  'fetchIndexOHLCV': false,
164107
164569
  'fetchIsolatedBorrowRate': false,
164108
164570
  'fetchIsolatedBorrowRates': false,
@@ -165163,6 +165625,78 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
165163
165625
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
165164
165626
  */
165165
165627
  await this.loadMarkets();
165628
+ const market = this.market(symbol);
165629
+ const testOrder = this.safeValue(params, 'test', false);
165630
+ params = this.omit(params, 'test');
165631
+ const orderRequest = this.createContractOrderRequest(symbol, type, side, amount, price, params);
165632
+ let response = undefined;
165633
+ if (testOrder) {
165634
+ response = await this.futuresPrivatePostOrdersTest(orderRequest);
165635
+ }
165636
+ else {
165637
+ response = await this.futuresPrivatePostOrders(orderRequest);
165638
+ }
165639
+ //
165640
+ // {
165641
+ // "code": "200000",
165642
+ // "data": {
165643
+ // "orderId": "619717484f1d010001510cde",
165644
+ // },
165645
+ // }
165646
+ //
165647
+ const data = this.safeValue(response, 'data', {});
165648
+ return this.parseOrder(data, market);
165649
+ }
165650
+ async createOrders(orders, params = {}) {
165651
+ /**
165652
+ * @method
165653
+ * @name kucoinfutures#createOrders
165654
+ * @description create a list of trade orders
165655
+ * @see https://www.kucoin.com/docs/rest/futures-trading/orders/place-multiple-orders
165656
+ * @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
165657
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
165658
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
165659
+ */
165660
+ await this.loadMarkets();
165661
+ const ordersRequests = [];
165662
+ for (let i = 0; i < orders.length; i++) {
165663
+ const rawOrder = orders[i];
165664
+ const symbol = this.safeString(rawOrder, 'symbol');
165665
+ const market = this.market(symbol);
165666
+ const type = this.safeString(rawOrder, 'type');
165667
+ const side = this.safeString(rawOrder, 'side');
165668
+ const amount = this.safeValue(rawOrder, 'amount');
165669
+ const price = this.safeValue(rawOrder, 'price');
165670
+ const orderParams = this.safeValue(rawOrder, 'params', {});
165671
+ const orderRequest = this.createContractOrderRequest(market['id'], type, side, amount, price, orderParams);
165672
+ ordersRequests.push(orderRequest);
165673
+ }
165674
+ const response = await this.futuresPrivatePostOrdersMulti(ordersRequests);
165675
+ //
165676
+ // {
165677
+ // "code": "200000",
165678
+ // "data": [
165679
+ // {
165680
+ // "orderId": "135241412609331200",
165681
+ // "clientOid": "3d8fcc13-0b13-447f-ad30-4b3441e05213",
165682
+ // "symbol": "LTCUSDTM",
165683
+ // "code": "200000",
165684
+ // "msg": "success"
165685
+ // },
165686
+ // {
165687
+ // "orderId": "135241412747743234",
165688
+ // "clientOid": "b878c7ee-ae3e-4d63-a20b-038acbb7306f",
165689
+ // "symbol": "LTCUSDTM",
165690
+ // "code": "200000",
165691
+ // "msg": "success"
165692
+ // }
165693
+ // ]
165694
+ // }
165695
+ //
165696
+ const data = this.safeValue(response, 'data', []);
165697
+ return this.parseOrders(data);
165698
+ }
165699
+ createContractOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
165166
165700
  const market = this.market(symbol);
165167
165701
  // required param, cannot be used twice
165168
165702
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId', this.uuid());
@@ -165235,48 +165769,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
165235
165769
  }
165236
165770
  }
165237
165771
  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);
165772
+ return this.extend(request, params);
165280
165773
  }
165281
165774
  async cancelOrder(id, symbol = undefined, params = {}) {
165282
165775
  /**
@@ -165749,10 +166242,26 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
165749
166242
  // "reduceOnly": false
165750
166243
  // }
165751
166244
  //
166245
+ // createOrder
166246
+ //
166247
+ // {
166248
+ // "orderId": "619717484f1d010001510cde"
166249
+ // }
166250
+ //
166251
+ // createOrders
166252
+ //
166253
+ // {
166254
+ // "orderId": "80465574458560512",
166255
+ // "clientOid": "5c52e11203aa677f33e491",
166256
+ // "symbol": "ETHUSDTM",
166257
+ // "code": "200000",
166258
+ // "msg": "success"
166259
+ // }
166260
+ //
165752
166261
  const marketId = this.safeString(order, 'symbol');
165753
166262
  market = this.safeMarket(marketId, market);
165754
166263
  const symbol = market['symbol'];
165755
- const orderId = this.safeString(order, 'id');
166264
+ const orderId = this.safeString2(order, 'id', 'orderId');
165756
166265
  const type = this.safeString(order, 'type');
165757
166266
  const timestamp = this.safeInteger(order, 'createdAt');
165758
166267
  const datetime = this.iso8601(timestamp);
@@ -165779,9 +166288,12 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
165779
166288
  // precision reported by their api is 8 d.p.
165780
166289
  // const average = Precise.stringDiv (cost, Precise.stringMul (filled, market['contractSize']));
165781
166290
  // bool
165782
- const isActive = this.safeValue(order, 'isActive', false);
166291
+ const isActive = this.safeValue(order, 'isActive');
165783
166292
  const cancelExist = this.safeValue(order, 'cancelExist', false);
165784
- let status = isActive ? 'open' : 'closed';
166293
+ let status = undefined;
166294
+ if (isActive !== undefined) {
166295
+ status = isActive ? 'open' : 'closed';
166296
+ }
165785
166297
  status = cancelExist ? 'canceled' : status;
165786
166298
  let fee = undefined;
165787
166299
  if (feeCost !== undefined) {
@@ -166426,62 +166938,62 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
166426
166938
  /**
166427
166939
  * @method
166428
166940
  * @name kucoinfutures#fetchFundingRateHistory
166941
+ * @see https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-public-funding-history#request-url
166429
166942
  * @description fetches historical funding rate prices
166430
166943
  * @param {string} symbol unified symbol of the market to fetch the funding rate history for
166431
166944
  * @param {int} [since] not used by kucuoinfutures
166432
166945
  * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
166433
166946
  * @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)
166947
+ * @param {int} [params.until] end time in ms
166435
166948
  * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
166436
166949
  */
166437
166950
  if (symbol === undefined) {
166438
166951
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
166439
166952
  }
166440
166953
  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
166954
  const market = this.market(symbol);
166447
166955
  const request = {
166448
166956
  'symbol': market['id'],
166957
+ 'from': 0,
166958
+ 'to': this.milliseconds(),
166449
166959
  };
166450
- if (limit !== undefined) {
166451
- request['maxCount'] = limit;
166960
+ const until = this.safeInteger2(params, 'until', 'till');
166961
+ params = this.omit(params, ['until', 'till']);
166962
+ if (since !== undefined) {
166963
+ request['from'] = since;
166964
+ if (until === undefined) {
166965
+ request['to'] = since + 1000 * 8 * 60 * 60 * 100;
166966
+ }
166452
166967
  }
166453
- const response = await this.webExchangeGetContractSymbolFundingRates(this.extend(request, params));
166968
+ if (until !== undefined) {
166969
+ request['to'] = until;
166970
+ if (since === undefined) {
166971
+ request['to'] = until - 1000 * 8 * 60 * 60 * 100;
166972
+ }
166973
+ }
166974
+ const response = await this.futuresPublicGetContractFundingRates(this.extend(request, params));
166454
166975
  //
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
- // }
166976
+ // {
166977
+ // "code": "200000",
166978
+ // "data": [
166979
+ // {
166980
+ // "symbol": "IDUSDTM",
166981
+ // "fundingRate": 2.26E-4,
166982
+ // "timepoint": 1702296000000
166983
+ // }
166984
+ // ]
166985
+ // }
166473
166986
  //
166474
166987
  const data = this.safeValue(response, 'data');
166475
- const dataList = this.safeValue(data, 'dataList');
166476
- return this.parseFundingRateHistories(dataList, market, since, limit);
166988
+ return this.parseFundingRateHistories(data, market, since, limit);
166477
166989
  }
166478
166990
  parseFundingRateHistory(info, market = undefined) {
166479
- const timestamp = this.safeInteger(info, 'timePoint');
166991
+ const timestamp = this.safeInteger(info, 'timepoint');
166480
166992
  const marketId = this.safeString(info, 'symbol');
166481
166993
  return {
166482
166994
  'info': info,
166483
166995
  'symbol': this.safeSymbol(marketId, market),
166484
- 'fundingRate': this.safeNumber(info, 'value'),
166996
+ 'fundingRate': this.safeNumber(info, 'fundingRate'),
166485
166997
  'timestamp': timestamp,
166486
166998
  'datetime': this.iso8601(timestamp),
166487
166999
  };
@@ -189953,12 +190465,16 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
189953
190465
  'createMarketSellOrderWithCost': true,
189954
190466
  'createOrder': true,
189955
190467
  'createOrders': true,
190468
+ 'createOrderWithTakeProfitAndStopLoss': true,
189956
190469
  'createPostOnlyOrder': true,
189957
190470
  'createReduceOnlyOrder': true,
189958
190471
  'createStopLimitOrder': true,
190472
+ 'createStopLossOrder': true,
189959
190473
  'createStopMarketOrder': true,
189960
190474
  'createStopOrder': true,
190475
+ 'createTakeProfitOrder': true,
189961
190476
  'createTrailingPercentOrder': true,
190477
+ 'createTriggerOrder': true,
189962
190478
  'editOrder': true,
189963
190479
  'fetchAccounts': true,
189964
190480
  'fetchBalance': true,
@@ -192046,17 +192562,14 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
192046
192562
  let defaultType = 'Candles';
192047
192563
  if (since !== undefined) {
192048
192564
  const now = this.milliseconds();
192049
- const difference = now - since;
192050
192565
  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) {
192566
+ // switch to history candles if since is past the cutoff for current candles
192567
+ const historyBorder = now - ((1440 - 1) * durationInMilliseconds);
192568
+ if (since < historyBorder) {
192055
192569
  defaultType = 'HistoryCandles';
192056
192570
  }
192057
- const startTime = Math.max(since - 1, 0);
192058
- request['before'] = startTime;
192059
- request['after'] = this.sum(startTime, durationInMilliseconds * limit);
192571
+ request['before'] = since;
192572
+ request['after'] = this.sum(since, durationInMilliseconds * limit);
192060
192573
  }
192061
192574
  const until = this.safeInteger(params, 'until');
192062
192575
  if (until !== undefined) {
@@ -238533,11 +239046,16 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
238533
239046
  // inject trade in existing order by faking an order object
238534
239047
  const orderId = this.safeString(parsedTrade, 'order');
238535
239048
  const trades = [parsedTrade];
239049
+ const status = this.parseOrderStatus(this.safeString2(data, 'orderStatus', 'status', 'closed'));
239050
+ const filled = this.safeString(data, 'execAmt');
239051
+ const remaining = this.safeString(data, 'remainAmt');
238536
239052
  const order = {
238537
239053
  'id': orderId,
238538
239054
  'trades': trades,
238539
- 'status': 'closed',
239055
+ 'status': status,
238540
239056
  'symbol': market['symbol'],
239057
+ 'filled': this.parseNumber(filled),
239058
+ 'remaining': this.parseNumber(remaining),
238541
239059
  };
238542
239060
  parsedOrder = order;
238543
239061
  }
@@ -257408,6 +257926,7 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
257408
257926
  'watchTicker': true,
257409
257927
  'watchTickers': true,
257410
257928
  'watchTrades': true,
257929
+ 'watchPositions': true,
257411
257930
  },
257412
257931
  'urls': {
257413
257932
  'api': {
@@ -257432,6 +257951,10 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
257432
257951
  'tradesLimit': 1000,
257433
257952
  'ordersLimit': 1000,
257434
257953
  'requestId': {},
257954
+ 'watchPositions': {
257955
+ 'fetchPositionsSnapshot': true,
257956
+ 'awaitPositionsSnapshot': true, // whether to wait for the positions snapshot before providing updates
257957
+ },
257435
257958
  },
257436
257959
  'streaming': {
257437
257960
  'ping': this.ping,
@@ -257990,6 +258513,126 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
257990
258513
  client.resolve(this.orders, messageHashSymbol);
257991
258514
  }
257992
258515
  }
258516
+ async watchPositions(symbols = undefined, since = undefined, limit = undefined, params = {}) {
258517
+ /**
258518
+ * @method
258519
+ * @name woo#watchPositions
258520
+ * @see https://docs.woo.org/#position-push
258521
+ * @description watch all open positions
258522
+ * @param {string[]|undefined} symbols list of unified market symbols
258523
+ * @param {object} params extra parameters specific to the exchange API endpoint
258524
+ * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
258525
+ */
258526
+ await this.loadMarkets();
258527
+ let messageHash = '';
258528
+ symbols = this.marketSymbols(symbols);
258529
+ if (!this.isEmpty(symbols)) {
258530
+ messageHash = '::' + symbols.join(',');
258531
+ }
258532
+ messageHash = 'positions' + messageHash;
258533
+ const url = this.urls['api']['ws']['private'] + '/' + this.uid;
258534
+ const client = this.client(url);
258535
+ this.setPositionsCache(client, symbols);
258536
+ const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
258537
+ const awaitPositionsSnapshot = this.safeValue('watchPositions', 'awaitPositionsSnapshot', true);
258538
+ if (fetchPositionsSnapshot && awaitPositionsSnapshot && this.positions === undefined) {
258539
+ const snapshot = await client.future('fetchPositionsSnapshot');
258540
+ return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
258541
+ }
258542
+ const request = {
258543
+ 'event': 'subscribe',
258544
+ 'topic': 'position',
258545
+ };
258546
+ const newPositions = await this.watchPrivate(messageHash, request, params);
258547
+ if (this.newUpdates) {
258548
+ return newPositions;
258549
+ }
258550
+ return this.filterBySymbolsSinceLimit(this.positions, symbols, since, limit, true);
258551
+ }
258552
+ setPositionsCache(client, type, symbols = undefined) {
258553
+ const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', false);
258554
+ if (fetchPositionsSnapshot) {
258555
+ const messageHash = 'fetchPositionsSnapshot';
258556
+ if (!(messageHash in client.futures)) {
258557
+ client.future(messageHash);
258558
+ this.spawn(this.loadPositionsSnapshot, client, messageHash);
258559
+ }
258560
+ }
258561
+ else {
258562
+ this.positions = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_2__/* .ArrayCacheBySymbolBySide */ .tU();
258563
+ }
258564
+ }
258565
+ async loadPositionsSnapshot(client, messageHash) {
258566
+ const positions = await this.fetchPositions();
258567
+ this.positions = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_2__/* .ArrayCacheBySymbolBySide */ .tU();
258568
+ const cache = this.positions;
258569
+ for (let i = 0; i < positions.length; i++) {
258570
+ const position = positions[i];
258571
+ const contracts = this.safeNumber(position, 'contracts', 0);
258572
+ if (contracts > 0) {
258573
+ cache.append(position);
258574
+ }
258575
+ }
258576
+ // don't remove the future from the .futures cache
258577
+ const future = client.futures[messageHash];
258578
+ future.resolve(cache);
258579
+ client.resolve(cache, 'positions');
258580
+ }
258581
+ handlePositions(client, message) {
258582
+ //
258583
+ // {
258584
+ // "topic":"position",
258585
+ // "ts":1705292345255,
258586
+ // "data":{
258587
+ // "positions":{
258588
+ // "PERP_LTC_USDT":{
258589
+ // "holding":1,
258590
+ // "pendingLongQty":0,
258591
+ // "pendingShortQty":0,
258592
+ // "averageOpenPrice":71.53,
258593
+ // "pnl24H":0,
258594
+ // "fee24H":0.07153,
258595
+ // "settlePrice":71.53,
258596
+ // "markPrice":71.32098452065145,
258597
+ // "version":7886,
258598
+ // "openingTime":1705292304267,
258599
+ // "pnl24HPercentage":0,
258600
+ // "adlQuantile":1,
258601
+ // "positionSide":"BOTH"
258602
+ // }
258603
+ // }
258604
+ // }
258605
+ // }
258606
+ //
258607
+ const data = this.safeValue(message, 'data', {});
258608
+ const rawPositions = this.safeValue(data, 'positions', {});
258609
+ const postitionsIds = Object.keys(rawPositions);
258610
+ if (this.positions === undefined) {
258611
+ this.positions = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_2__/* .ArrayCacheBySymbolBySide */ .tU();
258612
+ }
258613
+ const cache = this.positions;
258614
+ const newPositions = [];
258615
+ for (let i = 0; i < postitionsIds.length; i++) {
258616
+ const marketId = postitionsIds[i];
258617
+ const market = this.safeMarket(marketId);
258618
+ const rawPosition = rawPositions[marketId];
258619
+ const position = this.parsePosition(rawPosition, market);
258620
+ newPositions.push(position);
258621
+ cache.append(position);
258622
+ }
258623
+ const messageHashes = this.findMessageHashes(client, 'positions::');
258624
+ for (let i = 0; i < messageHashes.length; i++) {
258625
+ const messageHash = messageHashes[i];
258626
+ const parts = messageHash.split('::');
258627
+ const symbolsString = parts[1];
258628
+ const symbols = symbolsString.split(',');
258629
+ const positions = this.filterByArray(newPositions, 'symbol', symbols, false);
258630
+ if (!this.isEmpty(positions)) {
258631
+ client.resolve(positions, messageHash);
258632
+ }
258633
+ }
258634
+ client.resolve(newPositions, 'positions');
258635
+ }
257993
258636
  async watchBalance(params = {}) {
257994
258637
  /**
257995
258638
  * @method
@@ -258073,6 +258716,7 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
258073
258716
  'executionreport': this.handleOrderUpdate,
258074
258717
  'trade': this.handleTrade,
258075
258718
  'balance': this.handleBalance,
258719
+ 'position': this.handlePositions,
258076
258720
  };
258077
258721
  const event = this.safeString(message, 'event');
258078
258722
  let method = this.safeValue(methods, event);
@@ -280893,12 +281537,16 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
280893
281537
  'createMarketOrderWithCost': false,
280894
281538
  'createMarketSellOrderWithCost': false,
280895
281539
  'createOrder': true,
281540
+ 'createOrderWithTakeProfitAndStopLoss': true,
280896
281541
  'createReduceOnlyOrder': true,
280897
281542
  'createStopLimitOrder': false,
281543
+ 'createStopLossOrder': true,
280898
281544
  'createStopMarketOrder': false,
280899
281545
  'createStopOrder': false,
281546
+ 'createTakeProfitOrder': true,
280900
281547
  'createTrailingAmountOrder': true,
280901
281548
  'createTrailingPercentOrder': true,
281549
+ 'createTriggerOrder': true,
280902
281550
  'fetchAccounts': true,
280903
281551
  'fetchBalance': true,
280904
281552
  'fetchCanceledOrders': false,
@@ -281617,7 +282265,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
281617
282265
  async createTrailingAmountOrder(symbol, type, side, amount, price = undefined, trailingAmount = undefined, trailingTriggerPrice = undefined, params = {}) {
281618
282266
  /**
281619
282267
  * @method
281620
- * @name createTrailingAmountOrder
282268
+ * @name woo#createTrailingAmountOrder
281621
282269
  * @description create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
281622
282270
  * @param {string} symbol unified symbol of the market to create an order in
281623
282271
  * @param {string} type 'market' or 'limit'
@@ -281642,7 +282290,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
281642
282290
  async createTrailingPercentOrder(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
281643
282291
  /**
281644
282292
  * @method
281645
- * @name createTrailingPercentOrder
282293
+ * @name woo#createTrailingPercentOrder
281646
282294
  * @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
281647
282295
  * @param {string} symbol unified symbol of the market to create an order in
281648
282296
  * @param {string} type 'market' or 'limit'
@@ -293132,7 +293780,7 @@ SOFTWARE.
293132
293780
 
293133
293781
  //-----------------------------------------------------------------------------
293134
293782
  // this is updated by vss.js when building
293135
- const version = '4.2.13';
293783
+ const version = '4.2.15';
293136
293784
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
293137
293785
  //-----------------------------------------------------------------------------
293138
293786