ccxt 4.1.4 → 4.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +1231 -81
  3. package/dist/ccxt.browser.min.js +12 -12
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/base/Exchange.js +216 -0
  6. package/dist/cjs/src/binance.js +96 -1
  7. package/dist/cjs/src/bingx.js +24 -0
  8. package/dist/cjs/src/bitfinex2.js +55 -11
  9. package/dist/cjs/src/bitget.js +132 -12
  10. package/dist/cjs/src/bitmex.js +49 -0
  11. package/dist/cjs/src/bybit.js +56 -3
  12. package/dist/cjs/src/coinbase.js +85 -6
  13. package/dist/cjs/src/coinbasepro.js +18 -0
  14. package/dist/cjs/src/coinex.js +1 -1
  15. package/dist/cjs/src/coinsph.js +1 -2
  16. package/dist/cjs/src/cryptocom.js +30 -0
  17. package/dist/cjs/src/gate.js +56 -3
  18. package/dist/cjs/src/huobi.js +69 -4
  19. package/dist/cjs/src/kraken.js +18 -8
  20. package/dist/cjs/src/krakenfutures.js +24 -0
  21. package/dist/cjs/src/kucoin.js +59 -4
  22. package/dist/cjs/src/kucoinfutures.js +35 -1
  23. package/dist/cjs/src/kuna.js +97 -10
  24. package/dist/cjs/src/okx.js +66 -4
  25. package/dist/cjs/src/poloniex.js +18 -2
  26. package/dist/cjs/src/pro/bitget.js +22 -6
  27. package/js/ccxt.d.ts +1 -1
  28. package/js/ccxt.js +1 -1
  29. package/js/src/abstract/kuna.d.ts +34 -0
  30. package/js/src/base/Exchange.d.ts +7 -0
  31. package/js/src/base/Exchange.js +216 -0
  32. package/js/src/binance.d.ts +5 -5
  33. package/js/src/binance.js +96 -1
  34. package/js/src/bingx.d.ts +1 -1
  35. package/js/src/bingx.js +24 -0
  36. package/js/src/bitfinex2.d.ts +3 -3
  37. package/js/src/bitfinex2.js +56 -12
  38. package/js/src/bitget.d.ts +7 -6
  39. package/js/src/bitget.js +132 -12
  40. package/js/src/bitmex.d.ts +6 -6
  41. package/js/src/bitmex.js +49 -0
  42. package/js/src/bybit.d.ts +6 -6
  43. package/js/src/bybit.js +56 -3
  44. package/js/src/coinbase.d.ts +5 -5
  45. package/js/src/coinbase.js +86 -7
  46. package/js/src/coinbasepro.d.ts +5 -5
  47. package/js/src/coinbasepro.js +18 -0
  48. package/js/src/coinex.js +1 -1
  49. package/js/src/coinsph.js +1 -2
  50. package/js/src/cryptocom.d.ts +4 -4
  51. package/js/src/cryptocom.js +30 -0
  52. package/js/src/gate.d.ts +4 -4
  53. package/js/src/gate.js +56 -3
  54. package/js/src/huobi.d.ts +2 -2
  55. package/js/src/huobi.js +69 -4
  56. package/js/src/kraken.d.ts +2 -2
  57. package/js/src/kraken.js +18 -8
  58. package/js/src/krakenfutures.d.ts +2 -2
  59. package/js/src/krakenfutures.js +24 -0
  60. package/js/src/kucoin.d.ts +5 -5
  61. package/js/src/kucoin.js +59 -4
  62. package/js/src/kucoinfutures.d.ts +4 -4
  63. package/js/src/kucoinfutures.js +35 -1
  64. package/js/src/kuna.d.ts +1 -0
  65. package/js/src/kuna.js +97 -10
  66. package/js/src/okx.d.ts +6 -6
  67. package/js/src/okx.js +66 -4
  68. package/js/src/poloniex.d.ts +1 -1
  69. package/js/src/poloniex.js +18 -2
  70. package/js/src/pro/bitget.d.ts +5 -0
  71. package/js/src/pro/bitget.js +22 -6
  72. package/package.json +1 -1
package/js/src/bitget.js CHANGED
@@ -1561,9 +1561,16 @@ export default class bitget extends Exchange {
1561
1561
  * @param {object} [params] extra parameters specific to the bitget api endpoint
1562
1562
  * @param {string} [params.pageNo] pageNo default 1
1563
1563
  * @param {string} [params.pageSize] pageSize default 20. Max 100
1564
+ * @param {int} [params.until] end tim in ms
1565
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1564
1566
  * @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
1565
1567
  */
1566
1568
  await this.loadMarkets();
1569
+ let paginate = false;
1570
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
1571
+ if (paginate) {
1572
+ return await this.fetchPaginatedCallDynamic('fetchDeposits', code, since, limit, params);
1573
+ }
1567
1574
  if (code === undefined) {
1568
1575
  throw new ArgumentsRequired(this.id + ' fetchDeposits() requires a `code` argument');
1569
1576
  }
@@ -1571,7 +1578,7 @@ export default class bitget extends Exchange {
1571
1578
  if (since === undefined) {
1572
1579
  since = this.milliseconds() - 31556952000; // 1yr
1573
1580
  }
1574
- const request = {
1581
+ let request = {
1575
1582
  'coin': currency['code'],
1576
1583
  'startTime': since,
1577
1584
  'endTime': this.milliseconds(),
@@ -1579,6 +1586,7 @@ export default class bitget extends Exchange {
1579
1586
  if (limit !== undefined) {
1580
1587
  request['pageSize'] = limit;
1581
1588
  }
1589
+ [request, params] = this.handleUntilOption('endTime', request, params);
1582
1590
  const response = await this.privateSpotGetWalletDepositList(this.extend(request, params));
1583
1591
  //
1584
1592
  // {
@@ -1691,9 +1699,16 @@ export default class bitget extends Exchange {
1691
1699
  * @param {object} [params] extra parameters specific to the bitget api endpoint
1692
1700
  * @param {string} [params.pageNo] pageNo default 1
1693
1701
  * @param {string} [params.pageSize] pageSize default 20. Max 100
1702
+ * @param {int} [params.until] end time in ms
1703
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1694
1704
  * @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
1695
1705
  */
1696
1706
  await this.loadMarkets();
1707
+ let paginate = false;
1708
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
1709
+ if (paginate) {
1710
+ return await this.fetchPaginatedCallDynamic('fetchWithdrawals', code, since, limit, params);
1711
+ }
1697
1712
  if (code === undefined) {
1698
1713
  throw new ArgumentsRequired(this.id + ' fetchWithdrawals() requires a `code` argument');
1699
1714
  }
@@ -1701,11 +1716,12 @@ export default class bitget extends Exchange {
1701
1716
  if (since === undefined) {
1702
1717
  since = this.milliseconds() - 31556952000; // 1yr
1703
1718
  }
1704
- const request = {
1719
+ let request = {
1705
1720
  'coin': currency['code'],
1706
1721
  'startTime': since,
1707
1722
  'endTime': this.milliseconds(),
1708
1723
  };
1724
+ [request, params] = this.handleUntilOption('endTime', params, request);
1709
1725
  if (limit !== undefined) {
1710
1726
  request['pageSize'] = limit;
1711
1727
  }
@@ -2250,9 +2266,15 @@ export default class bitget extends Exchange {
2250
2266
  * @param {int} [limit] the maximum amount of trades to fetch
2251
2267
  * @param {object} [params] extra parameters specific to the bitget api endpoint
2252
2268
  * @param {int} [params.until] the latest time in ms to fetch deposits for
2269
+ * @param {boolean} [params.paginate] *only applies to publicSpotGetMarketFillsHistory and publicMixGetMarketFillsHistory* default false, when true will automatically paginate by calling this endpoint multiple times
2253
2270
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
2254
2271
  */
2255
2272
  await this.loadMarkets();
2273
+ let paginate = false;
2274
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
2275
+ if (paginate) {
2276
+ return await this.fetchPaginatedCallCursor('fetchTrades', symbol, since, limit, params, 'tradeId', 'tradeId');
2277
+ }
2256
2278
  const market = this.market(symbol);
2257
2279
  const request = {
2258
2280
  'symbol': market['id'],
@@ -2269,10 +2291,9 @@ export default class bitget extends Exchange {
2269
2291
  }
2270
2292
  }
2271
2293
  if (until !== undefined) {
2272
- this.checkRequiredArgument('fetchTrades', since, 'since');
2294
+ params = this.omit(params, 'until');
2273
2295
  request['endTime'] = until;
2274
2296
  }
2275
- params = this.omit(params, 'until');
2276
2297
  const options = this.safeValue(this.options, 'fetchTrades', {});
2277
2298
  let response = undefined;
2278
2299
  if (market['spot']) {
@@ -2494,9 +2515,15 @@ export default class bitget extends Exchange {
2494
2515
  * @param {int} [limit] the maximum amount of candles to fetch
2495
2516
  * @param {object} [params] extra parameters specific to the bitget api endpoint
2496
2517
  * @param {int} [params.until] timestamp in ms of the latest candle to fetch
2518
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
2497
2519
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
2498
2520
  */
2499
2521
  await this.loadMarkets();
2522
+ let paginate = false;
2523
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
2524
+ if (paginate) {
2525
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000);
2526
+ }
2500
2527
  const market = this.market(symbol);
2501
2528
  const request = {
2502
2529
  'symbol': market['id'],
@@ -3592,9 +3619,10 @@ export default class bitget extends Exchange {
3592
3619
  if (typeof response === 'string') {
3593
3620
  response = JSON.parse(response);
3594
3621
  }
3595
- let data = this.safeValue(response, 'data', []);
3622
+ const data = this.safeValue(response, 'data', []);
3596
3623
  if (!Array.isArray(data)) {
3597
- data = this.safeValue(data, 'orderList', []);
3624
+ const result = this.safeValue(data, 'orderList', []);
3625
+ return this.addPaginationCursorToResult(data, result);
3598
3626
  }
3599
3627
  return this.parseOrders(data, market, since, limit);
3600
3628
  }
@@ -3605,15 +3633,26 @@ export default class bitget extends Exchange {
3605
3633
  * @description fetches information on multiple closed orders made by the user
3606
3634
  * @see https://bitgetlimited.github.io/apidoc/en/spot/#get-order-history
3607
3635
  * @see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-orders
3636
+ * @see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-plan-orders-tpsl
3637
+ * @see https://bitgetlimited.github.io/apidoc/en/spot/#get-history-plan-orders
3608
3638
  * @param {string} symbol unified market symbol of the closed orders
3609
3639
  * @param {int} [since] timestamp in ms of the earliest order
3610
3640
  * @param {int} [limit] the max number of closed orders to return
3611
3641
  * @param {object} [params] extra parameters specific to the bitget api endpoint
3642
+ * @param {int} [params.until] the latest time in ms to fetch entries for
3612
3643
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
3613
3644
  */
3614
3645
  await this.loadMarkets();
3615
3646
  this.checkRequiredSymbol('fetchClosedOrders', symbol);
3616
3647
  const market = this.market(symbol);
3648
+ let paginate = false;
3649
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
3650
+ if (paginate) {
3651
+ const isStop = this.safeValue2(params, 'stop', 'trigger', false);
3652
+ const cursorReceived = (market['spot'] && !isStop) ? 'orderId' : 'endId';
3653
+ const cursorSent = (market['spot'] && !isStop) ? 'after' : 'lastEndId';
3654
+ return await this.fetchPaginatedCallCursor('fetchClosedOrders', symbol, since, limit, params, cursorReceived, cursorSent, undefined, 50);
3655
+ }
3617
3656
  const response = await this.fetchCanceledAndClosedOrders(symbol, since, limit, params);
3618
3657
  const result = [];
3619
3658
  for (let i = 0; i < response.length; i++) {
@@ -3632,15 +3671,26 @@ export default class bitget extends Exchange {
3632
3671
  * @description fetches information on multiple canceled orders made by the user
3633
3672
  * @see https://bitgetlimited.github.io/apidoc/en/spot/#get-order-history
3634
3673
  * @see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-orders
3674
+ * @see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-plan-orders-tpsl
3675
+ * @see https://bitgetlimited.github.io/apidoc/en/spot/#get-history-plan-orders
3635
3676
  * @param {string} symbol unified market symbol of the canceled orders
3636
3677
  * @param {int} [since] timestamp in ms of the earliest order
3637
3678
  * @param {int} [limit] the max number of canceled orders to return
3638
3679
  * @param {object} [params] extra parameters specific to the bitget api endpoint
3680
+ * @param {int} [params.until] the latest time in ms to fetch entries for
3639
3681
  * @returns {object} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
3640
3682
  */
3641
3683
  await this.loadMarkets();
3642
3684
  this.checkRequiredSymbol('fetchCanceledOrders', symbol);
3643
3685
  const market = this.market(symbol);
3686
+ let paginate = false;
3687
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchCanceledOrders', 'paginate');
3688
+ if (paginate) {
3689
+ const isStop = this.safeValue2(params, 'stop', 'trigger', false);
3690
+ const cursorReceived = (market['spot'] && !isStop) ? 'orderId' : 'endId';
3691
+ const cursorSent = (market['spot'] && !isStop) ? 'after' : 'lastEndId';
3692
+ return await this.fetchPaginatedCallCursor('fetchCanceledOrders', symbol, since, limit, params, cursorReceived, cursorSent, undefined, 50);
3693
+ }
3644
3694
  const response = await this.fetchCanceledAndClosedOrders(symbol, since, limit, params);
3645
3695
  const result = [];
3646
3696
  for (let i = 0; i < response.length; i++) {
@@ -3657,9 +3707,14 @@ export default class bitget extends Exchange {
3657
3707
  const market = this.market(symbol);
3658
3708
  let marketType = undefined;
3659
3709
  [marketType, params] = this.handleMarketTypeAndParams('fetchCanceledAndClosedOrders', market, params);
3710
+ const endTime = this.safeIntegerN(params, ['endTime', 'until', 'till']);
3711
+ params = this.omit(params, ['until', 'till']);
3660
3712
  const request = {
3661
3713
  'symbol': market['id'],
3662
3714
  };
3715
+ if (since !== undefined) {
3716
+ request['startTime'] = since;
3717
+ }
3663
3718
  let method = this.getSupportedMapping(marketType, {
3664
3719
  'spot': 'privateSpotPostTradeHistory',
3665
3720
  'swap': 'privateMixGetOrderHistory',
@@ -3684,7 +3739,20 @@ export default class bitget extends Exchange {
3684
3739
  since = 0;
3685
3740
  }
3686
3741
  request['startTime'] = since;
3687
- request['endTime'] = this.milliseconds();
3742
+ if (endTime === undefined) {
3743
+ request['endTime'] = this.milliseconds();
3744
+ }
3745
+ else {
3746
+ request['endTime'] = endTime;
3747
+ }
3748
+ }
3749
+ else {
3750
+ if (limit !== undefined) {
3751
+ request['pageSize'] = limit;
3752
+ }
3753
+ if (endTime !== undefined) {
3754
+ request['endTime'] = endTime;
3755
+ }
3688
3756
  }
3689
3757
  const response = await this[method](this.extend(request, params));
3690
3758
  //
@@ -3805,30 +3873,57 @@ export default class bitget extends Exchange {
3805
3873
  //
3806
3874
  const data = this.safeValue(response, 'data');
3807
3875
  if (data !== undefined) {
3808
- return this.safeValue(data, 'orderList', data);
3876
+ const result = this.safeValue(data, 'orderList', data);
3877
+ return this.addPaginationCursorToResult(data, result);
3809
3878
  }
3810
3879
  const parsedData = JSON.parse(response);
3811
3880
  return this.safeValue(parsedData, 'data', []);
3812
3881
  }
3882
+ addPaginationCursorToResult(response, data) {
3883
+ const endId = this.safeValue(response, 'endId');
3884
+ if (endId !== undefined) {
3885
+ const dataLength = data.length;
3886
+ if (dataLength > 0) {
3887
+ const first = data[0];
3888
+ const last = data[dataLength - 1];
3889
+ first['endId'] = endId;
3890
+ last['endId'] = endId;
3891
+ data[0] = first;
3892
+ data[dataLength - 1] = last;
3893
+ }
3894
+ }
3895
+ return data;
3896
+ }
3813
3897
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
3814
3898
  /**
3815
3899
  * @method
3816
3900
  * @name bitget#fetchLedger
3817
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
3818
3901
  * @see https://bitgetlimited.github.io/apidoc/en/spot/#get-bills
3902
+ * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
3819
3903
  * @param {string} code unified currency code, default is undefined
3820
3904
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
3821
3905
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
3822
3906
  * @param {object} [params] extra parameters specific to the bitget api endpoint
3907
+ * @param {int} [params.until] end tim in ms
3908
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
3823
3909
  * @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
3824
3910
  */
3825
3911
  await this.loadMarkets();
3912
+ let paginate = false;
3913
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
3914
+ if (paginate) {
3915
+ return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params, 500);
3916
+ }
3826
3917
  let currency = undefined;
3827
- const request = {};
3918
+ let request = {};
3828
3919
  if (code !== undefined) {
3829
3920
  currency = this.currency(code);
3830
3921
  request['coinId'] = currency['id'];
3831
3922
  }
3923
+ if (since !== undefined) {
3924
+ request['before'] = since;
3925
+ }
3926
+ [request, params] = this.handleUntilOption('after', params, request);
3832
3927
  const response = await this.privateSpotPostAccountBills(this.extend(request, params));
3833
3928
  //
3834
3929
  // {
@@ -3910,12 +4005,24 @@ export default class bitget extends Exchange {
3910
4005
  * @param {int} [since] the earliest time in ms to fetch trades for
3911
4006
  * @param {int} [limit] the maximum number of trades structures to retrieve
3912
4007
  * @param {object} [params] extra parameters specific to the bitget api endpoint
4008
+ * @param {int} [params.until] *swap only* the latest time in ms to fetch entries for
4009
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
3913
4010
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
3914
4011
  */
3915
4012
  this.checkRequiredSymbol('fetchMyTrades', symbol);
3916
4013
  await this.loadMarkets();
3917
4014
  const market = this.market(symbol);
3918
- const request = {
4015
+ let paginate = false;
4016
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
4017
+ if (paginate) {
4018
+ if (market['spot']) {
4019
+ return await this.fetchPaginatedCallCursor('fetchMyTrades', symbol, since, limit, params, 'orderId', 'after', undefined, 50);
4020
+ }
4021
+ else {
4022
+ return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params, 500);
4023
+ }
4024
+ }
4025
+ let request = {
3919
4026
  'symbol': market['id'],
3920
4027
  };
3921
4028
  if (limit !== undefined) {
@@ -3926,6 +4033,10 @@ export default class bitget extends Exchange {
3926
4033
  response = await this.privateSpotPostTradeFills(this.extend(request, params));
3927
4034
  }
3928
4035
  else {
4036
+ if (since !== undefined) {
4037
+ request['startTime'] = since;
4038
+ }
4039
+ [request, params] = this.handleUntilOption('endTime', params, request);
3929
4040
  response = await this.privateMixGetOrderFills(this.extend(request, params));
3930
4041
  }
3931
4042
  //
@@ -4323,6 +4434,7 @@ export default class bitget extends Exchange {
4323
4434
  /**
4324
4435
  * @method
4325
4436
  * @name bitget#fetchFundingRateHistory
4437
+ * @see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-funding-rate
4326
4438
  * @description fetches historical funding rate prices
4327
4439
  * @see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-funding-rate
4328
4440
  * @param {string} symbol unified symbol of the market to fetch the funding rate history for
@@ -4799,16 +4911,23 @@ export default class bitget extends Exchange {
4799
4911
  * @param {int} [since] the earliest time in ms to fetch transfers for
4800
4912
  * @param {int} [limit] the maximum number of transfers structures to retrieve
4801
4913
  * @param {object} [params] extra parameters specific to the bitget api endpoint
4914
+ * @param {int} [params.until] the latest time in ms to fetch entries for
4915
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
4802
4916
  * @returns {object[]} a list of [transfer structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure}
4803
4917
  */
4804
4918
  await this.loadMarkets();
4919
+ let paginate = false;
4920
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchTransfers', 'paginate');
4921
+ if (paginate) {
4922
+ return await this.fetchPaginatedCallDynamic('fetchTransfers', code, since, limit, params);
4923
+ }
4805
4924
  let type = undefined;
4806
4925
  [type, params] = this.handleMarketTypeAndParams('fetchTransfers', undefined, params);
4807
4926
  const fromAccount = this.safeString(params, 'fromAccount', type);
4808
4927
  params = this.omit(params, 'fromAccount');
4809
4928
  const accountsByType = this.safeValue(this.options, 'accountsByType', {});
4810
4929
  type = this.safeString(accountsByType, fromAccount);
4811
- const request = {
4930
+ let request = {
4812
4931
  'fromType': type,
4813
4932
  };
4814
4933
  let currency = undefined;
@@ -4822,6 +4941,7 @@ export default class bitget extends Exchange {
4822
4941
  if (limit !== undefined) {
4823
4942
  request['limit'] = limit;
4824
4943
  }
4944
+ [request, params] = this.handleUntilOption('after', params, request);
4825
4945
  const response = await this.privateSpotGetAccountTransferRecords(this.extend(request, params));
4826
4946
  //
4827
4947
  // {
@@ -16,11 +16,11 @@ export default class bitmex extends Exchange {
16
16
  parseBalance(response: any): import("./base/types.js").Balances;
17
17
  fetchBalance(params?: {}): Promise<import("./base/types.js").Balances>;
18
18
  fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<any>;
19
- fetchOrder(id: string, symbol?: string, params?: {}): Promise<import("./base/types.js").Order>;
20
- fetchOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
21
- fetchOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
19
+ fetchOrder(id: string, symbol?: string, params?: {}): Promise<any>;
20
+ fetchOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
21
+ fetchOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
22
22
  fetchClosedOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any[]>;
23
- fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
23
+ fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
24
24
  parseLedgerEntryType(type: any): string;
25
25
  parseLedgerEntry(item: any, currency?: any): {
26
26
  id: string;
@@ -74,12 +74,12 @@ export default class bitmex extends Exchange {
74
74
  fetchTickers(symbols?: string[], params?: {}): Promise<any>;
75
75
  parseTicker(ticker: any, market?: any): import("./base/types.js").Ticker;
76
76
  parseOHLCV(ohlcv: any, market?: any): number[];
77
- fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").OHLCV[]>;
77
+ fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
78
78
  parseTrade(trade: any, market?: any): import("./base/types.js").Trade;
79
79
  parseOrderStatus(status: any): string;
80
80
  parseTimeInForce(timeInForce: any): string;
81
81
  parseOrder(order: any, market?: any): import("./base/types.js").Order;
82
- fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
82
+ fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
83
83
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<import("./base/types.js").Order>;
84
84
  editOrder(id: string, symbol: any, type: any, side: any, amount?: any, price?: any, params?: {}): Promise<import("./base/types.js").Order>;
85
85
  cancelOrder(id: string, symbol?: string, params?: {}): Promise<import("./base/types.js").Order>;
package/js/src/bitmex.js CHANGED
@@ -858,14 +858,22 @@ export default class bitmex extends Exchange {
858
858
  /**
859
859
  * @method
860
860
  * @name bitmex#fetchOrders
861
+ * @see https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders
861
862
  * @description fetches information on multiple orders made by the user
862
863
  * @param {string} symbol unified market symbol of the market orders were made in
863
864
  * @param {int} [since] the earliest time in ms to fetch orders for
864
865
  * @param {int} [limit] the maximum number of orde structures to retrieve
865
866
  * @param {object} [params] extra parameters specific to the bitmex api endpoint
867
+ * @param {int} [params.until] the earliest time in ms to fetch orders for
868
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
866
869
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
867
870
  */
868
871
  await this.loadMarkets();
872
+ let paginate = false;
873
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
874
+ if (paginate) {
875
+ return await this.fetchPaginatedCallDynamic('fetchOrders', symbol, since, limit, params, 100);
876
+ }
869
877
  let market = undefined;
870
878
  let request = {};
871
879
  if (symbol !== undefined) {
@@ -878,6 +886,11 @@ export default class bitmex extends Exchange {
878
886
  if (limit !== undefined) {
879
887
  request['count'] = limit;
880
888
  }
889
+ const until = this.safeInteger2(params, 'until', 'endTime');
890
+ if (until !== undefined) {
891
+ params = this.omit(params, ['until']);
892
+ request['endTime'] = this.iso8601(until);
893
+ }
881
894
  request = this.deepExtend(request, params);
882
895
  // why the hassle? urlencode in python is kinda broken for nested dicts.
883
896
  // E.g. self.urlencode({"filter": {"open": True}}) will return "filter={'open':+True}"
@@ -925,14 +938,21 @@ export default class bitmex extends Exchange {
925
938
  /**
926
939
  * @method
927
940
  * @name bitmex#fetchMyTrades
941
+ * @see https://www.bitmex.com/api/explorer/#!/Execution/Execution_getTradeHistory
928
942
  * @description fetch all trades made by the user
929
943
  * @param {string} symbol unified market symbol
930
944
  * @param {int} [since] the earliest time in ms to fetch trades for
931
945
  * @param {int} [limit] the maximum number of trades structures to retrieve
932
946
  * @param {object} [params] extra parameters specific to the bitmex api endpoint
947
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
933
948
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
934
949
  */
935
950
  await this.loadMarkets();
951
+ let paginate = false;
952
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
953
+ if (paginate) {
954
+ return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params, 100);
955
+ }
936
956
  let market = undefined;
937
957
  let request = {};
938
958
  if (symbol !== undefined) {
@@ -945,6 +965,11 @@ export default class bitmex extends Exchange {
945
965
  if (limit !== undefined) {
946
966
  request['count'] = limit;
947
967
  }
968
+ const until = this.safeInteger2(params, 'until', 'endTime');
969
+ if (until !== undefined) {
970
+ params = this.omit(params, ['until']);
971
+ request['endTime'] = this.iso8601(until);
972
+ }
948
973
  request = this.deepExtend(request, params);
949
974
  // why the hassle? urlencode in python is kinda broken for nested dicts.
950
975
  // E.g. self.urlencode({"filter": {"open": True}}) will return "filter={'open':+True}"
@@ -1393,15 +1418,22 @@ export default class bitmex extends Exchange {
1393
1418
  /**
1394
1419
  * @method
1395
1420
  * @name bitmex#fetchOHLCV
1421
+ * @see https://www.bitmex.com/api/explorer/#!/Trade/Trade_getBucketed
1396
1422
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1397
1423
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1398
1424
  * @param {string} timeframe the length of time each candle represents
1399
1425
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
1400
1426
  * @param {int} [limit] the maximum amount of candles to fetch
1401
1427
  * @param {object} [params] extra parameters specific to the bitmex api endpoint
1428
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1402
1429
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
1403
1430
  */
1404
1431
  await this.loadMarkets();
1432
+ let paginate = false;
1433
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
1434
+ if (paginate) {
1435
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params);
1436
+ }
1405
1437
  // send JSON key/value pairs, such as {"key": "value"}
1406
1438
  // filter by individual fields and do advanced queries on timestamps
1407
1439
  // let filter = { 'key': 'value' };
@@ -1422,6 +1454,11 @@ export default class bitmex extends Exchange {
1422
1454
  if (limit !== undefined) {
1423
1455
  request['count'] = limit; // default 100, max 500
1424
1456
  }
1457
+ const until = this.safeInteger2(params, 'until', 'endTime');
1458
+ if (until !== undefined) {
1459
+ params = this.omit(params, ['until']);
1460
+ request['endTime'] = this.iso8601(until);
1461
+ }
1425
1462
  const duration = this.parseTimeframe(timeframe) * 1000;
1426
1463
  const fetchOHLCVOpenTimestamp = this.safeValue(this.options, 'fetchOHLCVOpenTimestamp', true);
1427
1464
  // if since is not set, they will return candles starting from 2017-01-01
@@ -1705,14 +1742,21 @@ export default class bitmex extends Exchange {
1705
1742
  /**
1706
1743
  * @method
1707
1744
  * @name bitmex#fetchTrades
1745
+ * @see https://www.bitmex.com/api/explorer/#!/Trade/Trade_get
1708
1746
  * @description get the list of most recent trades for a particular symbol
1709
1747
  * @param {string} symbol unified symbol of the market to fetch trades for
1710
1748
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
1711
1749
  * @param {int} [limit] the maximum amount of trades to fetch
1712
1750
  * @param {object} [params] extra parameters specific to the bitmex api endpoint
1751
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters] (ttps://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1713
1752
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
1714
1753
  */
1715
1754
  await this.loadMarkets();
1755
+ let paginate = false;
1756
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
1757
+ if (paginate) {
1758
+ return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
1759
+ }
1716
1760
  const market = this.market(symbol);
1717
1761
  const request = {
1718
1762
  'symbol': market['id'],
@@ -1727,6 +1771,11 @@ export default class bitmex extends Exchange {
1727
1771
  if (limit !== undefined) {
1728
1772
  request['count'] = Math.min(limit, 1000); // api maximum 1000
1729
1773
  }
1774
+ const until = this.safeInteger2(params, 'until', 'endTime');
1775
+ if (until !== undefined) {
1776
+ params = this.omit(params, ['until']);
1777
+ request['endTime'] = this.iso8601(until);
1778
+ }
1730
1779
  const response = await this.publicGetTrade(this.extend(request, params));
1731
1780
  //
1732
1781
  // [
package/js/src/bybit.d.ts CHANGED
@@ -70,7 +70,7 @@ export default class bybit extends Exchange {
70
70
  fetchTicker(symbol: string, params?: {}): Promise<import("./base/types.js").Ticker>;
71
71
  fetchTickers(symbols?: string[], params?: {}): Promise<any>;
72
72
  parseOHLCV(ohlcv: any, market?: any): number[];
73
- fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").OHLCV[]>;
73
+ fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
74
74
  parseFundingRate(ticker: any, market?: any): {
75
75
  info: any;
76
76
  symbol: any;
@@ -112,14 +112,14 @@ export default class bybit extends Exchange {
112
112
  cancelAllUsdcOrders(symbol?: string, params?: {}): Promise<any>;
113
113
  cancelAllOrders(symbol?: string, params?: {}): Promise<any>;
114
114
  fetchUsdcOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
115
- fetchOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
116
- fetchClosedOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
117
- fetchCanceledOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
115
+ fetchOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
116
+ fetchClosedOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
117
+ fetchCanceledOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
118
118
  fetchUsdcOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
119
119
  fetchOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
120
- fetchOrderTrades(id: string, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
120
+ fetchOrderTrades(id: string, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
121
121
  fetchMyUsdcTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
122
- fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
122
+ fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
123
123
  parseDepositAddress(depositAddress: any, currency?: any): {
124
124
  currency: string;
125
125
  address: string;