ccxt 4.2.5 → 4.2.6

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.
@@ -4,7 +4,7 @@
4
4
  // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
  // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
6
 
7
- import { RequestTimeout, NetworkError, NotSupported, BaseError } from '../../base/errors.js';
7
+ import { RequestTimeout, NetworkError, NotSupported, BaseError, ExchangeClosedByUser } from '../../base/errors.js';
8
8
  import { inflateSync, gunzipSync } from '../../static_dependencies/fflake/browser.js';
9
9
  import { Future } from './Future.js';
10
10
  import { isNode, isJsonEncodedObject, deepExtend, milliseconds, } from '../../base/functions.js';
@@ -208,6 +208,9 @@ export default class Client {
208
208
  // todo: exception types for server-side disconnects
209
209
  this.reset(new NetworkError('connection closed by remote server, closing code ' + String(event.code)));
210
210
  }
211
+ if (this.error instanceof ExchangeClosedByUser) {
212
+ this.reset(this.error);
213
+ }
211
214
  if (this.disconnected !== undefined) {
212
215
  this.disconnected.resolve(true);
213
216
  }
@@ -228,6 +231,7 @@ export default class Client {
228
231
  const future = Future();
229
232
  if (isNode) {
230
233
  /* eslint-disable no-inner-declarations */
234
+ /* eslint-disable jsdoc/require-jsdoc */
231
235
  function onSendComplete(error) {
232
236
  if (error) {
233
237
  future.reject(error);
package/js/src/bingx.js CHANGED
@@ -2234,6 +2234,7 @@ export default class bingx extends Exchange {
2234
2234
  * @param {string} id order id
2235
2235
  * @param {string} symbol unified symbol of the market the order was made in
2236
2236
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2237
+ * @param {string} [params.clientOrderId] a unique id for the order
2237
2238
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2238
2239
  */
2239
2240
  if (symbol === undefined) {
@@ -2243,8 +2244,15 @@ export default class bingx extends Exchange {
2243
2244
  const market = this.market(symbol);
2244
2245
  const request = {
2245
2246
  'symbol': market['id'],
2246
- 'orderId': id,
2247
2247
  };
2248
+ const clientOrderId = this.safeString2(params, 'clientOrderId', 'clientOrderID');
2249
+ params = this.omit(params, ['clientOrderId']);
2250
+ if (clientOrderId !== undefined) {
2251
+ request['clientOrderID'] = clientOrderId;
2252
+ }
2253
+ else {
2254
+ request['orderId'] = id;
2255
+ }
2248
2256
  let response = undefined;
2249
2257
  const [marketType, query] = this.handleMarketTypeAndParams('cancelOrder', market, params);
2250
2258
  if (marketType === 'spot') {
package/js/src/bitmex.js CHANGED
@@ -1830,14 +1830,15 @@ export default class bitmex extends Exchange {
1830
1830
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1831
1831
  * @param {object} [params.triggerPrice] the price at which a trigger order is triggered at
1832
1832
  * @param {object} [params.triggerDirection] the direction whenever the trigger happens with relation to price - 'above' or 'below'
1833
+ * @param {float} [params.trailingAmount] the quote amount to trail away from the current market price
1833
1834
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1834
1835
  */
1835
1836
  await this.loadMarkets();
1836
1837
  const market = this.market(symbol);
1837
- const orderType = this.capitalize(type);
1838
+ let orderType = this.capitalize(type);
1838
1839
  const reduceOnly = this.safeValue(params, 'reduceOnly');
1839
1840
  if (reduceOnly !== undefined) {
1840
- if ((market['type'] !== 'swap') && (market['type'] !== 'future')) {
1841
+ if ((!market['swap']) && (!market['future'])) {
1841
1842
  throw new InvalidOrder(this.id + ' createOrder() does not support reduceOnly for ' + market['type'] + ' orders, reduceOnly orders are supported for swap and future markets only');
1842
1843
  }
1843
1844
  }
@@ -1850,44 +1851,54 @@ export default class bitmex extends Exchange {
1850
1851
  'ordType': orderType,
1851
1852
  'text': brokerId,
1852
1853
  };
1853
- const customTriggerType = (orderType === 'Stop') || (orderType === 'StopLimit') || (orderType === 'MarketIfTouched') || (orderType === 'LimitIfTouched');
1854
1854
  // support for unified trigger format
1855
1855
  const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'stopPx', 'stopPrice']);
1856
- if ((triggerPrice !== undefined) && !customTriggerType) {
1857
- request['stopPx'] = parseFloat(this.priceToPrecision(symbol, triggerPrice));
1856
+ let trailingAmount = this.safeString2(params, 'trailingAmount', 'pegOffsetValue');
1857
+ const isTriggerOrder = triggerPrice !== undefined;
1858
+ const isTrailingAmountOrder = trailingAmount !== undefined;
1859
+ if (isTriggerOrder || isTrailingAmountOrder) {
1858
1860
  const triggerDirection = this.safeString(params, 'triggerDirection');
1859
- params = this.omit(params, ['triggerPrice', 'stopPrice', 'stopPx', 'triggerDirection']);
1860
1861
  const triggerAbove = (triggerDirection === 'above');
1861
- this.checkRequiredArgument('createOrder', triggerDirection, 'triggerDirection', ['above', 'below']);
1862
- this.checkRequiredArgument('createOrder', side, 'side', ['buy', 'sell']);
1862
+ if ((type === 'limit') || (type === 'market')) {
1863
+ this.checkRequiredArgument('createOrder', triggerDirection, 'triggerDirection', ['above', 'below']);
1864
+ }
1863
1865
  if (type === 'limit') {
1864
- request['price'] = parseFloat(this.priceToPrecision(symbol, price));
1865
1866
  if (side === 'buy') {
1866
- request['ordType'] = triggerAbove ? 'StopLimit' : 'LimitIfTouched';
1867
+ orderType = triggerAbove ? 'StopLimit' : 'LimitIfTouched';
1867
1868
  }
1868
1869
  else {
1869
- request['ordType'] = triggerAbove ? 'LimitIfTouched' : 'StopLimit';
1870
+ orderType = triggerAbove ? 'LimitIfTouched' : 'StopLimit';
1870
1871
  }
1871
1872
  }
1872
1873
  else if (type === 'market') {
1873
1874
  if (side === 'buy') {
1874
- request['ordType'] = triggerAbove ? 'Stop' : 'MarketIfTouched';
1875
+ orderType = triggerAbove ? 'Stop' : 'MarketIfTouched';
1875
1876
  }
1876
1877
  else {
1877
- request['ordType'] = triggerAbove ? 'MarketIfTouched' : 'Stop';
1878
+ orderType = triggerAbove ? 'MarketIfTouched' : 'Stop';
1878
1879
  }
1879
1880
  }
1880
- }
1881
- else if (customTriggerType) {
1882
- if (triggerPrice === undefined) {
1883
- // if exchange specific trigger types were provided
1884
- throw new ArgumentsRequired(this.id + ' createOrder() requires a triggerPrice (stopPx|stopPrice) parameter for the ' + orderType + ' order type');
1881
+ if (isTrailingAmountOrder) {
1882
+ const isStopSellOrder = (side === 'sell') && ((orderType === 'Stop') || (orderType === 'StopLimit'));
1883
+ const isBuyIfTouchedOrder = (side === 'buy') && ((orderType === 'MarketIfTouched') || (orderType === 'LimitIfTouched'));
1884
+ if (isStopSellOrder || isBuyIfTouchedOrder) {
1885
+ trailingAmount = '-' + trailingAmount;
1886
+ }
1887
+ request['pegOffsetValue'] = this.parseToNumeric(trailingAmount);
1888
+ request['pegPriceType'] = 'TrailingStopPeg';
1889
+ }
1890
+ else {
1891
+ if (triggerPrice === undefined) {
1892
+ // if exchange specific trigger types were provided
1893
+ throw new ArgumentsRequired(this.id + ' createOrder() requires a triggerPrice (stopPx|stopPrice) parameter for the ' + orderType + ' order type');
1894
+ }
1895
+ request['stopPx'] = this.parseToNumeric(this.priceToPrecision(symbol, triggerPrice));
1885
1896
  }
1886
- params = this.omit(params, ['triggerPrice', 'stopPrice', 'stopPx']);
1887
- request['stopPx'] = parseFloat(this.priceToPrecision(symbol, triggerPrice));
1897
+ request['ordType'] = orderType;
1898
+ params = this.omit(params, ['triggerPrice', 'stopPrice', 'stopPx', 'triggerDirection', 'trailingAmount']);
1888
1899
  }
1889
1900
  if ((orderType === 'Limit') || (orderType === 'StopLimit') || (orderType === 'LimitIfTouched')) {
1890
- request['price'] = parseFloat(this.priceToPrecision(symbol, price));
1901
+ request['price'] = this.parseToNumeric(this.priceToPrecision(symbol, price));
1891
1902
  }
1892
1903
  const clientOrderId = this.safeString2(params, 'clOrdID', 'clientOrderId');
1893
1904
  if (clientOrderId !== undefined) {
@@ -1900,6 +1911,39 @@ export default class bitmex extends Exchange {
1900
1911
  async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
1901
1912
  await this.loadMarkets();
1902
1913
  const request = {};
1914
+ let trailingAmount = this.safeString2(params, 'trailingAmount', 'pegOffsetValue');
1915
+ const isTrailingAmountOrder = trailingAmount !== undefined;
1916
+ if (isTrailingAmountOrder) {
1917
+ const triggerDirection = this.safeString(params, 'triggerDirection');
1918
+ const triggerAbove = (triggerDirection === 'above');
1919
+ if ((type === 'limit') || (type === 'market')) {
1920
+ this.checkRequiredArgument('createOrder', triggerDirection, 'triggerDirection', ['above', 'below']);
1921
+ }
1922
+ let orderType = undefined;
1923
+ if (type === 'limit') {
1924
+ if (side === 'buy') {
1925
+ orderType = triggerAbove ? 'StopLimit' : 'LimitIfTouched';
1926
+ }
1927
+ else {
1928
+ orderType = triggerAbove ? 'LimitIfTouched' : 'StopLimit';
1929
+ }
1930
+ }
1931
+ else if (type === 'market') {
1932
+ if (side === 'buy') {
1933
+ orderType = triggerAbove ? 'Stop' : 'MarketIfTouched';
1934
+ }
1935
+ else {
1936
+ orderType = triggerAbove ? 'MarketIfTouched' : 'Stop';
1937
+ }
1938
+ }
1939
+ const isStopSellOrder = (side === 'sell') && ((orderType === 'Stop') || (orderType === 'StopLimit'));
1940
+ const isBuyIfTouchedOrder = (side === 'buy') && ((orderType === 'MarketIfTouched') || (orderType === 'LimitIfTouched'));
1941
+ if (isStopSellOrder || isBuyIfTouchedOrder) {
1942
+ trailingAmount = '-' + trailingAmount;
1943
+ }
1944
+ request['pegOffsetValue'] = this.parseToNumeric(trailingAmount);
1945
+ params = this.omit(params, ['triggerDirection', 'trailingAmount']);
1946
+ }
1903
1947
  const origClOrdID = this.safeString2(params, 'origClOrdID', 'clientOrderId');
1904
1948
  if (origClOrdID !== undefined) {
1905
1949
  request['origClOrdID'] = origClOrdID;
package/js/src/htx.d.ts CHANGED
@@ -266,4 +266,5 @@ export default class htx extends Exchange {
266
266
  };
267
267
  fetchLiquidations(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Liquidation[]>;
268
268
  parseLiquidation(liquidation: any, market?: Market): import("./base/types.js").Liquidation;
269
+ setPositionMode(hedged: any, symbol?: Str, params?: {}): Promise<any>;
269
270
  }
package/js/src/htx.js CHANGED
@@ -123,7 +123,7 @@ export default class htx extends Exchange {
123
123
  'repayIsolatedMargin': true,
124
124
  'setLeverage': true,
125
125
  'setMarginMode': false,
126
- 'setPositionMode': false,
126
+ 'setPositionMode': true,
127
127
  'signIn': undefined,
128
128
  'transfer': true,
129
129
  'withdraw': true,
@@ -8960,4 +8960,69 @@ export default class htx extends Exchange {
8960
8960
  'datetime': this.iso8601(timestamp),
8961
8961
  });
8962
8962
  }
8963
+ async setPositionMode(hedged, symbol = undefined, params = {}) {
8964
+ /**
8965
+ * @method
8966
+ * @name htx#setPositionMode
8967
+ * @description set hedged to true or false
8968
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-switch-position-mode
8969
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-switch-position-mode
8970
+ * @param {bool} hedged set to true to for hedged mode, must be set separately for each market in isolated margin mode, only valid for linear markets
8971
+ * @param {string} [symbol] unified market symbol, required for isolated margin mode
8972
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8973
+ * @param {string} [params.marginMode] "cross" (default) or "isolated"
8974
+ * @returns {object} response from the exchange
8975
+ */
8976
+ await this.loadMarkets();
8977
+ const posMode = hedged ? 'dual_side' : 'single_side';
8978
+ let market = undefined;
8979
+ if (symbol !== undefined) {
8980
+ market = this.market(symbol);
8981
+ }
8982
+ let marginMode = undefined;
8983
+ [marginMode, params] = this.handleMarginModeAndParams('setPositionMode', params, 'cross');
8984
+ const request = {
8985
+ 'position_mode': posMode,
8986
+ };
8987
+ let response = undefined;
8988
+ if ((market !== undefined) && (market['inverse'])) {
8989
+ throw new BadRequest(this.id + ' setPositionMode can only be used for linear markets');
8990
+ }
8991
+ if (marginMode === 'isolated') {
8992
+ if (symbol === undefined) {
8993
+ throw new ArgumentsRequired(this.id + ' setPositionMode requires a symbol argument for isolated margin mode');
8994
+ }
8995
+ request['margin_account'] = market['id'];
8996
+ response = await this.contractPrivatePostLinearSwapApiV1SwapSwitchPositionMode(this.extend(request, params));
8997
+ //
8998
+ // {
8999
+ // "status": "ok",
9000
+ // "data": [
9001
+ // {
9002
+ // "margin_account": "BTC-USDT",
9003
+ // "position_mode": "single_side"
9004
+ // }
9005
+ // ],
9006
+ // "ts": 1566899973811
9007
+ // }
9008
+ //
9009
+ }
9010
+ else {
9011
+ request['margin_account'] = 'USDT';
9012
+ response = await this.contractPrivatePostLinearSwapApiV1SwapCrossSwitchPositionMode(this.extend(request, params));
9013
+ //
9014
+ // {
9015
+ // "status": "ok",
9016
+ // "data": [
9017
+ // {
9018
+ // "margin_account": "USDT",
9019
+ // "position_mode": "single_side"
9020
+ // }
9021
+ // ],
9022
+ // "ts": 1566899973811
9023
+ // }
9024
+ //
9025
+ }
9026
+ return response;
9027
+ }
8963
9028
  }
package/js/src/woo.js CHANGED
@@ -768,9 +768,9 @@ export default class woo extends Exchange {
768
768
  /**
769
769
  * @method
770
770
  * @name woo#createOrder
771
+ * @description create a trade order
771
772
  * @see https://docs.woo.org/#send-order
772
773
  * @see https://docs.woo.org/#send-algo-order
773
- * @description create a trade order
774
774
  * @param {string} symbol unified symbol of the market to create an order in
775
775
  * @param {string} type 'market' or 'limit'
776
776
  * @param {string} side 'buy' or 'sell'
@@ -784,6 +784,9 @@ export default class woo extends Exchange {
784
784
  * @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
785
785
  * @param {float} [params.algoType] 'STOP'or 'TRAILING_STOP' or 'OCO' or 'CLOSE_POSITION'
786
786
  * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
787
+ * @param {string} [params.trailingAmount] the quote amount to trail away from the current market price
788
+ * @param {string} [params.trailingPercent] the percent to trail away from the current market price
789
+ * @param {string} [params.trailingTriggerPrice] the price to trigger a trailing order, default uses the price argument
787
790
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
788
791
  */
789
792
  const reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only');
@@ -800,7 +803,13 @@ export default class woo extends Exchange {
800
803
  const stopLoss = this.safeValue(params, 'stopLoss');
801
804
  const takeProfit = this.safeValue(params, 'takeProfit');
802
805
  const algoType = this.safeString(params, 'algoType');
803
- const isStop = stopPrice !== undefined || stopLoss !== undefined || takeProfit !== undefined || (this.safeValue(params, 'childOrders') !== undefined);
806
+ const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activatedPrice', price);
807
+ const trailingAmount = this.safeString2(params, 'trailingAmount', 'callbackValue');
808
+ const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRate');
809
+ const isTrailingAmountOrder = trailingAmount !== undefined;
810
+ const isTrailingPercentOrder = trailingPercent !== undefined;
811
+ const isTrailing = isTrailingAmountOrder || isTrailingPercentOrder;
812
+ const isStop = isTrailing || stopPrice !== undefined || stopLoss !== undefined || takeProfit !== undefined || (this.safeValue(params, 'childOrders') !== undefined);
804
813
  const isMarket = orderType === 'MARKET';
805
814
  const timeInForce = this.safeStringLower(params, 'timeInForce');
806
815
  const postOnly = this.isPostOnly(isMarket, undefined, params);
@@ -865,7 +874,21 @@ export default class woo extends Exchange {
865
874
  if (clientOrderId !== undefined) {
866
875
  request[clientOrderIdKey] = clientOrderId;
867
876
  }
868
- if (stopPrice !== undefined) {
877
+ if (isTrailing) {
878
+ if (trailingTriggerPrice === undefined) {
879
+ throw new ArgumentsRequired(this.id + ' createOrder() requires a trailingTriggerPrice parameter for trailing orders');
880
+ }
881
+ request['activatedPrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
882
+ request['algoType'] = 'TRAILING_STOP';
883
+ if (isTrailingAmountOrder) {
884
+ request['callbackValue'] = trailingAmount;
885
+ }
886
+ else if (isTrailingPercentOrder) {
887
+ const convertedTrailingPercent = Precise.stringDiv(trailingPercent, '100');
888
+ request['callbackRate'] = convertedTrailingPercent;
889
+ }
890
+ }
891
+ else if (stopPrice !== undefined) {
869
892
  if (algoType !== 'TRAILING_STOP') {
870
893
  request['triggerPrice'] = this.priceToPrecision(symbol, stopPrice);
871
894
  request['algoType'] = 'STOP';
@@ -904,7 +927,7 @@ export default class woo extends Exchange {
904
927
  }
905
928
  request['childOrders'] = [outterOrder];
906
929
  }
907
- params = this.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id', 'postOnly', 'timeInForce', 'stopPrice', 'triggerPrice', 'stopLoss', 'takeProfit']);
930
+ params = this.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id', 'postOnly', 'timeInForce', 'stopPrice', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingPercent', 'trailingAmount', 'trailingTriggerPrice']);
908
931
  let response = undefined;
909
932
  if (isStop) {
910
933
  response = await this.v3PrivatePostAlgoOrder(this.extend(request, params));
@@ -950,11 +973,11 @@ export default class woo extends Exchange {
950
973
  /**
951
974
  * @method
952
975
  * @name woo#editOrder
976
+ * @description edit a trade order
953
977
  * @see https://docs.woo.org/#edit-order
954
978
  * @see https://docs.woo.org/#edit-order-by-client_order_id
955
979
  * @see https://docs.woo.org/#edit-algo-order
956
980
  * @see https://docs.woo.org/#edit-algo-order-by-client_order_id
957
- * @description edit a trade order
958
981
  * @param {string} id order id
959
982
  * @param {string} symbol unified symbol of the market to create an order in
960
983
  * @param {string} type 'market' or 'limit'
@@ -965,6 +988,9 @@ export default class woo extends Exchange {
965
988
  * @param {float} [params.triggerPrice] The price a trigger order is triggered at
966
989
  * @param {float} [params.stopLossPrice] price to trigger stop-loss orders
967
990
  * @param {float} [params.takeProfitPrice] price to trigger take-profit orders
991
+ * @param {string} [params.trailingAmount] the quote amount to trail away from the current market price
992
+ * @param {string} [params.trailingPercent] the percent to trail away from the current market price
993
+ * @param {string} [params.trailingTriggerPrice] the price to trigger a trailing order, default uses the price argument
968
994
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
969
995
  */
970
996
  await this.loadMarkets();
@@ -986,8 +1012,26 @@ export default class woo extends Exchange {
986
1012
  if (stopPrice !== undefined) {
987
1013
  request['triggerPrice'] = this.priceToPrecision(symbol, stopPrice);
988
1014
  }
989
- params = this.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id', 'stopPrice', 'triggerPrice', 'takeProfitPrice', 'stopLossPrice']);
990
- const isStop = (stopPrice !== undefined) || (this.safeValue(params, 'childOrders') !== undefined);
1015
+ const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activatedPrice', price);
1016
+ const trailingAmount = this.safeString2(params, 'trailingAmount', 'callbackValue');
1017
+ const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRate');
1018
+ const isTrailingAmountOrder = trailingAmount !== undefined;
1019
+ const isTrailingPercentOrder = trailingPercent !== undefined;
1020
+ const isTrailing = isTrailingAmountOrder || isTrailingPercentOrder;
1021
+ if (isTrailing) {
1022
+ if (trailingTriggerPrice !== undefined) {
1023
+ request['activatedPrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
1024
+ }
1025
+ if (isTrailingAmountOrder) {
1026
+ request['callbackValue'] = trailingAmount;
1027
+ }
1028
+ else if (isTrailingPercentOrder) {
1029
+ const convertedTrailingPercent = Precise.stringDiv(trailingPercent, '100');
1030
+ request['callbackRate'] = convertedTrailingPercent;
1031
+ }
1032
+ }
1033
+ params = this.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id', 'stopPrice', 'triggerPrice', 'takeProfitPrice', 'stopLossPrice', 'trailingTriggerPrice', 'trailingAmount', 'trailingPercent']);
1034
+ const isStop = isTrailing || (stopPrice !== undefined) || (this.safeValue(params, 'childOrders') !== undefined);
991
1035
  let response = undefined;
992
1036
  if (isByClientOrder) {
993
1037
  request['client_order_id'] = clientOrderIdExchangeSpecific;
@@ -1187,9 +1231,9 @@ export default class woo extends Exchange {
1187
1231
  /**
1188
1232
  * @method
1189
1233
  * @name woo#fetchOrders
1234
+ * @description fetches information on multiple orders made by the user
1190
1235
  * @see https://docs.woo.org/#get-orders
1191
1236
  * @see https://docs.woo.org/#get-algo-orders
1192
- * @description fetches information on multiple orders made by the user
1193
1237
  * @param {string} symbol unified market symbol of the market orders were made in
1194
1238
  * @param {int} [since] the earliest time in ms to fetch orders for
1195
1239
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1197,19 +1241,21 @@ export default class woo extends Exchange {
1197
1241
  * @param {boolean} [params.stop] whether the order is a stop/algo order
1198
1242
  * @param {boolean} [params.isTriggered] whether the order has been triggered (false by default)
1199
1243
  * @param {string} [params.side] 'buy' or 'sell'
1244
+ * @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
1200
1245
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1201
1246
  */
1202
1247
  await this.loadMarkets();
1203
1248
  const request = {};
1204
1249
  let market = undefined;
1205
1250
  const stop = this.safeValue(params, 'stop');
1206
- params = this.omit(params, 'stop');
1251
+ const trailing = this.safeValue(params, 'trailing', false);
1252
+ params = this.omit(params, ['stop', 'trailing']);
1207
1253
  if (symbol !== undefined) {
1208
1254
  market = this.market(symbol);
1209
1255
  request['symbol'] = market['id'];
1210
1256
  }
1211
1257
  if (since !== undefined) {
1212
- if (stop) {
1258
+ if (stop || trailing) {
1213
1259
  request['createdTimeStart'] = since;
1214
1260
  }
1215
1261
  else {
@@ -1219,8 +1265,11 @@ export default class woo extends Exchange {
1219
1265
  if (stop) {
1220
1266
  request['algoType'] = 'stop';
1221
1267
  }
1268
+ else if (trailing) {
1269
+ request['algoType'] = 'TRAILING_STOP';
1270
+ }
1222
1271
  let response = undefined;
1223
- if (stop) {
1272
+ if (stop || trailing) {
1224
1273
  response = await this.v3PrivateGetAlgoOrders(this.extend(request, params));
1225
1274
  }
1226
1275
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.2.5",
3
+ "version": "4.2.6",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",