ccxt 4.2.12 → 4.2.13

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 (63) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +718 -240
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/js/ccxt.js +1 -1
  6. package/dist/cjs/js/src/bigone.js +89 -22
  7. package/dist/cjs/js/src/binance.js +34 -27
  8. package/dist/cjs/js/src/bingx.js +106 -36
  9. package/dist/cjs/js/src/bitget.js +13 -6
  10. package/dist/cjs/js/src/bitmart.js +3 -3
  11. package/dist/cjs/js/src/bybit.js +1 -1
  12. package/dist/cjs/js/src/coinbase.js +176 -26
  13. package/dist/cjs/js/src/coinlist.js +1 -1
  14. package/dist/cjs/js/src/coinone.js +1 -1
  15. package/dist/cjs/js/src/deribit.js +1 -1
  16. package/dist/cjs/js/src/gate.js +74 -56
  17. package/dist/cjs/js/src/gemini.js +1 -1
  18. package/dist/cjs/js/src/htx.js +26 -1
  19. package/dist/cjs/js/src/independentreserve.js +7 -5
  20. package/dist/cjs/js/src/kraken.js +3 -7
  21. package/dist/cjs/js/src/lbank.js +59 -33
  22. package/dist/cjs/js/src/oceanex.js +1 -1
  23. package/dist/cjs/js/src/okx.js +2 -1
  24. package/dist/cjs/js/src/phemex.js +9 -2
  25. package/dist/cjs/js/src/pro/kraken.js +1 -1
  26. package/dist/cjs/js/src/pro/okx.js +52 -2
  27. package/dist/cjs/js/src/probit.js +4 -2
  28. package/dist/cjs/js/src/wavesexchange.js +1 -1
  29. package/dist/cjs/js/src/woo.js +52 -2
  30. package/js/ccxt.d.ts +1 -1
  31. package/js/ccxt.js +1 -1
  32. package/js/src/abstract/bingx.d.ts +2 -0
  33. package/js/src/abstract/okx.d.ts +1 -0
  34. package/js/src/bigone.d.ts +2 -0
  35. package/js/src/bigone.js +89 -22
  36. package/js/src/binance.js +34 -27
  37. package/js/src/bingx.js +106 -36
  38. package/js/src/bitget.js +13 -6
  39. package/js/src/bitmart.js +3 -3
  40. package/js/src/bybit.js +1 -1
  41. package/js/src/coinbase.d.ts +26 -3
  42. package/js/src/coinbase.js +176 -26
  43. package/js/src/coinlist.js +1 -1
  44. package/js/src/coinone.js +1 -1
  45. package/js/src/deribit.js +1 -1
  46. package/js/src/gate.js +74 -56
  47. package/js/src/gemini.js +1 -1
  48. package/js/src/htx.d.ts +1 -0
  49. package/js/src/htx.js +26 -1
  50. package/js/src/independentreserve.js +7 -5
  51. package/js/src/kraken.js +3 -7
  52. package/js/src/lbank.js +59 -33
  53. package/js/src/oceanex.js +1 -1
  54. package/js/src/okx.js +2 -1
  55. package/js/src/phemex.js +9 -2
  56. package/js/src/pro/kraken.js +1 -1
  57. package/js/src/pro/okx.d.ts +1 -0
  58. package/js/src/pro/okx.js +52 -2
  59. package/js/src/probit.js +4 -2
  60. package/js/src/wavesexchange.js +1 -1
  61. package/js/src/woo.d.ts +2 -0
  62. package/js/src/woo.js +52 -2
  63. package/package.json +1 -1
@@ -16260,29 +16260,90 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
16260
16260
  */
16261
16261
  await this.loadMarkets();
16262
16262
  const market = this.market(symbol);
16263
- const request = {
16264
- 'asset_pair_name': market['id'],
16265
- };
16266
- if (limit !== undefined) {
16267
- request['limit'] = limit; // default 50, max 200
16263
+ let response = undefined;
16264
+ if (market['contract']) {
16265
+ const request = {
16266
+ 'symbol': market['id'],
16267
+ };
16268
+ response = await this.contractPublicGetDepthSymbolSnapshot(this.extend(request, params));
16269
+ //
16270
+ // {
16271
+ // bids: {
16272
+ // '20000': '20',
16273
+ // ...
16274
+ // '34552': '64851',
16275
+ // '34526.5': '59594',
16276
+ // ...
16277
+ // '34551.5': '29711'
16278
+ // },
16279
+ // asks: {
16280
+ // '34557': '34395',
16281
+ // ...
16282
+ // '40000': '20',
16283
+ // '34611.5': '56024',
16284
+ // ...
16285
+ // '34578.5': '66367'
16286
+ // },
16287
+ // to: '59737174',
16288
+ // lastPrice: '34554.5',
16289
+ // bestPrices: {
16290
+ // ask: '34557.0',
16291
+ // bid: '34552.0'
16292
+ // },
16293
+ // from: '0'
16294
+ // }
16295
+ //
16296
+ return this.parseContractOrderBook(response, market['symbol'], limit);
16268
16297
  }
16269
- const response = await this.publicGetAssetPairsAssetPairNameDepth(this.extend(request, params));
16270
- //
16271
- // {
16272
- // "code":0,
16273
- // "data": {
16274
- // "asset_pair_name": "EOS-BTC",
16275
- // "bids": [
16276
- // { "price": "42", "order_count": 4, "quantity": "23.33363711" }
16277
- // ],
16278
- // "asks": [
16279
- // { "price": "45", "order_count": 2, "quantity": "4193.3283464" }
16280
- // ]
16281
- // }
16282
- // }
16283
- //
16284
- const orderbook = this.safeValue(response, 'data', {});
16285
- return this.parseOrderBook(orderbook, market['symbol'], undefined, 'bids', 'asks', 'price', 'quantity');
16298
+ else {
16299
+ const request = {
16300
+ 'asset_pair_name': market['id'],
16301
+ };
16302
+ if (limit !== undefined) {
16303
+ request['limit'] = limit; // default 50, max 200
16304
+ }
16305
+ response = await this.publicGetAssetPairsAssetPairNameDepth(this.extend(request, params));
16306
+ //
16307
+ // {
16308
+ // "code":0,
16309
+ // "data": {
16310
+ // "asset_pair_name": "EOS-BTC",
16311
+ // "bids": [
16312
+ // { "price": "42", "order_count": 4, "quantity": "23.33363711" }
16313
+ // ],
16314
+ // "asks": [
16315
+ // { "price": "45", "order_count": 2, "quantity": "4193.3283464" }
16316
+ // ]
16317
+ // }
16318
+ // }
16319
+ //
16320
+ const orderbook = this.safeValue(response, 'data', {});
16321
+ return this.parseOrderBook(orderbook, market['symbol'], undefined, 'bids', 'asks', 'price', 'quantity');
16322
+ }
16323
+ }
16324
+ parseContractBidsAsks(bidsAsks) {
16325
+ const bidsAsksKeys = Object.keys(bidsAsks);
16326
+ const result = [];
16327
+ for (let i = 0; i < bidsAsksKeys.length; i++) {
16328
+ const price = bidsAsksKeys[i];
16329
+ const amount = bidsAsks[price];
16330
+ result.push([this.parseNumber(price), this.parseNumber(amount)]);
16331
+ }
16332
+ return result;
16333
+ }
16334
+ parseContractOrderBook(orderbook, symbol, limit = undefined) {
16335
+ const responseBids = this.safeValue(orderbook, 'bids');
16336
+ const responseAsks = this.safeValue(orderbook, 'asks');
16337
+ const bids = this.parseContractBidsAsks(responseBids);
16338
+ const asks = this.parseContractBidsAsks(responseAsks);
16339
+ return {
16340
+ 'symbol': symbol,
16341
+ 'bids': this.filterByLimit(this.sortBy(bids, 0, true), limit),
16342
+ 'asks': this.filterByLimit(this.sortBy(asks, 0), limit),
16343
+ 'timestamp': undefined,
16344
+ 'datetime': undefined,
16345
+ 'nonce': undefined,
16346
+ };
16286
16347
  }
16287
16348
  parseTrade(trade, market = undefined) {
16288
16349
  //
@@ -16442,6 +16503,9 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
16442
16503
  */
16443
16504
  await this.loadMarkets();
16444
16505
  const market = this.market(symbol);
16506
+ if (market['contract']) {
16507
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchTrades () can only fetch trades for spot markets');
16508
+ }
16445
16509
  const request = {
16446
16510
  'asset_pair_name': market['id'],
16447
16511
  };
@@ -16504,6 +16568,9 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
16504
16568
  */
16505
16569
  await this.loadMarkets();
16506
16570
  const market = this.market(symbol);
16571
+ if (market['contract']) {
16572
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchOHLCV () can only fetch ohlcvs for spot markets');
16573
+ }
16507
16574
  if (limit === undefined) {
16508
16575
  limit = 100; // default 100, max 500
16509
16576
  }
@@ -17528,7 +17595,6 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
17528
17595
  'createMarketBuyOrderWithCost': true,
17529
17596
  'createMarketOrderWithCost': true,
17530
17597
  'createMarketSellOrderWithCost': true,
17531
- 'createTrailingPercentOrder': true,
17532
17598
  'createOrder': true,
17533
17599
  'createOrders': true,
17534
17600
  'createPostOnlyOrder': true,
@@ -17536,6 +17602,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
17536
17602
  'createStopLimitOrder': true,
17537
17603
  'createStopMarketOrder': false,
17538
17604
  'createStopOrder': true,
17605
+ 'createTrailingPercentOrder': true,
17539
17606
  'editOrder': true,
17540
17607
  'fetchAccounts': undefined,
17541
17608
  'fetchBalance': true,
@@ -23589,12 +23656,13 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23589
23656
  * @name binance#transfer
23590
23657
  * @description transfer currency internally between wallets on the same account
23591
23658
  * @see https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer-user_data
23592
- * @see https://binance-docs.github.io/apidocs/spot/en/#isolated-margin-account-transfer-margin
23593
23659
  * @param {string} code unified currency code
23594
23660
  * @param {float} amount amount to transfer
23595
23661
  * @param {string} fromAccount account to transfer from
23596
23662
  * @param {string} toAccount account to transfer to
23597
23663
  * @param {object} [params] extra parameters specific to the exchange API endpoint
23664
+ * @param {string} [params.type] exchange specific transfer type
23665
+ * @param {string} [params.symbol] the unified symbol, required for isolated margin transfers
23598
23666
  * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
23599
23667
  */
23600
23668
  await this.loadMarkets();
@@ -23605,76 +23673,82 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23605
23673
  };
23606
23674
  request['type'] = this.safeString(params, 'type');
23607
23675
  params = this.omit(params, 'type');
23608
- let response = undefined;
23609
23676
  if (request['type'] === undefined) {
23610
23677
  const symbol = this.safeString(params, 'symbol');
23678
+ let market = undefined;
23611
23679
  if (symbol !== undefined) {
23680
+ market = this.market(symbol);
23612
23681
  params = this.omit(params, 'symbol');
23613
23682
  }
23614
23683
  let fromId = this.convertTypeToAccount(fromAccount).toUpperCase();
23615
23684
  let toId = this.convertTypeToAccount(toAccount).toUpperCase();
23685
+ let isolatedSymbol = undefined;
23686
+ if (market !== undefined) {
23687
+ isolatedSymbol = market['id'];
23688
+ }
23616
23689
  if (fromId === 'ISOLATED') {
23617
23690
  if (symbol === undefined) {
23618
23691
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' transfer () requires params["symbol"] when fromAccount is ' + fromAccount);
23619
23692
  }
23620
- else {
23621
- fromId = this.marketId(symbol);
23622
- }
23623
23693
  }
23624
23694
  if (toId === 'ISOLATED') {
23625
23695
  if (symbol === undefined) {
23626
23696
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' transfer () requires params["symbol"] when toAccount is ' + toAccount);
23627
23697
  }
23628
- else {
23629
- toId = this.marketId(symbol);
23630
- }
23631
23698
  }
23632
23699
  const accountsById = this.safeValue(this.options, 'accountsById', {});
23633
23700
  const fromIsolated = !(fromId in accountsById);
23634
23701
  const toIsolated = !(toId in accountsById);
23702
+ if (fromIsolated && (market === undefined)) {
23703
+ isolatedSymbol = fromId; // allow user provide symbol as the from/to account
23704
+ }
23705
+ if (toIsolated && (market === undefined)) {
23706
+ isolatedSymbol = toId;
23707
+ }
23635
23708
  if (fromIsolated || toIsolated) { // Isolated margin transfer
23636
23709
  const fromFuture = fromId === 'UMFUTURE' || fromId === 'CMFUTURE';
23637
23710
  const toFuture = toId === 'UMFUTURE' || toId === 'CMFUTURE';
23638
23711
  const fromSpot = fromId === 'MAIN';
23639
23712
  const toSpot = toId === 'MAIN';
23640
23713
  const funding = fromId === 'FUNDING' || toId === 'FUNDING';
23641
- const mining = fromId === 'MINING' || toId === 'MINING';
23642
23714
  const option = fromId === 'OPTION' || toId === 'OPTION';
23643
- const prohibitedWithIsolated = fromFuture || toFuture || mining || funding || option;
23715
+ const prohibitedWithIsolated = fromFuture || toFuture || funding || option;
23644
23716
  if ((fromIsolated || toIsolated) && prohibitedWithIsolated) {
23645
23717
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' transfer () does not allow transfers between ' + fromAccount + ' and ' + toAccount);
23646
23718
  }
23647
23719
  else if (toSpot && fromIsolated) {
23648
- request['transFrom'] = 'ISOLATED_MARGIN';
23649
- request['transTo'] = 'SPOT';
23650
- request['symbol'] = fromId;
23651
- response = await this.sapiPostMarginIsolatedTransfer(this.extend(request, params));
23720
+ fromId = 'ISOLATED_MARGIN';
23721
+ request['fromSymbol'] = isolatedSymbol;
23652
23722
  }
23653
23723
  else if (fromSpot && toIsolated) {
23654
- request['transFrom'] = 'SPOT';
23655
- request['transTo'] = 'ISOLATED_MARGIN';
23656
- request['symbol'] = toId;
23657
- response = await this.sapiPostMarginIsolatedTransfer(this.extend(request, params));
23724
+ toId = 'ISOLATED_MARGIN';
23725
+ request['toSymbol'] = isolatedSymbol;
23658
23726
  }
23659
23727
  else {
23660
- if (fromIsolated) {
23728
+ if (fromIsolated && toIsolated) {
23661
23729
  request['fromSymbol'] = fromId;
23662
- fromId = 'ISOLATEDMARGIN';
23663
- }
23664
- if (toIsolated) {
23665
23730
  request['toSymbol'] = toId;
23731
+ fromId = 'ISOLATEDMARGIN';
23666
23732
  toId = 'ISOLATEDMARGIN';
23667
23733
  }
23668
- request['type'] = fromId + '_' + toId;
23734
+ else {
23735
+ if (fromIsolated) {
23736
+ request['fromSymbol'] = isolatedSymbol;
23737
+ fromId = 'ISOLATEDMARGIN';
23738
+ }
23739
+ if (toIsolated) {
23740
+ request['toSymbol'] = isolatedSymbol;
23741
+ toId = 'ISOLATEDMARGIN';
23742
+ }
23743
+ }
23669
23744
  }
23745
+ request['type'] = fromId + '_' + toId;
23670
23746
  }
23671
23747
  else {
23672
23748
  request['type'] = fromId + '_' + toId;
23673
23749
  }
23674
23750
  }
23675
- if (response === undefined) {
23676
- response = await this.sapiPostAssetTransfer(this.extend(request, params));
23677
- }
23751
+ const response = await this.sapiPostAssetTransfer(this.extend(request, params));
23678
23752
  //
23679
23753
  // {
23680
23754
  // "tranId":13526853623
@@ -27548,6 +27622,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
27548
27622
  'trade/query': 3,
27549
27623
  'trade/openOrders': 3,
27550
27624
  'trade/historyOrders': 3,
27625
+ 'trade/myTrades': 3,
27551
27626
  'user/commissionRate': 3,
27552
27627
  'account/balance': 3,
27553
27628
  },
@@ -27607,6 +27682,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
27607
27682
  'user/positions': 3,
27608
27683
  'user/income': 3,
27609
27684
  'trade/openOrders': 3,
27685
+ 'trade/openOrder': 3,
27610
27686
  'trade/order': 3,
27611
27687
  'trade/marginType': 3,
27612
27688
  'trade/leverage': 3,
@@ -28274,6 +28350,22 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28274
28350
  // "buyerMaker": false
28275
28351
  // }
28276
28352
  //
28353
+ // spot
28354
+ // fetchMyTrades
28355
+ // {
28356
+ // "symbol": "LTC-USDT",
28357
+ // "id": 36237072,
28358
+ // "orderId": 1674069326895775744,
28359
+ // "price": "85.891",
28360
+ // "qty": "0.0582",
28361
+ // "quoteQty": "4.9988562000000005",
28362
+ // "commission": -0.00005820000000000001,
28363
+ // "commissionAsset": "LTC",
28364
+ // "time": 1687964205000,
28365
+ // "isBuyer": true,
28366
+ // "isMaker": false
28367
+ // }
28368
+ //
28277
28369
  // swap
28278
28370
  // fetchTrades
28279
28371
  //
@@ -28336,7 +28428,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28336
28428
  }
28337
28429
  const cost = this.safeString(trade, 'quoteQty');
28338
28430
  const type = (cost === undefined) ? 'spot' : 'swap';
28339
- const currencyId = this.safeString2(trade, 'currency', 'N');
28431
+ const currencyId = this.safeStringN(trade, ['currency', 'N', 'commissionAsset']);
28340
28432
  const currencyCode = this.safeCurrencyCode(currencyId);
28341
28433
  const m = this.safeValue(trade, 'm');
28342
28434
  const marketId = this.safeString(trade, 's');
@@ -28352,6 +28444,14 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28352
28444
  takeOrMaker = 'taker';
28353
28445
  }
28354
28446
  }
28447
+ const isBuyer = this.safeValue(trade, 'isBuyer');
28448
+ if (isBuyer !== undefined) {
28449
+ side = isBuyer ? 'buy' : 'sell';
28450
+ }
28451
+ const isMaker = this.safeValue(trade, 'isMaker');
28452
+ if (isMaker !== undefined) {
28453
+ takeOrMaker = isMaker ? 'maker' : 'taker';
28454
+ }
28355
28455
  return this.safeTrade({
28356
28456
  'id': this.safeStringN(trade, ['id', 't']),
28357
28457
  'info': trade,
@@ -30686,57 +30786,101 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
30686
30786
  * @method
30687
30787
  * @name bingx#fetchMyTrades
30688
30788
  * @description fetch all trades made by the user
30789
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20History
30689
30790
  * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20historical%20transaction%20orders
30690
30791
  * @param {string} [symbol] unified market symbol
30691
30792
  * @param {int} [since] the earliest time in ms to fetch trades for
30692
30793
  * @param {int} [limit] the maximum number of trades structures to retrieve
30693
30794
  * @param {object} [params] extra parameters specific to the exchange API endpoint
30795
+ * @param {int} [params.until] timestamp in ms for the ending date filter, default is undefined
30694
30796
  * @param {string} params.trandingUnit COIN (directly represent assets such as BTC and ETH) or CONT (represents the number of contract sheets)
30695
30797
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
30696
30798
  */
30697
30799
  if (symbol === undefined) {
30698
30800
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
30699
30801
  }
30700
- if (since === undefined) {
30701
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a since argument');
30702
- }
30703
- const tradingUnit = this.safeStringUpper(params, 'tradingUnit', 'CONT');
30704
30802
  await this.loadMarkets();
30705
30803
  const market = this.market(symbol);
30706
- if (market['spot']) {
30707
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol(this.id + ' fetchMyTrades() supports swap contracts only');
30708
- }
30804
+ const now = this.milliseconds();
30805
+ let response = undefined;
30709
30806
  const request = {
30710
30807
  'symbol': market['id'],
30711
- 'tradingUnit': tradingUnit,
30712
- 'startTs': since,
30713
- 'endTs': this.nonce(),
30714
30808
  };
30715
- const query = this.omit(params, 'tradingUnit');
30716
- const response = await this.swapV2PrivateGetTradeAllFillOrders(this.extend(request, query));
30717
- //
30718
- // {
30719
- // "code": "0",
30720
- // "msg": '',
30721
- // "data": { fill_orders: [
30722
- // {
30723
- // "volume": "0.1",
30724
- // "price": "106.75",
30725
- // "amount": "10.6750",
30726
- // "commission": "-0.0053",
30727
- // "currency": "USDT",
30728
- // "orderId": "1676213270274379776",
30729
- // "liquidatedPrice": "0.00",
30730
- // "liquidatedMarginRatio": "0.00",
30731
- // "filledTime": "2023-07-04T20:56:01.000+0800"
30732
- // }
30733
- // ]
30734
- // }
30735
- // }
30736
- //
30737
- const data = this.safeValue(response, 'data', []);
30738
- const fillOrders = this.safeValue(data, 'fill_orders', []);
30739
- return this.parseTrades(fillOrders, market, since, limit, query);
30809
+ if (since !== undefined) {
30810
+ const startTimeReq = market['spot'] ? 'startTime' : 'startTs';
30811
+ request[startTimeReq] = since;
30812
+ }
30813
+ else if (market['swap']) {
30814
+ request['startTs'] = now - 7776000000; // 90 days
30815
+ }
30816
+ const until = this.safeInteger(params, 'until');
30817
+ params = this.omit(params, 'until');
30818
+ if (until !== undefined) {
30819
+ const endTimeReq = market['spot'] ? 'endTime' : 'endTs';
30820
+ request[endTimeReq] = until;
30821
+ }
30822
+ else if (market['swap']) {
30823
+ request['endTs'] = now;
30824
+ }
30825
+ let fills = undefined;
30826
+ if (market['spot']) {
30827
+ response = await this.spotV1PrivateGetTradeMyTrades(this.extend(request, params));
30828
+ const data = this.safeValue(response, 'data', []);
30829
+ fills = this.safeValue(data, 'fills', []);
30830
+ //
30831
+ // {
30832
+ // "code": 0,
30833
+ // "msg": "",
30834
+ // "debugMsg": "",
30835
+ // "data": {
30836
+ // "fills": [
30837
+ // {
30838
+ // "symbol": "LTC-USDT",
30839
+ // "id": 36237072,
30840
+ // "orderId": 1674069326895775744,
30841
+ // "price": "85.891",
30842
+ // "qty": "0.0582",
30843
+ // "quoteQty": "4.9988562000000005",
30844
+ // "commission": -0.00005820000000000001,
30845
+ // "commissionAsset": "LTC",
30846
+ // "time": 1687964205000,
30847
+ // "isBuyer": true,
30848
+ // "isMaker": false
30849
+ // }
30850
+ // ]
30851
+ // }
30852
+ // }
30853
+ //
30854
+ }
30855
+ else {
30856
+ const tradingUnit = this.safeStringUpper(params, 'tradingUnit', 'CONT');
30857
+ params = this.omit(params, 'tradingUnit');
30858
+ request['tradingUnit'] = tradingUnit;
30859
+ response = await this.swapV2PrivateGetTradeAllFillOrders(this.extend(request, params));
30860
+ const data = this.safeValue(response, 'data', []);
30861
+ fills = this.safeValue(data, 'fill_orders', []);
30862
+ //
30863
+ // {
30864
+ // "code": "0",
30865
+ // "msg": '',
30866
+ // "data": { fill_orders: [
30867
+ // {
30868
+ // "volume": "0.1",
30869
+ // "price": "106.75",
30870
+ // "amount": "10.6750",
30871
+ // "commission": "-0.0053",
30872
+ // "currency": "USDT",
30873
+ // "orderId": "1676213270274379776",
30874
+ // "liquidatedPrice": "0.00",
30875
+ // "liquidatedMarginRatio": "0.00",
30876
+ // "filledTime": "2023-07-04T20:56:01.000+0800"
30877
+ // }
30878
+ // ]
30879
+ // }
30880
+ // }
30881
+ //
30882
+ }
30883
+ return this.parseTrades(fills, market, since, limit, params);
30740
30884
  }
30741
30885
  parseDepositWithdrawFee(fee, currency = undefined) {
30742
30886
  //
@@ -41023,10 +41167,10 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41023
41167
  'createMarketBuyOrderWithCost': true,
41024
41168
  'createMarketOrderWithCost': false,
41025
41169
  'createMarketSellOrderWithCost': false,
41026
- 'createTrailingPercentOrder': true,
41027
41170
  'createOrder': true,
41028
41171
  'createOrders': true,
41029
41172
  'createReduceOnlyOrder': false,
41173
+ 'createTrailingPercentOrder': true,
41030
41174
  'editOrder': true,
41031
41175
  'fetchAccounts': false,
41032
41176
  'fetchBalance': true,
@@ -43940,7 +44084,12 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
43940
44084
  'symbol': market['id'],
43941
44085
  };
43942
44086
  if (limit !== undefined) {
43943
- request['limit'] = limit;
44087
+ if (market['contract']) {
44088
+ request['limit'] = Math.min(limit, 1000);
44089
+ }
44090
+ else {
44091
+ request['limit'] = limit;
44092
+ }
43944
44093
  }
43945
44094
  const options = this.safeValue(this.options, 'fetchTrades', {});
43946
44095
  let response = undefined;
@@ -44252,11 +44401,12 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
44252
44401
  const marketType = market['spot'] ? 'spot' : 'swap';
44253
44402
  const timeframes = this.options['timeframes'][marketType];
44254
44403
  const selectedTimeframe = this.safeString(timeframes, timeframe, timeframe);
44255
- let request = {
44404
+ const request = {
44256
44405
  'symbol': market['id'],
44257
44406
  'granularity': selectedTimeframe,
44258
44407
  };
44259
- [request, params] = this.handleUntilOption('endTime', request, params);
44408
+ const until = this.safeInteger2(params, 'until', 'till');
44409
+ params = this.omit(params, ['until', 'till']);
44260
44410
  if (limit !== undefined) {
44261
44411
  request['limit'] = limit;
44262
44412
  }
@@ -44269,6 +44419,9 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
44269
44419
  if (since !== undefined) {
44270
44420
  request['startTime'] = since;
44271
44421
  }
44422
+ if (until !== undefined) {
44423
+ request['endTime'] = until;
44424
+ }
44272
44425
  }
44273
44426
  let response = undefined;
44274
44427
  if (market['spot']) {
@@ -44276,8 +44429,6 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
44276
44429
  response = await this.publicSpotGetV2SpotMarketCandles(this.extend(request, params));
44277
44430
  }
44278
44431
  else if (method === 'publicSpotGetV2SpotMarketHistoryCandles') {
44279
- const until = this.safeInteger2(params, 'until', 'till');
44280
- params = this.omit(params, ['until', 'till']);
44281
44432
  if (since !== undefined) {
44282
44433
  if (limit === undefined) {
44283
44434
  limit = 100; // exchange default
@@ -50416,12 +50567,12 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
50416
50567
  'createMarketBuyOrderWithCost': true,
50417
50568
  'createMarketOrderWithCost': false,
50418
50569
  'createMarketSellOrderWithCost': false,
50419
- 'createTrailingPercentOrder': true,
50420
50570
  'createOrder': true,
50421
50571
  'createPostOnlyOrder': true,
50422
50572
  'createStopLimitOrder': false,
50423
50573
  'createStopMarketOrder': false,
50424
50574
  'createStopOrder': false,
50575
+ 'createTrailingPercentOrder': true,
50425
50576
  'fetchBalance': true,
50426
50577
  'fetchBorrowInterest': true,
50427
50578
  'fetchBorrowRateHistories': false,
@@ -50640,8 +50791,8 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
50640
50791
  'trading': {
50641
50792
  'tierBased': true,
50642
50793
  'percentage': true,
50643
- 'taker': this.parseNumber('0.0025'),
50644
- 'maker': this.parseNumber('0.0025'),
50794
+ 'taker': this.parseNumber('0.0040'),
50795
+ 'maker': this.parseNumber('0.0035'),
50645
50796
  'tiers': {
50646
50797
  'taker': [
50647
50798
  [this.parseNumber('0'), this.parseNumber('0.0020')],
@@ -78365,7 +78516,6 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
78365
78516
  'closePosition': false,
78366
78517
  'createMarketBuyOrderWithCost': true,
78367
78518
  'createMarketSellOrderWithCost': false,
78368
- 'createTrailingAmountOrder': true,
78369
78519
  'createOrder': true,
78370
78520
  'createOrders': true,
78371
78521
  'createPostOnlyOrder': true,
@@ -78373,6 +78523,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
78373
78523
  'createStopLimitOrder': true,
78374
78524
  'createStopMarketOrder': true,
78375
78525
  'createStopOrder': true,
78526
+ 'createTrailingAmountOrder': true,
78376
78527
  'editOrder': true,
78377
78528
  'fetchBalance': true,
78378
78529
  'fetchBorrowInterest': false,
@@ -87791,7 +87942,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
87791
87942
  'setLeverage': false,
87792
87943
  'setMarginMode': false,
87793
87944
  'setPositionMode': false,
87794
- 'withdraw': undefined,
87945
+ 'withdraw': true,
87795
87946
  },
87796
87947
  'urls': {
87797
87948
  'logo': 'https://user-images.githubusercontent.com/1294454/40811661-b6eceae2-653a-11e8-829e-10bfadb078cf.jpg',
@@ -88462,46 +88613,102 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
88462
88613
  // "next_step": null
88463
88614
  // }
88464
88615
  //
88465
- const subtotalObject = this.safeValue(transaction, 'subtotal', {});
88466
- const feeObject = this.safeValue(transaction, 'fee', {});
88467
- const id = this.safeString(transaction, 'id');
88468
- const timestamp = this.parse8601(this.safeValue(transaction, 'created_at'));
88469
- const updated = this.parse8601(this.safeValue(transaction, 'updated_at'));
88470
- const type = this.safeString(transaction, 'resource');
88471
- const amount = this.safeNumber(subtotalObject, 'amount');
88472
- const currencyId = this.safeString(subtotalObject, 'currency');
88473
- const code = this.safeCurrencyCode(currencyId, currency);
88474
- const feeCost = this.safeNumber(feeObject, 'amount');
88475
- const feeCurrencyId = this.safeString(feeObject, 'currency');
88476
- const feeCurrency = this.safeCurrencyCode(feeCurrencyId);
88477
- const fee = {
88478
- 'cost': feeCost,
88479
- 'currency': feeCurrency,
88480
- };
88616
+ // withdraw
88617
+ //
88618
+ // {
88619
+ // "id": "a1794ecf-5693-55fa-70cf-ef731748ed82",
88620
+ // "type": "send",
88621
+ // "status": "pending",
88622
+ // "amount": {
88623
+ // "amount": "-14.008308",
88624
+ // "currency": "USDC"
88625
+ // },
88626
+ // "native_amount": {
88627
+ // "amount": "-18.74",
88628
+ // "currency": "CAD"
88629
+ // },
88630
+ // "description": null,
88631
+ // "created_at": "2024-01-12T01:27:31Z",
88632
+ // "updated_at": "2024-01-12T01:27:31Z",
88633
+ // "resource": "transaction",
88634
+ // "resource_path": "/v2/accounts/a34bgfad-ed67-538b-bffc-730c98c10da0/transactions/a1794ecf-5693-55fa-70cf-ef731748ed82",
88635
+ // "instant_exchange": false,
88636
+ // "network": {
88637
+ // "status": "pending",
88638
+ // "status_description": "Pending (est. less than 10 minutes)",
88639
+ // "transaction_fee": {
88640
+ // "amount": "4.008308",
88641
+ // "currency": "USDC"
88642
+ // },
88643
+ // "transaction_amount": {
88644
+ // "amount": "10.000000",
88645
+ // "currency": "USDC"
88646
+ // },
88647
+ // "confirmations": 0
88648
+ // },
88649
+ // "to": {
88650
+ // "resource": "ethereum_address",
88651
+ // "address": "0x9...",
88652
+ // "currency": "USDC",
88653
+ // "address_info": {
88654
+ // "address": "0x9..."
88655
+ // }
88656
+ // },
88657
+ // "idem": "748d8591-dg9a-7831-a45b-crd61dg78762",
88658
+ // "details": {
88659
+ // "title": "Sent USDC",
88660
+ // "subtitle": "To USDC address on Ethereum network",
88661
+ // "header": "Sent 14.008308 USDC ($18.74)",
88662
+ // "health": "warning"
88663
+ // },
88664
+ // "hide_native_amount": false
88665
+ // }
88666
+ //
88667
+ const transactionType = this.safeString(transaction, 'type');
88668
+ let amountAndCurrencyObject = undefined;
88669
+ let feeObject = undefined;
88670
+ if (transactionType === 'send') {
88671
+ const network = this.safeValue(transaction, 'network', {});
88672
+ amountAndCurrencyObject = this.safeValue(network, 'transaction_amount', {});
88673
+ feeObject = this.safeValue(network, 'transaction_fee', {});
88674
+ }
88675
+ else {
88676
+ amountAndCurrencyObject = this.safeValue(transaction, 'subtotal', {});
88677
+ feeObject = this.safeValue(transaction, 'fee', {});
88678
+ }
88481
88679
  let status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
88482
88680
  if (status === undefined) {
88483
88681
  const committed = this.safeValue(transaction, 'committed');
88484
88682
  status = committed ? 'ok' : 'pending';
88485
88683
  }
88684
+ const id = this.safeString(transaction, 'id');
88685
+ const currencyId = this.safeString(amountAndCurrencyObject, 'currency');
88686
+ const feeCurrencyId = this.safeString(feeObject, 'currency');
88687
+ const datetime = this.safeValue(transaction, 'created_at');
88688
+ const toObject = this.safeValue(transaction, 'to', {});
88689
+ const toAddress = this.safeString(toObject, 'address');
88486
88690
  return {
88487
88691
  'info': transaction,
88488
88692
  'id': id,
88489
88693
  'txid': id,
88490
- 'timestamp': timestamp,
88491
- 'datetime': this.iso8601(timestamp),
88694
+ 'timestamp': this.parse8601(datetime),
88695
+ 'datetime': datetime,
88492
88696
  'network': undefined,
88493
- 'address': undefined,
88494
- 'addressTo': undefined,
88697
+ 'address': toAddress,
88698
+ 'addressTo': toAddress,
88495
88699
  'addressFrom': undefined,
88496
88700
  'tag': undefined,
88497
88701
  'tagTo': undefined,
88498
88702
  'tagFrom': undefined,
88499
- 'type': type,
88500
- 'amount': amount,
88501
- 'currency': code,
88703
+ 'type': this.safeString(transaction, 'resource'),
88704
+ 'amount': this.safeNumber(amountAndCurrencyObject, 'amount'),
88705
+ 'currency': this.safeCurrencyCode(currencyId, currency),
88502
88706
  'status': status,
88503
- 'updated': updated,
88504
- 'fee': fee,
88707
+ 'updated': this.parse8601(this.safeValue(transaction, 'updated_at')),
88708
+ 'fee': {
88709
+ 'cost': this.safeNumber(feeObject, 'amount'),
88710
+ 'currency': this.safeCurrencyCode(feeCurrencyId),
88711
+ },
88505
88712
  };
88506
88713
  }
88507
88714
  parseTrade(trade, market = undefined) {
@@ -90855,6 +91062,100 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
90855
91062
  const tickers = this.safeValue(response, 'pricebooks', []);
90856
91063
  return this.parseTickers(tickers, symbols);
90857
91064
  }
91065
+ async withdraw(code, amount, address, tag = undefined, params = {}) {
91066
+ /**
91067
+ * @method
91068
+ * @name coinbase#withdraw
91069
+ * @description make a withdrawal
91070
+ * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-transactions#send-money
91071
+ * @param {string} code unified currency code
91072
+ * @param {float} amount the amount to withdraw
91073
+ * @param {string} address the address to withdraw to
91074
+ * @param {string} [tag] an optional tag for the withdrawal
91075
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
91076
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
91077
+ */
91078
+ [tag, params] = this.handleWithdrawTagAndParams(tag, params);
91079
+ this.checkAddress(address);
91080
+ await this.loadMarkets();
91081
+ const currency = this.currency(code);
91082
+ let accountId = this.safeString2(params, 'account_id', 'accountId');
91083
+ params = this.omit(params, ['account_id', 'accountId']);
91084
+ if (accountId === undefined) {
91085
+ if (code === undefined) {
91086
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' withdraw() requires an account_id (or accountId) parameter OR a currency code argument');
91087
+ }
91088
+ accountId = await this.findAccountId(code);
91089
+ if (accountId === undefined) {
91090
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' withdraw() could not find account id for ' + code);
91091
+ }
91092
+ }
91093
+ const request = {
91094
+ 'account_id': accountId,
91095
+ 'type': 'send',
91096
+ 'to': address,
91097
+ 'amount': amount,
91098
+ 'currency': currency['id'],
91099
+ };
91100
+ if (tag !== undefined) {
91101
+ request['destination_tag'] = tag;
91102
+ }
91103
+ const response = await this.v2PrivatePostAccountsAccountIdTransactions(this.extend(request, params));
91104
+ //
91105
+ // {
91106
+ // "data": {
91107
+ // "id": "a1794ecf-5693-55fa-70cf-ef731748ed82",
91108
+ // "type": "send",
91109
+ // "status": "pending",
91110
+ // "amount": {
91111
+ // "amount": "-14.008308",
91112
+ // "currency": "USDC"
91113
+ // },
91114
+ // "native_amount": {
91115
+ // "amount": "-18.74",
91116
+ // "currency": "CAD"
91117
+ // },
91118
+ // "description": null,
91119
+ // "created_at": "2024-01-12T01:27:31Z",
91120
+ // "updated_at": "2024-01-12T01:27:31Z",
91121
+ // "resource": "transaction",
91122
+ // "resource_path": "/v2/accounts/a34bgfad-ed67-538b-bffc-730c98c10da0/transactions/a1794ecf-5693-55fa-70cf-ef731748ed82",
91123
+ // "instant_exchange": false,
91124
+ // "network": {
91125
+ // "status": "pending",
91126
+ // "status_description": "Pending (est. less than 10 minutes)",
91127
+ // "transaction_fee": {
91128
+ // "amount": "4.008308",
91129
+ // "currency": "USDC"
91130
+ // },
91131
+ // "transaction_amount": {
91132
+ // "amount": "10.000000",
91133
+ // "currency": "USDC"
91134
+ // },
91135
+ // "confirmations": 0
91136
+ // },
91137
+ // "to": {
91138
+ // "resource": "ethereum_address",
91139
+ // "address": "0x9...",
91140
+ // "currency": "USDC",
91141
+ // "address_info": {
91142
+ // "address": "0x9..."
91143
+ // }
91144
+ // },
91145
+ // "idem": "748d8591-dg9a-7831-a45b-crd61dg78762",
91146
+ // "details": {
91147
+ // "title": "Sent USDC",
91148
+ // "subtitle": "To USDC address on Ethereum network",
91149
+ // "header": "Sent 14.008308 USDC ($18.74)",
91150
+ // "health": "warning"
91151
+ // },
91152
+ // "hide_native_amount": false
91153
+ // }
91154
+ // }
91155
+ //
91156
+ const data = this.safeValue(response, 'data', {});
91157
+ return this.parseTransaction(data, currency);
91158
+ }
90858
91159
  sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
90859
91160
  const version = api[0];
90860
91161
  const signed = api[1] === 'private';
@@ -99876,7 +100177,7 @@ class coinlist extends _abstract_coinlist_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
99876
100177
  request['start_time'] = this.iso8601(since);
99877
100178
  }
99878
100179
  if (limit !== undefined) {
99879
- request['count'] = limit;
100180
+ request['count'] = Math.min(limit, 500);
99880
100181
  }
99881
100182
  const until = this.safeInteger2(params, 'till', 'until');
99882
100183
  if (until !== undefined) {
@@ -103173,7 +103474,7 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
103173
103474
  'target_currency': market['base'],
103174
103475
  };
103175
103476
  if (limit !== undefined) {
103176
- request['size'] = limit; // only support 10, 50, 100, 150, 200
103477
+ request['size'] = Math.min(limit, 200);
103177
103478
  }
103178
103479
  const response = await this.v2PublicGetTradesQuoteCurrencyTargetCurrency(this.extend(request, params));
103179
103480
  //
@@ -114505,11 +114806,11 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
114505
114806
  'cancelOrder': true,
114506
114807
  'cancelOrders': false,
114507
114808
  'createDepositAddress': true,
114508
- 'createTrailingAmountOrder': true,
114509
114809
  'createOrder': true,
114510
114810
  'createStopLimitOrder': true,
114511
114811
  'createStopMarketOrder': true,
114512
114812
  'createStopOrder': true,
114813
+ 'createTrailingAmountOrder': true,
114513
114814
  'editOrder': true,
114514
114815
  'fetchAccounts': true,
114515
114816
  'fetchBalance': true,
@@ -127944,7 +128245,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
127944
128245
  request['to'] = this.parseToInt(until / 1000);
127945
128246
  }
127946
128247
  if (limit !== undefined) {
127947
- request['limit'] = limit; // default 100, max 1000
128248
+ request['limit'] = Math.min(limit, 1000); // default 100, max 1000
127948
128249
  }
127949
128250
  if (since !== undefined && (market['contract'])) {
127950
128251
  request['from'] = this.parseToInt(since / 1000);
@@ -130084,29 +130385,35 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
130084
130385
  // swap and future
130085
130386
  //
130086
130387
  // {
130087
- // "value": "12.475572",
130388
+ // "value": "4.60516",
130088
130389
  // "leverage": "0",
130089
130390
  // "mode": "single",
130090
130391
  // "realised_point": "0",
130091
130392
  // "contract": "BTC_USDT",
130092
- // "entry_price": "62422.6",
130093
- // "mark_price": "62377.86",
130393
+ // "entry_price": "46030.3",
130394
+ // "mark_price": "46051.6",
130094
130395
  // "history_point": "0",
130095
- // "realised_pnl": "-0.00624226",
130096
- // "close_order": null,
130097
- // "size": "2",
130098
- // "cross_leverage_limit": "25",
130099
- // "pending_orders": "0",
130100
- // "adl_ranking": "5",
130101
- // "maintenance_rate": "0.005",
130102
- // "unrealised_pnl": "-0.008948",
130103
- // "user": "663337",
130104
- // "leverage_max": "100",
130105
- // "history_pnl": "14.98868396636",
130396
+ // "realised_pnl": "-0.002301515",
130397
+ // "close_order": null,
130398
+ // "size": 1,
130399
+ // "cross_leverage_limit": "0",
130400
+ // "pending_orders": 0,
130401
+ // "adl_ranking": 5,
130402
+ // "maintenance_rate": "0.004",
130403
+ // "unrealised_pnl": "0.00213",
130404
+ // "user": 5691076,
130405
+ // "leverage_max": "125",
130406
+ // "history_pnl": "0",
130106
130407
  // "risk_limit": "1000000",
130107
- // "margin": "0.740721495056",
130108
- // "last_close_pnl": "-0.041996015",
130109
- // "liq_price": "59058.58"
130408
+ // "margin": "8.997698485",
130409
+ // "last_close_pnl": "0",
130410
+ // "liq_price": "0",
130411
+ // "update_time": 1705034246,
130412
+ // "update_id": 1,
130413
+ // "initial_margin": "0",
130414
+ // "maintenance_margin": "0",
130415
+ // "open_time": 1705034246,
130416
+ // "trade_max_size": "0"
130110
130417
  // }
130111
130418
  //
130112
130419
  // option
@@ -130157,14 +130464,14 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
130157
130464
  const takerFee = '0.00075';
130158
130465
  const feePaid = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(takerFee, notional);
130159
130466
  const initialMarginString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringDiv(notional, leverage), feePaid);
130160
- const timestamp = this.safeInteger(position, 'time_ms');
130467
+ const timestamp = this.safeTimestamp(position, 'open_time');
130161
130468
  return this.safePosition({
130162
130469
  'info': position,
130163
130470
  'id': undefined,
130164
130471
  'symbol': this.safeString(market, 'symbol'),
130165
- 'timestamp': undefined,
130166
- 'datetime': undefined,
130167
- 'lastUpdateTimestamp': timestamp,
130472
+ 'timestamp': timestamp,
130473
+ 'datetime': this.iso8601(timestamp),
130474
+ 'lastUpdateTimestamp': this.safeTimestamp(position, 'update_time'),
130168
130475
  'initialMargin': this.parseNumber(initialMarginString),
130169
130476
  'initialMarginPercentage': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringDiv(initialMarginString, notional)),
130170
130477
  'maintenanceMargin': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(maintenanceRate, notional)),
@@ -130223,29 +130530,35 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
130223
130530
  // swap and future
130224
130531
  //
130225
130532
  // {
130226
- // "value": "12.475572",
130533
+ // "value": "4.60516",
130227
130534
  // "leverage": "0",
130228
130535
  // "mode": "single",
130229
130536
  // "realised_point": "0",
130230
130537
  // "contract": "BTC_USDT",
130231
- // "entry_price": "62422.6",
130232
- // "mark_price": "62377.86",
130538
+ // "entry_price": "46030.3",
130539
+ // "mark_price": "46051.6",
130233
130540
  // "history_point": "0",
130234
- // "realised_pnl": "-0.00624226",
130235
- // "close_order": null,
130236
- // "size": "2",
130237
- // "cross_leverage_limit": "25",
130238
- // "pending_orders": "0",
130239
- // "adl_ranking": "5",
130240
- // "maintenance_rate": "0.005",
130241
- // "unrealised_pnl": "-0.008948",
130242
- // "user": "6693577",
130243
- // "leverage_max": "100",
130244
- // "history_pnl": "14.98868396636",
130541
+ // "realised_pnl": "-0.002301515",
130542
+ // "close_order": null,
130543
+ // "size": 1,
130544
+ // "cross_leverage_limit": "0",
130545
+ // "pending_orders": 0,
130546
+ // "adl_ranking": 5,
130547
+ // "maintenance_rate": "0.004",
130548
+ // "unrealised_pnl": "0.00213",
130549
+ // "user": 5691076,
130550
+ // "leverage_max": "125",
130551
+ // "history_pnl": "0",
130245
130552
  // "risk_limit": "1000000",
130246
- // "margin": "0.740721495056",
130247
- // "last_close_pnl": "-0.041996015",
130248
- // "liq_price": "59058.58"
130553
+ // "margin": "8.997698485",
130554
+ // "last_close_pnl": "0",
130555
+ // "liq_price": "0",
130556
+ // "update_time": 1705034246,
130557
+ // "update_id": 1,
130558
+ // "initial_margin": "0",
130559
+ // "maintenance_margin": "0",
130560
+ // "open_time": 1705034246,
130561
+ // "trade_max_size": "0"
130249
130562
  // }
130250
130563
  //
130251
130564
  // option
@@ -130325,29 +130638,35 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
130325
130638
  //
130326
130639
  // [
130327
130640
  // {
130328
- // "value": "12.475572",
130641
+ // "value": "4.602828",
130329
130642
  // "leverage": "0",
130330
130643
  // "mode": "single",
130331
130644
  // "realised_point": "0",
130332
130645
  // "contract": "BTC_USDT",
130333
- // "entry_price": "62422.6",
130334
- // "mark_price": "62377.86",
130646
+ // "entry_price": "46030.3",
130647
+ // "mark_price": "46028.28",
130335
130648
  // "history_point": "0",
130336
- // "realised_pnl": "-0.00624226",
130337
- // "close_order": null,
130338
- // "size": "2",
130339
- // "cross_leverage_limit": "25",
130340
- // "pending_orders": "0",
130341
- // "adl_ranking": "5",
130342
- // "maintenance_rate": "0.005",
130343
- // "unrealised_pnl": "-0.008948",
130344
- // "user": "6693577",
130345
- // "leverage_max": "100",
130346
- // "history_pnl": "14.98868396636",
130649
+ // "realised_pnl": "-0.002301515",
130650
+ // "close_order": null,
130651
+ // "size": 1,
130652
+ // "cross_leverage_limit": "0",
130653
+ // "pending_orders": 0,
130654
+ // "adl_ranking": 5,
130655
+ // "maintenance_rate": "0.004",
130656
+ // "unrealised_pnl": "-0.000202",
130657
+ // "user": 5691076,
130658
+ // "leverage_max": "125",
130659
+ // "history_pnl": "0",
130347
130660
  // "risk_limit": "1000000",
130348
- // "margin": "0.740721495056",
130349
- // "last_close_pnl": "-0.041996015",
130350
- // "liq_price": "59058.58"
130661
+ // "margin": "8.997698485",
130662
+ // "last_close_pnl": "0",
130663
+ // "liq_price": "0",
130664
+ // "update_time": 1705034246,
130665
+ // "update_id": 1,
130666
+ // "initial_margin": "0",
130667
+ // "maintenance_margin": "0",
130668
+ // "open_time": 1705034246,
130669
+ // "trade_max_size": "0"
130351
130670
  // }
130352
130671
  // ]
130353
130672
  //
@@ -132861,7 +133180,7 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132861
133180
  'symbol': market['id'],
132862
133181
  };
132863
133182
  if (limit !== undefined) {
132864
- request['limit_trades'] = limit;
133183
+ request['limit_trades'] = Math.min(limit, 500);
132865
133184
  }
132866
133185
  if (since !== undefined) {
132867
133186
  request['timestamp'] = since;
@@ -139349,13 +139668,13 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
139349
139668
  'createMarketBuyOrderWithCost': true,
139350
139669
  'createMarketOrderWithCost': false,
139351
139670
  'createMarketSellOrderWithCost': false,
139352
- 'createTrailingPercentOrder': true,
139353
139671
  'createOrder': true,
139354
139672
  'createOrders': true,
139355
139673
  'createReduceOnlyOrder': false,
139356
139674
  'createStopLimitOrder': true,
139357
139675
  'createStopMarketOrder': true,
139358
139676
  'createStopOrder': true,
139677
+ 'createTrailingPercentOrder': true,
139359
139678
  'fetchAccounts': true,
139360
139679
  'fetchBalance': true,
139361
139680
  'fetchBidsAsks': undefined,
@@ -144277,6 +144596,31 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
144277
144596
  params['createMarketBuyOrderRequiresPrice'] = false;
144278
144597
  return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
144279
144598
  }
144599
+ async createTrailingPercentOrder(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
144600
+ /**
144601
+ * @method
144602
+ * @name createTrailingPercentOrder
144603
+ * @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
144604
+ * @param {string} symbol unified symbol of the market to create an order in
144605
+ * @param {string} type 'market' or 'limit'
144606
+ * @param {string} side 'buy' or 'sell'
144607
+ * @param {float} amount how much you want to trade in units of the base currency, or number of contracts
144608
+ * @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
144609
+ * @param {float} trailingPercent the percent to trail away from the current market price
144610
+ * @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
144611
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
144612
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
144613
+ */
144614
+ if (trailingPercent === undefined) {
144615
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingPercent argument');
144616
+ }
144617
+ if (trailingTriggerPrice === undefined) {
144618
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingTriggerPrice argument');
144619
+ }
144620
+ params['trailingPercent'] = trailingPercent;
144621
+ params['trailingTriggerPrice'] = trailingTriggerPrice;
144622
+ return await this.createOrder(symbol, type, side, amount, price, params);
144623
+ }
144280
144624
  async createSpotOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
144281
144625
  /**
144282
144626
  * @method
@@ -152757,20 +153101,22 @@ class independentreserve extends _abstract_independentreserve_js__WEBPACK_IMPORT
152757
153101
  */
152758
153102
  await this.loadMarkets();
152759
153103
  const market = this.market(symbol);
152760
- const capitalizedOrderType = this.capitalize(type);
152761
- const method = 'privatePostPlace' + capitalizedOrderType + 'Order';
152762
- let orderType = capitalizedOrderType;
153104
+ let orderType = this.capitalize(type);
152763
153105
  orderType += (side === 'sell') ? 'Offer' : 'Bid';
152764
153106
  const request = this.ordered({
152765
153107
  'primaryCurrencyCode': market['baseId'],
152766
153108
  'secondaryCurrencyCode': market['quoteId'],
152767
153109
  'orderType': orderType,
152768
153110
  });
153111
+ let response = undefined;
153112
+ request['volume'] = amount;
152769
153113
  if (type === 'limit') {
152770
153114
  request['price'] = price;
153115
+ response = await this.privatePostPlaceLimitOrder(this.extend(request, params));
153116
+ }
153117
+ else {
153118
+ response = await this.privatePostPlaceMarketOrder(this.extend(request, params));
152771
153119
  }
152772
- request['volume'] = amount;
152773
- const response = await this[method](this.extend(request, params));
152774
153120
  return this.safeOrder({
152775
153121
  'info': response,
152776
153122
  'id': response['OrderGuid'],
@@ -153960,8 +154306,8 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
153960
154306
  'createOrder': true,
153961
154307
  'createStopLimitOrder': true,
153962
154308
  'createStopMarketOrder': true,
153963
- 'createTrailingAmountOrder': true,
153964
154309
  'createStopOrder': true,
154310
+ 'createTrailingAmountOrder': true,
153965
154311
  'editOrder': true,
153966
154312
  'fetchBalance': true,
153967
154313
  'fetchBorrowInterest': false,
@@ -155186,12 +155532,8 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
155186
155532
  request['since'] = since * 1e6;
155187
155533
  request['since'] = since.toString() + '000000'; // expected to be in nanoseconds
155188
155534
  }
155189
- // https://github.com/ccxt/ccxt/issues/5698
155190
- if (limit !== undefined && limit !== 1000) {
155191
- const fetchTradesWarning = this.safeValue(this.options, 'fetchTradesWarning', true);
155192
- if (fetchTradesWarning) {
155193
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' fetchTrades() cannot serve ' + limit.toString() + " trades without breaking the pagination, see https://github.com/ccxt/ccxt/issues/5698 for more details. Set exchange.options['fetchTradesWarning'] to acknowledge this warning and silence it.");
155194
- }
155535
+ if (limit !== undefined) {
155536
+ request['count'] = limit;
155195
155537
  }
155196
155538
  const response = await this.publicGetTrades(this.extend(request, params));
155197
155539
  //
@@ -170823,13 +171165,17 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
170823
171165
  else {
170824
171166
  request['size'] = 600; // max
170825
171167
  }
170826
- let method = this.safeString(params, 'method');
171168
+ const options = this.safeValue(this.options, 'fetchTrades', {});
171169
+ const defaultMethod = this.safeString(options, 'method', 'spotPublicGetTrades');
171170
+ const method = this.safeString(params, 'method', defaultMethod);
170827
171171
  params = this.omit(params, 'method');
170828
- if (method === undefined) {
170829
- const options = this.safeValue(this.options, 'fetchTrades', {});
170830
- method = this.safeString(options, 'method', 'spotPublicGetTrades');
171172
+ let response = undefined;
171173
+ if (method === 'spotPublicGetSupplementTrades') {
171174
+ response = await this.spotPublicGetSupplementTrades(this.extend(request, params));
171175
+ }
171176
+ else {
171177
+ response = await this.spotPublicGetTrades(this.extend(request, params));
170831
171178
  }
170832
- const response = await this[method](this.extend(request, params));
170833
171179
  //
170834
171180
  // {
170835
171181
  // "result":"true",
@@ -171066,12 +171412,19 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
171066
171412
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
171067
171413
  */
171068
171414
  await this.loadMarkets();
171069
- let method = this.safeString(params, 'method');
171070
- if (method === undefined) {
171071
- const options = this.safeValue(this.options, 'fetchBalance', {});
171072
- method = this.safeString(options, 'method', 'spotPrivatePostSupplementUserInfo');
171415
+ const options = this.safeValue(this.options, 'fetchBalance', {});
171416
+ const defaultMethod = this.safeString(options, 'method', 'spotPrivatePostSupplementUserInfo');
171417
+ const method = this.safeString(params, 'method', defaultMethod);
171418
+ let response = undefined;
171419
+ if (method === 'spotPrivatePostSupplementUserInfoAccount') {
171420
+ response = await this.spotPrivatePostSupplementUserInfoAccount();
171421
+ }
171422
+ else if (method === 'spotPrivatePostUserInfo') {
171423
+ response = await this.spotPrivatePostUserInfo();
171424
+ }
171425
+ else {
171426
+ response = await this.spotPrivatePostSupplementUserInfo();
171073
171427
  }
171074
- const response = await this[method]();
171075
171428
  //
171076
171429
  // {
171077
171430
  // "result": "true",
@@ -171256,14 +171609,17 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
171256
171609
  if (clientOrderId !== undefined) {
171257
171610
  request['custom_id'] = clientOrderId;
171258
171611
  }
171259
- let method = undefined;
171260
- method = this.safeString(params, 'method');
171612
+ const options = this.safeValue(this.options, 'createOrder', {});
171613
+ const defaultMethod = this.safeString(options, 'method', 'spotPrivatePostSupplementCreateOrder');
171614
+ const method = this.safeString(params, 'method', defaultMethod);
171261
171615
  params = this.omit(params, 'method');
171262
- if (method === undefined) {
171263
- const options = this.safeValue(this.options, 'createOrder', {});
171264
- method = this.safeString(options, 'method', 'spotPrivatePostSupplementCreateOrder');
171616
+ let response = undefined;
171617
+ if (method === 'spotPrivatePostCreateOrder') {
171618
+ response = await this.spotPrivatePostCreateOrder(this.extend(request, params));
171619
+ }
171620
+ else {
171621
+ response = await this.spotPrivatePostSupplementCreateOrder(this.extend(request, params));
171265
171622
  }
171266
- const response = await this[method](this.extend(request, params));
171267
171623
  //
171268
171624
  // {
171269
171625
  // "result":true,
@@ -171798,13 +172154,18 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
171798
172154
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
171799
172155
  */
171800
172156
  await this.loadMarkets();
171801
- let method = this.safeString(params, 'method');
172157
+ const options = this.safeValue(this.options, 'fetchDepositAddress', {});
172158
+ const defaultMethod = this.safeString(options, 'method', 'fetchDepositAddressDefault');
172159
+ const method = this.safeString(params, 'method', defaultMethod);
171802
172160
  params = this.omit(params, 'method');
171803
- if (method === undefined) {
171804
- const options = this.safeValue(this.options, 'fetchDepositAddress', {});
171805
- method = this.safeString(options, 'method', 'fetchDepositAddressDefault');
172161
+ let response = undefined;
172162
+ if (method === 'fetchDepositAddressSupplement') {
172163
+ response = await this.fetchDepositAddressSupplement(code, params);
171806
172164
  }
171807
- return await this[method](code, params);
172165
+ else {
172166
+ response = await this.fetchDepositAddressDefault(code, params);
172167
+ }
172168
+ return response;
171808
172169
  }
171809
172170
  async fetchDepositAddressDefault(code, params = {}) {
171810
172171
  await this.loadMarkets();
@@ -172176,13 +172537,16 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
172176
172537
  const isAuthorized = this.checkRequiredCredentials(false);
172177
172538
  let result = undefined;
172178
172539
  if (isAuthorized === true) {
172179
- let method = this.safeString(params, 'method');
172540
+ const options = this.safeValue(this.options, 'fetchTransactionFees', {});
172541
+ const defaultMethod = this.safeString(options, 'method', 'fetchPrivateTransactionFees');
172542
+ const method = this.safeString(params, 'method', defaultMethod);
172180
172543
  params = this.omit(params, 'method');
172181
- if (method === undefined) {
172182
- const options = this.safeValue(this.options, 'fetchTransactionFees', {});
172183
- method = this.safeString(options, 'method', 'fetchPrivateTransactionFees');
172544
+ if (method === 'fetchPublicTransactionFees') {
172545
+ result = await this.fetchPublicTransactionFees(params);
172546
+ }
172547
+ else {
172548
+ result = await this.fetchPrivateTransactionFees(params);
172184
172549
  }
172185
- result = await this[method](params);
172186
172550
  }
172187
172551
  else {
172188
172552
  result = await this.fetchPublicTransactionFees(params);
@@ -172320,19 +172684,23 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
172320
172684
  */
172321
172685
  await this.loadMarkets();
172322
172686
  const isAuthorized = this.checkRequiredCredentials(false);
172323
- let method = undefined;
172687
+ const response = undefined;
172324
172688
  if (isAuthorized === true) {
172325
- method = this.safeString(params, 'method');
172689
+ const options = this.safeValue(this.options, 'fetchDepositWithdrawFees', {});
172690
+ const defaultMethod = this.safeString(options, 'method', 'fetchPrivateDepositWithdrawFees');
172691
+ const method = this.safeString(params, 'method', defaultMethod);
172326
172692
  params = this.omit(params, 'method');
172327
- if (method === undefined) {
172328
- const options = this.safeValue(this.options, 'fetchDepositWithdrawFees', {});
172329
- method = this.safeString(options, 'method', 'fetchPrivateDepositWithdrawFees');
172693
+ if (method === 'fetchPublicDepositWithdrawFees') {
172694
+ await this.fetchPublicDepositWithdrawFees(codes, params);
172695
+ }
172696
+ else {
172697
+ await this.fetchPrivateDepositWithdrawFees(codes, params);
172330
172698
  }
172331
172699
  }
172332
172700
  else {
172333
- method = 'fetchPublicDepositWithdrawFees';
172701
+ await this.fetchPublicDepositWithdrawFees(codes, params);
172334
172702
  }
172335
- return await this[method](codes, params);
172703
+ return response;
172336
172704
  }
172337
172705
  async fetchPrivateDepositWithdrawFees(codes = undefined, params = {}) {
172338
172706
  // complete response
@@ -185918,7 +186286,7 @@ class oceanex extends _abstract_oceanex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
185918
186286
  'market': market['id'],
185919
186287
  };
185920
186288
  if (limit !== undefined) {
185921
- request['limit'] = limit;
186289
+ request['limit'] = Math.min(limit, 1000);
185922
186290
  }
185923
186291
  const response = await this.publicGetTrades(this.extend(request, params));
185924
186292
  //
@@ -189583,7 +189951,6 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
189583
189951
  'createDepositAddress': false,
189584
189952
  'createMarketBuyOrderWithCost': true,
189585
189953
  'createMarketSellOrderWithCost': true,
189586
- 'createTrailingPercentOrder': true,
189587
189954
  'createOrder': true,
189588
189955
  'createOrders': true,
189589
189956
  'createPostOnlyOrder': true,
@@ -189591,6 +189958,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
189591
189958
  'createStopLimitOrder': true,
189592
189959
  'createStopMarketOrder': true,
189593
189960
  'createStopOrder': true,
189961
+ 'createTrailingPercentOrder': true,
189594
189962
  'editOrder': true,
189595
189963
  'fetchAccounts': true,
189596
189964
  'fetchBalance': true,
@@ -189804,6 +190172,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
189804
190172
  'sprd/order': 1 / 3,
189805
190173
  'sprd/orders-pending': 1 / 3,
189806
190174
  'sprd/orders-history': 1 / 2,
190175
+ 'sprd/orders-history-archive': 1 / 2,
189807
190176
  'sprd/trades': 1 / 3,
189808
190177
  // trade
189809
190178
  'trade/order': 1 / 3,
@@ -199195,7 +199564,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
199195
199564
  },
199196
199565
  },
199197
199566
  'options': {
199198
- 'brokerId': 'CCXT',
199567
+ 'brokerId': 'CCXT123456',
199199
199568
  'x-phemex-request-expiry': 60,
199200
199569
  'createOrderByQuoteRequiresPrice': true,
199201
199570
  'networks': {
@@ -201220,7 +201589,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
201220
201589
  const takeProfit = this.safeValue(params, 'takeProfit');
201221
201590
  const takeProfitDefined = (takeProfit !== undefined);
201222
201591
  if (clientOrderId === undefined) {
201223
- const brokerId = this.safeString(this.options, 'brokerId');
201592
+ const brokerId = this.safeString(this.options, 'brokerId', 'CCXT123456');
201224
201593
  if (brokerId !== undefined) {
201225
201594
  request['clOrdID'] = brokerId + this.uuid16();
201226
201595
  }
@@ -203016,6 +203385,13 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
203016
203385
  };
203017
203386
  let payload = '';
203018
203387
  if (method === 'POST') {
203388
+ const isOrderPlacement = (path === 'g-orders') || (path === 'spot/orders') || (path === 'orders');
203389
+ if (isOrderPlacement) {
203390
+ if (this.safeString(params, 'clOrdID') === undefined) {
203391
+ const id = this.safeString(this.options, 'brokerId', 'CCXT123456');
203392
+ params['clOrdID'] = id + this.uuid16();
203393
+ }
203394
+ }
203019
203395
  payload = this.json(params);
203020
203396
  body = payload;
203021
203397
  headers['Content-Type'] = 'application/json';
@@ -241808,7 +242184,7 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
241808
242184
  ],
241809
242185
  'subscription': {
241810
242186
  'name': name,
241811
- 'interval': this.safeString(this.timeframes, timeframe, timeframe),
242187
+ 'interval': this.safeValue(this.timeframes, timeframe, timeframe),
241812
242188
  },
241813
242189
  };
241814
242190
  const request = this.deepExtend(subscribe, params);
@@ -249048,6 +249424,7 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
249048
249424
  'watchOrderBookForSymbols': true,
249049
249425
  'watchBalance': true,
249050
249426
  'watchOHLCV': true,
249427
+ 'watchOHLCVForSymbols': true,
249051
249428
  'watchOrders': true,
249052
249429
  'watchMyTrades': true,
249053
249430
  'watchPositions': true,
@@ -249384,6 +249761,50 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
249384
249761
  }
249385
249762
  return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
249386
249763
  }
249764
+ async watchOHLCVForSymbols(symbolsAndTimeframes, since = undefined, limit = undefined, params = {}) {
249765
+ /**
249766
+ * @method
249767
+ * @name okx#watchOHLCVForSymbols
249768
+ * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
249769
+ * @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
249770
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
249771
+ * @param {int} [limit] the maximum amount of candles to fetch
249772
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
249773
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
249774
+ */
249775
+ const symbolsLength = symbolsAndTimeframes.length;
249776
+ if (symbolsLength === 0 || !Array.isArray(symbolsAndTimeframes[0])) {
249777
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + " watchOHLCVForSymbols() requires a an array of symbols and timeframes, like [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]");
249778
+ }
249779
+ await this.loadMarkets();
249780
+ const topics = [];
249781
+ const messageHashes = [];
249782
+ for (let i = 0; i < symbolsAndTimeframes.length; i++) {
249783
+ const symbolAndTimeframe = symbolsAndTimeframes[i];
249784
+ const sym = symbolAndTimeframe[0];
249785
+ const tf = symbolAndTimeframe[1];
249786
+ const marketId = this.marketId(sym);
249787
+ const interval = this.safeString(this.timeframes, tf, tf);
249788
+ const channel = 'candle' + interval;
249789
+ const topic = {
249790
+ 'channel': channel,
249791
+ 'instId': marketId,
249792
+ };
249793
+ topics.push(topic);
249794
+ messageHashes.push('multi:' + channel + ':' + sym);
249795
+ }
249796
+ const request = {
249797
+ 'op': 'subscribe',
249798
+ 'args': topics,
249799
+ };
249800
+ const url = this.getUrl('candle', 'public');
249801
+ const [symbol, timeframe, candles] = await this.watchMultiple(url, messageHashes, request, messageHashes);
249802
+ if (this.newUpdates) {
249803
+ limit = candles.getLimit(symbol, limit);
249804
+ }
249805
+ const filtered = this.filterBySinceLimit(candles, since, limit, 0, true);
249806
+ return this.createOHLCVObject(symbol, timeframe, filtered);
249807
+ }
249387
249808
  handleOHLCV(client, message) {
249388
249809
  //
249389
249810
  // {
@@ -249406,7 +249827,7 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
249406
249827
  const data = this.safeValue(message, 'data', []);
249407
249828
  const marketId = this.safeString(arg, 'instId');
249408
249829
  const market = this.safeMarket(marketId);
249409
- const symbol = market['id'];
249830
+ const symbol = market['symbol'];
249410
249831
  const interval = channel.replace('candle', '');
249411
249832
  // use a reverse lookup in a static map instead
249412
249833
  const timeframe = this.findTimeframe(interval);
@@ -249420,8 +249841,13 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
249420
249841
  this.ohlcvs[symbol][timeframe] = stored;
249421
249842
  }
249422
249843
  stored.append(parsed);
249423
- const messageHash = channel + ':' + marketId;
249844
+ const messageHash = channel + ':' + market['id'];
249424
249845
  client.resolve(stored, messageHash);
249846
+ // for multiOHLCV we need special object, as opposed to other "multi"
249847
+ // methods, because OHLCV response item does not contain symbol
249848
+ // or timeframe, thus otherwise it would be unrecognizable
249849
+ const messageHashForMulti = 'multi:' + channel + ':' + symbol;
249850
+ client.resolve([symbol, timeframe, stored], messageHashForMulti);
249425
249851
  }
249426
249852
  }
249427
249853
  async watchOrderBook(symbol, limit = undefined, params = {}) {
@@ -258515,7 +258941,6 @@ class probit extends _abstract_probit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
258515
258941
  const market = this.market(symbol);
258516
258942
  const request = {
258517
258943
  'market_id': market['id'],
258518
- 'limit': 100,
258519
258944
  'start_time': '1970-01-01T00:00:00.000Z',
258520
258945
  'end_time': this.iso8601(this.milliseconds()),
258521
258946
  };
@@ -258523,7 +258948,10 @@ class probit extends _abstract_probit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
258523
258948
  request['start_time'] = this.iso8601(since);
258524
258949
  }
258525
258950
  if (limit !== undefined) {
258526
- request['limit'] = Math.min(limit, 10000);
258951
+ request['limit'] = Math.min(limit, 1000);
258952
+ }
258953
+ else {
258954
+ request['limit'] = 1000; // required to set any value
258527
258955
  }
258528
258956
  const response = await this.publicGetTrade(this.extend(request, params));
258529
258957
  //
@@ -276616,7 +277044,7 @@ class wavesexchange extends _abstract_wavesexchange_js__WEBPACK_IMPORTED_MODULE_
276616
277044
  'priceAsset': market['quoteId'],
276617
277045
  };
276618
277046
  if (limit !== undefined) {
276619
- request['limit'] = limit;
277047
+ request['limit'] = Math.min(limit, 100);
276620
277048
  }
276621
277049
  if (since !== undefined) {
276622
277050
  request['timeStart'] = since;
@@ -280464,13 +280892,13 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
280464
280892
  'createMarketOrder': false,
280465
280893
  'createMarketOrderWithCost': false,
280466
280894
  'createMarketSellOrderWithCost': false,
280467
- 'createTrailingAmountOrder': true,
280468
- 'createTrailingPercentOrder': true,
280469
280895
  'createOrder': true,
280470
280896
  'createReduceOnlyOrder': true,
280471
280897
  'createStopLimitOrder': false,
280472
280898
  'createStopMarketOrder': false,
280473
280899
  'createStopOrder': false,
280900
+ 'createTrailingAmountOrder': true,
280901
+ 'createTrailingPercentOrder': true,
280474
280902
  'fetchAccounts': true,
280475
280903
  'fetchBalance': true,
280476
280904
  'fetchCanceledOrders': false,
@@ -281186,6 +281614,56 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
281186
281614
  params['createMarketBuyOrderRequiresPrice'] = false;
281187
281615
  return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
281188
281616
  }
281617
+ async createTrailingAmountOrder(symbol, type, side, amount, price = undefined, trailingAmount = undefined, trailingTriggerPrice = undefined, params = {}) {
281618
+ /**
281619
+ * @method
281620
+ * @name createTrailingAmountOrder
281621
+ * @description create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
281622
+ * @param {string} symbol unified symbol of the market to create an order in
281623
+ * @param {string} type 'market' or 'limit'
281624
+ * @param {string} side 'buy' or 'sell'
281625
+ * @param {float} amount how much you want to trade in units of the base currency, or number of contracts
281626
+ * @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
281627
+ * @param {float} trailingAmount the quote amount to trail away from the current market price
281628
+ * @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
281629
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
281630
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
281631
+ */
281632
+ if (trailingAmount === undefined) {
281633
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createTrailingAmountOrder() requires a trailingAmount argument');
281634
+ }
281635
+ if (trailingTriggerPrice === undefined) {
281636
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createTrailingAmountOrder() requires a trailingTriggerPrice argument');
281637
+ }
281638
+ params['trailingAmount'] = trailingAmount;
281639
+ params['trailingTriggerPrice'] = trailingTriggerPrice;
281640
+ return await this.createOrder(symbol, type, side, amount, price, params);
281641
+ }
281642
+ async createTrailingPercentOrder(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
281643
+ /**
281644
+ * @method
281645
+ * @name createTrailingPercentOrder
281646
+ * @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
281647
+ * @param {string} symbol unified symbol of the market to create an order in
281648
+ * @param {string} type 'market' or 'limit'
281649
+ * @param {string} side 'buy' or 'sell'
281650
+ * @param {float} amount how much you want to trade in units of the base currency, or number of contracts
281651
+ * @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
281652
+ * @param {float} trailingPercent the percent to trail away from the current market price
281653
+ * @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
281654
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
281655
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
281656
+ */
281657
+ if (trailingPercent === undefined) {
281658
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingPercent argument');
281659
+ }
281660
+ if (trailingTriggerPrice === undefined) {
281661
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingTriggerPrice argument');
281662
+ }
281663
+ params['trailingPercent'] = trailingPercent;
281664
+ params['trailingTriggerPrice'] = trailingTriggerPrice;
281665
+ return await this.createOrder(symbol, type, side, amount, price, params);
281666
+ }
281189
281667
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
281190
281668
  /**
281191
281669
  * @method
@@ -292654,7 +293132,7 @@ SOFTWARE.
292654
293132
 
292655
293133
  //-----------------------------------------------------------------------------
292656
293134
  // this is updated by vss.js when building
292657
- const version = '4.2.12';
293135
+ const version = '4.2.13';
292658
293136
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
292659
293137
  //-----------------------------------------------------------------------------
292660
293138