ccxt 4.2.12 → 4.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +1338 -366
  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 +125 -54
  8. package/dist/cjs/js/src/binance.js +142 -27
  9. package/dist/cjs/js/src/binanceus.js +8 -0
  10. package/dist/cjs/js/src/bingx.js +110 -36
  11. package/dist/cjs/js/src/bitget.js +17 -6
  12. package/dist/cjs/js/src/bitmart.js +3 -3
  13. package/dist/cjs/js/src/bybit.js +5 -1
  14. package/dist/cjs/js/src/coinbase.js +176 -26
  15. package/dist/cjs/js/src/coinex.js +3 -0
  16. package/dist/cjs/js/src/coinlist.js +1 -1
  17. package/dist/cjs/js/src/coinone.js +1 -1
  18. package/dist/cjs/js/src/delta.js +7 -1
  19. package/dist/cjs/js/src/deribit.js +1 -1
  20. package/dist/cjs/js/src/gate.js +79 -56
  21. package/dist/cjs/js/src/gemini.js +1 -1
  22. package/dist/cjs/js/src/htx.js +151 -1
  23. package/dist/cjs/js/src/independentreserve.js +7 -5
  24. package/dist/cjs/js/src/kraken.js +22 -14
  25. package/dist/cjs/js/src/kucoin.js +5 -0
  26. package/dist/cjs/js/src/kucoinfutures.js +131 -77
  27. package/dist/cjs/js/src/lbank.js +59 -33
  28. package/dist/cjs/js/src/oceanex.js +1 -1
  29. package/dist/cjs/js/src/okx.js +11 -9
  30. package/dist/cjs/js/src/phemex.js +9 -2
  31. package/dist/cjs/js/src/pro/kraken.js +1 -1
  32. package/dist/cjs/js/src/pro/okx.js +52 -2
  33. package/dist/cjs/js/src/probit.js +4 -2
  34. package/dist/cjs/js/src/wavesexchange.js +1 -1
  35. package/dist/cjs/js/src/woo.js +56 -2
  36. package/js/ccxt.d.ts +1 -1
  37. package/js/ccxt.js +1 -1
  38. package/js/src/abstract/bigone.d.ts +1 -0
  39. package/js/src/abstract/bingx.d.ts +2 -0
  40. package/js/src/abstract/kucoin.d.ts +4 -0
  41. package/js/src/abstract/kucoinfutures.d.ts +4 -0
  42. package/js/src/abstract/okx.d.ts +1 -0
  43. package/js/src/base/Exchange.d.ts +8 -0
  44. package/js/src/base/Exchange.js +148 -1
  45. package/js/src/bigone.d.ts +2 -0
  46. package/js/src/bigone.js +125 -54
  47. package/js/src/binance.d.ts +9 -0
  48. package/js/src/binance.js +142 -27
  49. package/js/src/binanceus.js +8 -0
  50. package/js/src/bingx.js +110 -36
  51. package/js/src/bitget.js +17 -6
  52. package/js/src/bitmart.js +3 -3
  53. package/js/src/bybit.js +5 -1
  54. package/js/src/coinbase.d.ts +26 -3
  55. package/js/src/coinbase.js +176 -26
  56. package/js/src/coinex.js +3 -0
  57. package/js/src/coinlist.js +1 -1
  58. package/js/src/coinone.js +1 -1
  59. package/js/src/delta.js +7 -1
  60. package/js/src/deribit.js +1 -1
  61. package/js/src/gate.js +79 -56
  62. package/js/src/gemini.js +1 -1
  63. package/js/src/htx.d.ts +10 -0
  64. package/js/src/htx.js +151 -1
  65. package/js/src/independentreserve.js +7 -5
  66. package/js/src/kraken.js +22 -14
  67. package/js/src/kucoin.js +5 -0
  68. package/js/src/kucoinfutures.d.ts +4 -2
  69. package/js/src/kucoinfutures.js +131 -77
  70. package/js/src/lbank.js +59 -33
  71. package/js/src/oceanex.js +1 -1
  72. package/js/src/okx.js +11 -9
  73. package/js/src/phemex.js +9 -2
  74. package/js/src/pro/kraken.js +1 -1
  75. package/js/src/pro/okx.d.ts +1 -0
  76. package/js/src/pro/okx.js +52 -2
  77. package/js/src/probit.js +4 -2
  78. package/js/src/wavesexchange.js +1 -1
  79. package/js/src/woo.d.ts +2 -0
  80. package/js/src/woo.js +56 -2
  81. package/package.json +1 -1
package/js/src/lbank.js CHANGED
@@ -932,13 +932,17 @@ export default class lbank extends Exchange {
932
932
  else {
933
933
  request['size'] = 600; // max
934
934
  }
935
- let method = this.safeString(params, 'method');
935
+ const options = this.safeValue(this.options, 'fetchTrades', {});
936
+ const defaultMethod = this.safeString(options, 'method', 'spotPublicGetTrades');
937
+ const method = this.safeString(params, 'method', defaultMethod);
936
938
  params = this.omit(params, 'method');
937
- if (method === undefined) {
938
- const options = this.safeValue(this.options, 'fetchTrades', {});
939
- method = this.safeString(options, 'method', 'spotPublicGetTrades');
939
+ let response = undefined;
940
+ if (method === 'spotPublicGetSupplementTrades') {
941
+ response = await this.spotPublicGetSupplementTrades(this.extend(request, params));
942
+ }
943
+ else {
944
+ response = await this.spotPublicGetTrades(this.extend(request, params));
940
945
  }
941
- const response = await this[method](this.extend(request, params));
942
946
  //
943
947
  // {
944
948
  // "result":"true",
@@ -1175,12 +1179,19 @@ export default class lbank extends Exchange {
1175
1179
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1176
1180
  */
1177
1181
  await this.loadMarkets();
1178
- let method = this.safeString(params, 'method');
1179
- if (method === undefined) {
1180
- const options = this.safeValue(this.options, 'fetchBalance', {});
1181
- method = this.safeString(options, 'method', 'spotPrivatePostSupplementUserInfo');
1182
+ const options = this.safeValue(this.options, 'fetchBalance', {});
1183
+ const defaultMethod = this.safeString(options, 'method', 'spotPrivatePostSupplementUserInfo');
1184
+ const method = this.safeString(params, 'method', defaultMethod);
1185
+ let response = undefined;
1186
+ if (method === 'spotPrivatePostSupplementUserInfoAccount') {
1187
+ response = await this.spotPrivatePostSupplementUserInfoAccount();
1188
+ }
1189
+ else if (method === 'spotPrivatePostUserInfo') {
1190
+ response = await this.spotPrivatePostUserInfo();
1191
+ }
1192
+ else {
1193
+ response = await this.spotPrivatePostSupplementUserInfo();
1182
1194
  }
1183
- const response = await this[method]();
1184
1195
  //
1185
1196
  // {
1186
1197
  // "result": "true",
@@ -1365,14 +1376,17 @@ export default class lbank extends Exchange {
1365
1376
  if (clientOrderId !== undefined) {
1366
1377
  request['custom_id'] = clientOrderId;
1367
1378
  }
1368
- let method = undefined;
1369
- method = this.safeString(params, 'method');
1379
+ const options = this.safeValue(this.options, 'createOrder', {});
1380
+ const defaultMethod = this.safeString(options, 'method', 'spotPrivatePostSupplementCreateOrder');
1381
+ const method = this.safeString(params, 'method', defaultMethod);
1370
1382
  params = this.omit(params, 'method');
1371
- if (method === undefined) {
1372
- const options = this.safeValue(this.options, 'createOrder', {});
1373
- method = this.safeString(options, 'method', 'spotPrivatePostSupplementCreateOrder');
1383
+ let response = undefined;
1384
+ if (method === 'spotPrivatePostCreateOrder') {
1385
+ response = await this.spotPrivatePostCreateOrder(this.extend(request, params));
1386
+ }
1387
+ else {
1388
+ response = await this.spotPrivatePostSupplementCreateOrder(this.extend(request, params));
1374
1389
  }
1375
- const response = await this[method](this.extend(request, params));
1376
1390
  //
1377
1391
  // {
1378
1392
  // "result":true,
@@ -1907,13 +1921,18 @@ export default class lbank extends Exchange {
1907
1921
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
1908
1922
  */
1909
1923
  await this.loadMarkets();
1910
- let method = this.safeString(params, 'method');
1924
+ const options = this.safeValue(this.options, 'fetchDepositAddress', {});
1925
+ const defaultMethod = this.safeString(options, 'method', 'fetchDepositAddressDefault');
1926
+ const method = this.safeString(params, 'method', defaultMethod);
1911
1927
  params = this.omit(params, 'method');
1912
- if (method === undefined) {
1913
- const options = this.safeValue(this.options, 'fetchDepositAddress', {});
1914
- method = this.safeString(options, 'method', 'fetchDepositAddressDefault');
1928
+ let response = undefined;
1929
+ if (method === 'fetchDepositAddressSupplement') {
1930
+ response = await this.fetchDepositAddressSupplement(code, params);
1915
1931
  }
1916
- return await this[method](code, params);
1932
+ else {
1933
+ response = await this.fetchDepositAddressDefault(code, params);
1934
+ }
1935
+ return response;
1917
1936
  }
1918
1937
  async fetchDepositAddressDefault(code, params = {}) {
1919
1938
  await this.loadMarkets();
@@ -2285,13 +2304,16 @@ export default class lbank extends Exchange {
2285
2304
  const isAuthorized = this.checkRequiredCredentials(false);
2286
2305
  let result = undefined;
2287
2306
  if (isAuthorized === true) {
2288
- let method = this.safeString(params, 'method');
2307
+ const options = this.safeValue(this.options, 'fetchTransactionFees', {});
2308
+ const defaultMethod = this.safeString(options, 'method', 'fetchPrivateTransactionFees');
2309
+ const method = this.safeString(params, 'method', defaultMethod);
2289
2310
  params = this.omit(params, 'method');
2290
- if (method === undefined) {
2291
- const options = this.safeValue(this.options, 'fetchTransactionFees', {});
2292
- method = this.safeString(options, 'method', 'fetchPrivateTransactionFees');
2311
+ if (method === 'fetchPublicTransactionFees') {
2312
+ result = await this.fetchPublicTransactionFees(params);
2313
+ }
2314
+ else {
2315
+ result = await this.fetchPrivateTransactionFees(params);
2293
2316
  }
2294
- result = await this[method](params);
2295
2317
  }
2296
2318
  else {
2297
2319
  result = await this.fetchPublicTransactionFees(params);
@@ -2429,19 +2451,23 @@ export default class lbank extends Exchange {
2429
2451
  */
2430
2452
  await this.loadMarkets();
2431
2453
  const isAuthorized = this.checkRequiredCredentials(false);
2432
- let method = undefined;
2454
+ const response = undefined;
2433
2455
  if (isAuthorized === true) {
2434
- method = this.safeString(params, 'method');
2456
+ const options = this.safeValue(this.options, 'fetchDepositWithdrawFees', {});
2457
+ const defaultMethod = this.safeString(options, 'method', 'fetchPrivateDepositWithdrawFees');
2458
+ const method = this.safeString(params, 'method', defaultMethod);
2435
2459
  params = this.omit(params, 'method');
2436
- if (method === undefined) {
2437
- const options = this.safeValue(this.options, 'fetchDepositWithdrawFees', {});
2438
- method = this.safeString(options, 'method', 'fetchPrivateDepositWithdrawFees');
2460
+ if (method === 'fetchPublicDepositWithdrawFees') {
2461
+ await this.fetchPublicDepositWithdrawFees(codes, params);
2462
+ }
2463
+ else {
2464
+ await this.fetchPrivateDepositWithdrawFees(codes, params);
2439
2465
  }
2440
2466
  }
2441
2467
  else {
2442
- method = 'fetchPublicDepositWithdrawFees';
2468
+ await this.fetchPublicDepositWithdrawFees(codes, params);
2443
2469
  }
2444
- return await this[method](codes, params);
2470
+ return response;
2445
2471
  }
2446
2472
  async fetchPrivateDepositWithdrawFees(codes = undefined, params = {}) {
2447
2473
  // complete response
package/js/src/oceanex.js CHANGED
@@ -475,7 +475,7 @@ export default class oceanex extends Exchange {
475
475
  'market': market['id'],
476
476
  };
477
477
  if (limit !== undefined) {
478
- request['limit'] = limit;
478
+ request['limit'] = Math.min(limit, 1000);
479
479
  }
480
480
  const response = await this.publicGetTrades(this.extend(request, params));
481
481
  //
package/js/src/okx.js CHANGED
@@ -41,14 +41,18 @@ export default class okx extends Exchange {
41
41
  'createDepositAddress': false,
42
42
  'createMarketBuyOrderWithCost': true,
43
43
  'createMarketSellOrderWithCost': true,
44
- 'createTrailingPercentOrder': true,
45
44
  'createOrder': true,
46
45
  'createOrders': true,
46
+ 'createOrderWithTakeProfitAndStopLoss': true,
47
47
  'createPostOnlyOrder': true,
48
48
  'createReduceOnlyOrder': true,
49
+ 'createStopLossOrder': true,
49
50
  'createStopLimitOrder': true,
50
51
  'createStopMarketOrder': true,
51
52
  'createStopOrder': true,
53
+ 'createTakeProfitOrder': true,
54
+ 'createTrailingPercentOrder': true,
55
+ 'createTriggerOrder': true,
52
56
  'editOrder': true,
53
57
  'fetchAccounts': true,
54
58
  'fetchBalance': true,
@@ -262,6 +266,7 @@ export default class okx extends Exchange {
262
266
  'sprd/order': 1 / 3,
263
267
  'sprd/orders-pending': 1 / 3,
264
268
  'sprd/orders-history': 1 / 2,
269
+ 'sprd/orders-history-archive': 1 / 2,
265
270
  'sprd/trades': 1 / 3,
266
271
  // trade
267
272
  'trade/order': 1 / 3,
@@ -2135,17 +2140,14 @@ export default class okx extends Exchange {
2135
2140
  let defaultType = 'Candles';
2136
2141
  if (since !== undefined) {
2137
2142
  const now = this.milliseconds();
2138
- const difference = now - since;
2139
2143
  const durationInMilliseconds = duration * 1000;
2140
- // if the since timestamp is more than limit candles back in the past
2141
- // additional one bar for max offset to round the current day to UTC
2142
- const calc = (1440 - limit - 1) * durationInMilliseconds;
2143
- if (difference > calc) {
2144
+ // switch to history candles if since is past the cutoff for current candles
2145
+ const historyBorder = now - ((1440 - 1) * durationInMilliseconds);
2146
+ if (since < historyBorder) {
2144
2147
  defaultType = 'HistoryCandles';
2145
2148
  }
2146
- const startTime = Math.max(since - 1, 0);
2147
- request['before'] = startTime;
2148
- request['after'] = this.sum(startTime, durationInMilliseconds * limit);
2149
+ request['before'] = since;
2150
+ request['after'] = this.sum(since, durationInMilliseconds * limit);
2149
2151
  }
2150
2152
  const until = this.safeInteger(params, 'until');
2151
2153
  if (until !== undefined) {
package/js/src/phemex.js CHANGED
@@ -455,7 +455,7 @@ export default class phemex extends Exchange {
455
455
  },
456
456
  },
457
457
  'options': {
458
- 'brokerId': 'CCXT',
458
+ 'brokerId': 'CCXT123456',
459
459
  'x-phemex-request-expiry': 60,
460
460
  'createOrderByQuoteRequiresPrice': true,
461
461
  'networks': {
@@ -2480,7 +2480,7 @@ export default class phemex extends Exchange {
2480
2480
  const takeProfit = this.safeValue(params, 'takeProfit');
2481
2481
  const takeProfitDefined = (takeProfit !== undefined);
2482
2482
  if (clientOrderId === undefined) {
2483
- const brokerId = this.safeString(this.options, 'brokerId');
2483
+ const brokerId = this.safeString(this.options, 'brokerId', 'CCXT123456');
2484
2484
  if (brokerId !== undefined) {
2485
2485
  request['clOrdID'] = brokerId + this.uuid16();
2486
2486
  }
@@ -4276,6 +4276,13 @@ export default class phemex extends Exchange {
4276
4276
  };
4277
4277
  let payload = '';
4278
4278
  if (method === 'POST') {
4279
+ const isOrderPlacement = (path === 'g-orders') || (path === 'spot/orders') || (path === 'orders');
4280
+ if (isOrderPlacement) {
4281
+ if (this.safeString(params, 'clOrdID') === undefined) {
4282
+ const id = this.safeString(this.options, 'brokerId', 'CCXT123456');
4283
+ params['clOrdID'] = id + this.uuid16();
4284
+ }
4285
+ }
4279
4286
  payload = this.json(params);
4280
4287
  body = payload;
4281
4288
  headers['Content-Type'] = 'application/json';
@@ -545,7 +545,7 @@ export default class kraken extends krakenRest {
545
545
  ],
546
546
  'subscription': {
547
547
  'name': name,
548
- 'interval': this.safeString(this.timeframes, timeframe, timeframe),
548
+ 'interval': this.safeValue(this.timeframes, timeframe, timeframe),
549
549
  },
550
550
  };
551
551
  const request = this.deepExtend(subscribe, params);
@@ -13,6 +13,7 @@ export default class okx extends okxRest {
13
13
  watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
14
14
  handleTicker(client: Client, message: any): any;
15
15
  watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
16
+ watchOHLCVForSymbols(symbolsAndTimeframes: string[][], since?: Int, limit?: Int, params?: {}): Promise<import("../base/types.js").Dictionary<import("../base/types.js").Dictionary<OHLCV[]>>>;
16
17
  handleOHLCV(client: Client, message: any): void;
17
18
  watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
18
19
  watchOrderBookForSymbols(symbols: string[], limit?: Int, params?: {}): Promise<OrderBook>;
package/js/src/pro/okx.js CHANGED
@@ -23,6 +23,7 @@ export default class okx extends okxRest {
23
23
  'watchOrderBookForSymbols': true,
24
24
  'watchBalance': true,
25
25
  'watchOHLCV': true,
26
+ 'watchOHLCVForSymbols': true,
26
27
  'watchOrders': true,
27
28
  'watchMyTrades': true,
28
29
  'watchPositions': true,
@@ -359,6 +360,50 @@ export default class okx extends okxRest {
359
360
  }
360
361
  return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
361
362
  }
363
+ async watchOHLCVForSymbols(symbolsAndTimeframes, since = undefined, limit = undefined, params = {}) {
364
+ /**
365
+ * @method
366
+ * @name okx#watchOHLCVForSymbols
367
+ * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
368
+ * @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
369
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
370
+ * @param {int} [limit] the maximum amount of candles to fetch
371
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
372
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
373
+ */
374
+ const symbolsLength = symbolsAndTimeframes.length;
375
+ if (symbolsLength === 0 || !Array.isArray(symbolsAndTimeframes[0])) {
376
+ throw new ArgumentsRequired(this.id + " watchOHLCVForSymbols() requires a an array of symbols and timeframes, like [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]");
377
+ }
378
+ await this.loadMarkets();
379
+ const topics = [];
380
+ const messageHashes = [];
381
+ for (let i = 0; i < symbolsAndTimeframes.length; i++) {
382
+ const symbolAndTimeframe = symbolsAndTimeframes[i];
383
+ const sym = symbolAndTimeframe[0];
384
+ const tf = symbolAndTimeframe[1];
385
+ const marketId = this.marketId(sym);
386
+ const interval = this.safeString(this.timeframes, tf, tf);
387
+ const channel = 'candle' + interval;
388
+ const topic = {
389
+ 'channel': channel,
390
+ 'instId': marketId,
391
+ };
392
+ topics.push(topic);
393
+ messageHashes.push('multi:' + channel + ':' + sym);
394
+ }
395
+ const request = {
396
+ 'op': 'subscribe',
397
+ 'args': topics,
398
+ };
399
+ const url = this.getUrl('candle', 'public');
400
+ const [symbol, timeframe, candles] = await this.watchMultiple(url, messageHashes, request, messageHashes);
401
+ if (this.newUpdates) {
402
+ limit = candles.getLimit(symbol, limit);
403
+ }
404
+ const filtered = this.filterBySinceLimit(candles, since, limit, 0, true);
405
+ return this.createOHLCVObject(symbol, timeframe, filtered);
406
+ }
362
407
  handleOHLCV(client, message) {
363
408
  //
364
409
  // {
@@ -381,7 +426,7 @@ export default class okx extends okxRest {
381
426
  const data = this.safeValue(message, 'data', []);
382
427
  const marketId = this.safeString(arg, 'instId');
383
428
  const market = this.safeMarket(marketId);
384
- const symbol = market['id'];
429
+ const symbol = market['symbol'];
385
430
  const interval = channel.replace('candle', '');
386
431
  // use a reverse lookup in a static map instead
387
432
  const timeframe = this.findTimeframe(interval);
@@ -395,8 +440,13 @@ export default class okx extends okxRest {
395
440
  this.ohlcvs[symbol][timeframe] = stored;
396
441
  }
397
442
  stored.append(parsed);
398
- const messageHash = channel + ':' + marketId;
443
+ const messageHash = channel + ':' + market['id'];
399
444
  client.resolve(stored, messageHash);
445
+ // for multiOHLCV we need special object, as opposed to other "multi"
446
+ // methods, because OHLCV response item does not contain symbol
447
+ // or timeframe, thus otherwise it would be unrecognizable
448
+ const messageHashForMulti = 'multi:' + channel + ':' + symbol;
449
+ client.resolve([symbol, timeframe, stored], messageHashForMulti);
400
450
  }
401
451
  }
402
452
  async watchOrderBook(symbol, limit = undefined, params = {}) {
package/js/src/probit.js CHANGED
@@ -779,7 +779,6 @@ export default class probit extends Exchange {
779
779
  const market = this.market(symbol);
780
780
  const request = {
781
781
  'market_id': market['id'],
782
- 'limit': 100,
783
782
  'start_time': '1970-01-01T00:00:00.000Z',
784
783
  'end_time': this.iso8601(this.milliseconds()),
785
784
  };
@@ -787,7 +786,10 @@ export default class probit extends Exchange {
787
786
  request['start_time'] = this.iso8601(since);
788
787
  }
789
788
  if (limit !== undefined) {
790
- request['limit'] = Math.min(limit, 10000);
789
+ request['limit'] = Math.min(limit, 1000);
790
+ }
791
+ else {
792
+ request['limit'] = 1000; // required to set any value
791
793
  }
792
794
  const response = await this.publicGetTrade(this.extend(request, params));
793
795
  //
@@ -2095,7 +2095,7 @@ export default class wavesexchange extends Exchange {
2095
2095
  'priceAsset': market['quoteId'],
2096
2096
  };
2097
2097
  if (limit !== undefined) {
2098
- request['limit'] = limit;
2098
+ request['limit'] = Math.min(limit, 100);
2099
2099
  }
2100
2100
  if (since !== undefined) {
2101
2101
  request['timeStart'] = since;
package/js/src/woo.d.ts CHANGED
@@ -14,6 +14,8 @@ export default class woo extends Exchange {
14
14
  fetchTradingFees(params?: {}): Promise<{}>;
15
15
  fetchCurrencies(params?: {}): Promise<{}>;
16
16
  createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
17
+ createTrailingAmountOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, trailingAmount?: any, trailingTriggerPrice?: any, params?: {}): Promise<Order>;
18
+ createTrailingPercentOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, trailingPercent?: any, trailingTriggerPrice?: any, params?: {}): Promise<Order>;
17
19
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
18
20
  editOrder(id: string, symbol: any, type: any, side: any, amount?: any, price?: any, params?: {}): Promise<Order>;
19
21
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
package/js/src/woo.js CHANGED
@@ -44,13 +44,17 @@ export default class woo extends Exchange {
44
44
  'createMarketOrder': false,
45
45
  'createMarketOrderWithCost': false,
46
46
  'createMarketSellOrderWithCost': false,
47
- 'createTrailingAmountOrder': true,
48
- 'createTrailingPercentOrder': true,
49
47
  'createOrder': true,
50
48
  'createReduceOnlyOrder': true,
51
49
  'createStopLimitOrder': false,
52
50
  'createStopMarketOrder': false,
53
51
  'createStopOrder': false,
52
+ 'createTrailingAmountOrder': true,
53
+ 'createTrailingPercentOrder': true,
54
+ 'createTriggerOrder': true,
55
+ 'createTakeProfitOrder': true,
56
+ 'createStopLossOrder': true,
57
+ 'createOrderWithTakeProfitAndStopLoss': true,
54
58
  'fetchAccounts': true,
55
59
  'fetchBalance': true,
56
60
  'fetchCanceledOrders': false,
@@ -766,6 +770,56 @@ export default class woo extends Exchange {
766
770
  params['createMarketBuyOrderRequiresPrice'] = false;
767
771
  return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
768
772
  }
773
+ async createTrailingAmountOrder(symbol, type, side, amount, price = undefined, trailingAmount = undefined, trailingTriggerPrice = undefined, params = {}) {
774
+ /**
775
+ * @method
776
+ * @name woo#createTrailingAmountOrder
777
+ * @description create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
778
+ * @param {string} symbol unified symbol of the market to create an order in
779
+ * @param {string} type 'market' or 'limit'
780
+ * @param {string} side 'buy' or 'sell'
781
+ * @param {float} amount how much you want to trade in units of the base currency, or number of contracts
782
+ * @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
783
+ * @param {float} trailingAmount the quote amount to trail away from the current market price
784
+ * @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
785
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
786
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
787
+ */
788
+ if (trailingAmount === undefined) {
789
+ throw new ArgumentsRequired(this.id + ' createTrailingAmountOrder() requires a trailingAmount argument');
790
+ }
791
+ if (trailingTriggerPrice === undefined) {
792
+ throw new ArgumentsRequired(this.id + ' createTrailingAmountOrder() requires a trailingTriggerPrice argument');
793
+ }
794
+ params['trailingAmount'] = trailingAmount;
795
+ params['trailingTriggerPrice'] = trailingTriggerPrice;
796
+ return await this.createOrder(symbol, type, side, amount, price, params);
797
+ }
798
+ async createTrailingPercentOrder(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
799
+ /**
800
+ * @method
801
+ * @name woo#createTrailingPercentOrder
802
+ * @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
803
+ * @param {string} symbol unified symbol of the market to create an order in
804
+ * @param {string} type 'market' or 'limit'
805
+ * @param {string} side 'buy' or 'sell'
806
+ * @param {float} amount how much you want to trade in units of the base currency, or number of contracts
807
+ * @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
808
+ * @param {float} trailingPercent the percent to trail away from the current market price
809
+ * @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
810
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
811
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
812
+ */
813
+ if (trailingPercent === undefined) {
814
+ throw new ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingPercent argument');
815
+ }
816
+ if (trailingTriggerPrice === undefined) {
817
+ throw new ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingTriggerPrice argument');
818
+ }
819
+ params['trailingPercent'] = trailingPercent;
820
+ params['trailingTriggerPrice'] = trailingTriggerPrice;
821
+ return await this.createOrder(symbol, type, side, amount, price, params);
822
+ }
769
823
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
770
824
  /**
771
825
  * @method
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.2.12",
3
+ "version": "4.2.14",
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",