ccxt 4.1.5 → 4.1.7

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 (61) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +1106 -55
  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/cryptocom.js +30 -0
  15. package/dist/cjs/src/gate.js +56 -3
  16. package/dist/cjs/src/huobi.js +69 -4
  17. package/dist/cjs/src/kraken.js +17 -3
  18. package/dist/cjs/src/krakenfutures.js +24 -0
  19. package/dist/cjs/src/kucoin.js +59 -4
  20. package/dist/cjs/src/kucoinfutures.js +35 -1
  21. package/dist/cjs/src/okx.js +66 -4
  22. package/dist/cjs/src/poloniex.js +18 -2
  23. package/js/ccxt.d.ts +1 -1
  24. package/js/ccxt.js +1 -1
  25. package/js/src/base/Exchange.d.ts +7 -0
  26. package/js/src/base/Exchange.js +216 -0
  27. package/js/src/binance.d.ts +5 -5
  28. package/js/src/binance.js +96 -1
  29. package/js/src/bingx.d.ts +1 -1
  30. package/js/src/bingx.js +24 -0
  31. package/js/src/bitfinex2.d.ts +3 -3
  32. package/js/src/bitfinex2.js +56 -12
  33. package/js/src/bitget.d.ts +7 -6
  34. package/js/src/bitget.js +132 -12
  35. package/js/src/bitmex.d.ts +6 -6
  36. package/js/src/bitmex.js +49 -0
  37. package/js/src/bybit.d.ts +6 -6
  38. package/js/src/bybit.js +56 -3
  39. package/js/src/coinbase.d.ts +5 -5
  40. package/js/src/coinbase.js +86 -7
  41. package/js/src/coinbasepro.d.ts +5 -5
  42. package/js/src/coinbasepro.js +18 -0
  43. package/js/src/cryptocom.d.ts +4 -4
  44. package/js/src/cryptocom.js +30 -0
  45. package/js/src/gate.d.ts +4 -4
  46. package/js/src/gate.js +56 -3
  47. package/js/src/huobi.d.ts +2 -2
  48. package/js/src/huobi.js +69 -4
  49. package/js/src/kraken.d.ts +1 -1
  50. package/js/src/kraken.js +17 -3
  51. package/js/src/krakenfutures.d.ts +2 -2
  52. package/js/src/krakenfutures.js +24 -0
  53. package/js/src/kucoin.d.ts +5 -5
  54. package/js/src/kucoin.js +59 -4
  55. package/js/src/kucoinfutures.d.ts +4 -4
  56. package/js/src/kucoinfutures.js +35 -1
  57. package/js/src/okx.d.ts +6 -6
  58. package/js/src/okx.js +66 -4
  59. package/js/src/poloniex.d.ts +1 -1
  60. package/js/src/poloniex.js +18 -2
  61. package/package.json +1 -1
@@ -2356,21 +2356,31 @@ class huobi extends huobi$1 {
2356
2356
  /**
2357
2357
  * @method
2358
2358
  * @name huobi#fetchMyTrades
2359
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-history-match-results-via-multiple-fields-new
2360
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-history-match-results-via-multiple-fields-new
2361
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#search-match-results
2359
2362
  * @description fetch all trades made by the user
2360
2363
  * @param {string} symbol unified market symbol
2361
2364
  * @param {int} [since] the earliest time in ms to fetch trades for
2362
2365
  * @param {int} [limit] the maximum number of trades structures to retrieve
2363
2366
  * @param {object} [params] extra parameters specific to the huobi api endpoint
2367
+ * @param {int} [params.until] the latest time in ms to fetch trades for
2368
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
2364
2369
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
2365
2370
  */
2366
2371
  await this.loadMarkets();
2372
+ let paginate = false;
2373
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
2374
+ if (paginate) {
2375
+ return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
2376
+ }
2367
2377
  let market = undefined;
2368
2378
  if (symbol !== undefined) {
2369
2379
  market = this.market(symbol);
2370
2380
  }
2371
2381
  let marketType = undefined;
2372
2382
  [marketType, params] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
2373
- const request = {
2383
+ let request = {
2374
2384
  // spot -----------------------------------------------------------
2375
2385
  // 'symbol': market['id'],
2376
2386
  // 'types': 'buy-market,sell-market,buy-limit,sell-limit,buy-ioc,sell-ioc,buy-limit-maker,sell-limit-maker,buy-stop-limit,sell-stop-limit',
@@ -2402,6 +2412,7 @@ class huobi extends huobi$1 {
2402
2412
  request['start-time'] = since; // a date within 120 days from today
2403
2413
  // request['end-time'] = this.sum (since, 172800000); // 48 hours window
2404
2414
  }
2415
+ [request, params] = this.handleUntilOption('end-time', request, params);
2405
2416
  method = 'spotPrivateGetV1OrderMatchresults';
2406
2417
  }
2407
2418
  else {
@@ -2412,6 +2423,7 @@ class huobi extends huobi$1 {
2412
2423
  request['start_time'] = since; // a date within 120 days from today
2413
2424
  // request['end_time'] = this.sum (request['start_time'], 172800000); // 48 hours window
2414
2425
  }
2426
+ [request, params] = this.handleUntilOption('end_time', request, params);
2415
2427
  if (limit !== undefined) {
2416
2428
  request['page_size'] = limit; // default 100, max 500
2417
2429
  }
@@ -2516,6 +2528,10 @@ class huobi extends huobi$1 {
2516
2528
  /**
2517
2529
  * @method
2518
2530
  * @name huobi#fetchTrades
2531
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-the-most-recent-trades
2532
+ * @see https://huobiapi.github.io/docs/dm/v1/en/#query-a-batch-of-trade-records-of-a-contract
2533
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-a-batch-of-trade-records-of-a-contract
2534
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-a-batch-of-trade-records-of-a-contract
2519
2535
  * @description get the list of most recent trades for a particular symbol
2520
2536
  * @param {string} symbol unified symbol of the market to fetch trades for
2521
2537
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
@@ -2626,9 +2642,15 @@ class huobi extends huobi$1 {
2626
2642
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
2627
2643
  * @param {int} [limit] the maximum amount of candles to fetch
2628
2644
  * @param {object} [params] extra parameters specific to the huobi api endpoint
2645
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
2629
2646
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
2630
2647
  */
2631
2648
  await this.loadMarkets();
2649
+ let paginate = false;
2650
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
2651
+ if (paginate) {
2652
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000);
2653
+ }
2632
2654
  const market = this.market(symbol);
2633
2655
  const request = {
2634
2656
  'period': this.safeString(this.timeframes, timeframe, timeframe),
@@ -3541,7 +3563,7 @@ class huobi extends huobi$1 {
3541
3563
  }
3542
3564
  await this.loadMarkets();
3543
3565
  let market = undefined;
3544
- const request = {
3566
+ let request = {
3545
3567
  // spot_private_get_v1_order_orders GET /v1/order/orders ----------
3546
3568
  // 'symbol': market['id'], // required
3547
3569
  // 'types': 'buy-market,sell-market,buy-limit,sell-limit,buy-ioc,sell-ioc,buy-stop-limit,sell-stop-limit,buy-limit-fok,sell-limit-fok,buy-stop-limit-fok,sell-stop-limit-fok',
@@ -3566,6 +3588,7 @@ class huobi extends huobi$1 {
3566
3588
  request['start-time'] = since; // a window of 48 hours within 180 days
3567
3589
  request['end-time'] = this.sum(since, 48 * 60 * 60 * 1000);
3568
3590
  }
3591
+ [request, params] = this.handleUntilOption('end-time', request, params);
3569
3592
  if (limit !== undefined) {
3570
3593
  request['size'] = limit;
3571
3594
  }
@@ -3609,7 +3632,7 @@ class huobi extends huobi$1 {
3609
3632
  this.checkRequiredSymbol('fetchContractOrders', symbol);
3610
3633
  await this.loadMarkets();
3611
3634
  const market = this.market(symbol);
3612
- const request = {
3635
+ let request = {
3613
3636
  // POST /api/v1/contract_hisorders inverse futures ----------------
3614
3637
  // 'symbol': market['settleId'], // BTC, ETH, ...
3615
3638
  // 'order_type': '1', // 1 limit,3 opponent,4 lightning, 5 trigger order, 6 pst_only, 7 optimal_5, 8 optimal_10, 9 optimal_20, 10 fok, 11 ioc
@@ -3638,6 +3661,7 @@ class huobi extends huobi$1 {
3638
3661
  request['contract'] = market['id'];
3639
3662
  request['type'] = 1; // 1:All Orders,2:Order in Finished Status
3640
3663
  }
3664
+ [request, params] = this.handleUntilOption('end_time', request, params);
3641
3665
  if (market['linear']) {
3642
3666
  let marginMode = undefined;
3643
3667
  [marginMode, params] = this.handleMarginModeAndParams('fetchContractOrders', params);
@@ -3848,6 +3872,12 @@ class huobi extends huobi$1 {
3848
3872
  /**
3849
3873
  * @method
3850
3874
  * @name huobi#fetchOrders
3875
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#search-past-orders
3876
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#search-historical-orders-within-48-hours
3877
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-history-orders-new
3878
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-history-orders-new
3879
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-history-orders-new
3880
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-history-orders-via-multiple-fields-new
3851
3881
  * @description fetches information on multiple orders made by the user
3852
3882
  * @param {string} symbol unified market symbol of the market orders were made in
3853
3883
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -3855,6 +3885,7 @@ class huobi extends huobi$1 {
3855
3885
  * @param {object} [params] extra parameters specific to the huobi api endpoint
3856
3886
  * @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
3857
3887
  * @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
3888
+ * @param {int} [params.until] the latest time in ms to fetch entries for
3858
3889
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
3859
3890
  */
3860
3891
  await this.loadMarkets();
@@ -3881,14 +3912,27 @@ class huobi extends huobi$1 {
3881
3912
  /**
3882
3913
  * @method
3883
3914
  * @name huobi#fetchClosedOrders
3915
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#search-past-orders
3916
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#search-historical-orders-within-48-hours
3917
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-history-orders-new
3918
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-history-orders-new
3919
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-history-orders-new
3920
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-history-orders-via-multiple-fields-new
3884
3921
  * @description fetches information on multiple closed orders made by the user
3885
3922
  * @param {string} symbol unified market symbol of the market orders were made in
3886
3923
  * @param {int} [since] the earliest time in ms to fetch orders for
3887
3924
  * @param {int} [limit] the maximum number of orde structures to retrieve
3888
3925
  * @param {object} [params] extra parameters specific to the huobi api endpoint
3926
+ * @param {int} [params.until] the latest time in ms to fetch entries for
3927
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
3889
3928
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
3890
3929
  */
3891
3930
  await this.loadMarkets();
3931
+ let paginate = false;
3932
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
3933
+ if (paginate) {
3934
+ return await this.fetchPaginatedCallDynamic('fetchClosedOrders', symbol, since, limit, params, 100);
3935
+ }
3892
3936
  let market = undefined;
3893
3937
  if (symbol !== undefined) {
3894
3938
  market = this.market(symbol);
@@ -3908,6 +3952,9 @@ class huobi extends huobi$1 {
3908
3952
  /**
3909
3953
  * @method
3910
3954
  * @name huobi#fetchOpenOrders
3955
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-open-orders
3956
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-current-unfilled-order-acquisition
3957
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-current-unfilled-order-acquisition
3911
3958
  * @description fetch all unfilled currently open orders
3912
3959
  * @param {string} symbol unified market symbol
3913
3960
  * @param {int} [since] the earliest time in ms to fetch open orders for
@@ -6018,6 +6065,8 @@ class huobi extends huobi$1 {
6018
6065
  /**
6019
6066
  * @method
6020
6067
  * @name huobi#fetchFundingRateHistory
6068
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-historical-funding-rate
6069
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-historical-funding-rate
6021
6070
  * @description fetches historical funding rate prices
6022
6071
  * @param {string} symbol unified symbol of the market to fetch the funding rate history for
6023
6072
  * @param {int} [since] not used by huobi, but filtered internally by ccxt
@@ -6026,6 +6075,11 @@ class huobi extends huobi$1 {
6026
6075
  * @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
6027
6076
  */
6028
6077
  this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
6078
+ let paginate = false;
6079
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
6080
+ if (paginate) {
6081
+ return await this.fetchPaginatedCallCursor('fetchFundingRateHistory', symbol, since, limit, params, 'page_index', 'current_page', 1, 50);
6082
+ }
6029
6083
  await this.loadMarkets();
6030
6084
  const market = this.market(symbol);
6031
6085
  const request = {
@@ -6065,10 +6119,12 @@ class huobi extends huobi$1 {
6065
6119
  // }
6066
6120
  //
6067
6121
  const data = this.safeValue(response, 'data');
6122
+ const cursor = this.safeValue(data, 'current_page');
6068
6123
  const result = this.safeValue(data, 'data', []);
6069
6124
  const rates = [];
6070
6125
  for (let i = 0; i < result.length; i++) {
6071
6126
  const entry = result[i];
6127
+ entry['current_page'] = cursor;
6072
6128
  const marketId = this.safeString(entry, 'contract_code');
6073
6129
  const symbolInner = this.safeSymbol(marketId);
6074
6130
  const timestamp = this.safeInteger(entry, 'funding_time');
@@ -7229,16 +7285,24 @@ class huobi extends huobi$1 {
7229
7285
  /**
7230
7286
  * @method
7231
7287
  * @name huobi#fetchLedger
7288
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-account-history
7232
7289
  * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
7233
7290
  * @param {string} code unified currency code, default is undefined
7234
7291
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
7235
7292
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
7236
7293
  * @param {object} [params] extra parameters specific to the huobi api endpoint
7294
+ * @param {int} [params.until] the latest time in ms to fetch entries for
7295
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
7237
7296
  * @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
7238
7297
  */
7239
7298
  await this.loadMarkets();
7299
+ let paginate = false;
7300
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
7301
+ if (paginate) {
7302
+ return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params, 500);
7303
+ }
7240
7304
  const accountId = await this.fetchAccountIdByType('spot', undefined, undefined, params);
7241
- const request = {
7305
+ let request = {
7242
7306
  'accountId': accountId,
7243
7307
  // 'currency': code,
7244
7308
  // 'transactTypes': 'all', // default all
@@ -7259,6 +7323,7 @@ class huobi extends huobi$1 {
7259
7323
  if (limit !== undefined) {
7260
7324
  request['limit'] = limit; // max 500
7261
7325
  }
7326
+ [request, params] = this.handleUntilOption('endTime', request, params);
7262
7327
  const response = await this.spotPrivateGetV2AccountLedger(this.extend(request, params));
7263
7328
  //
7264
7329
  // {
@@ -860,9 +860,15 @@ class kraken extends kraken$1 {
860
860
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
861
861
  * @param {int} [limit] the maximum amount of candles to fetch
862
862
  * @param {object} [params] extra parameters specific to the kraken api endpoint
863
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
863
864
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
864
865
  */
865
866
  await this.loadMarkets();
867
+ let paginate = false;
868
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
869
+ if (paginate) {
870
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 720);
871
+ }
866
872
  const market = this.market(symbol);
867
873
  const parsedTimeframe = this.safeInteger(this.timeframes, timeframe);
868
874
  const request = {
@@ -962,17 +968,19 @@ class kraken extends kraken$1 {
962
968
  /**
963
969
  * @method
964
970
  * @name kraken#fetchLedger
971
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getLedgers
965
972
  * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
966
973
  * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getLedgers
967
974
  * @param {string} code unified currency code, default is undefined
968
975
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
969
976
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
970
977
  * @param {object} [params] extra parameters specific to the kraken api endpoint
978
+ * @param {int} [params.until] timestamp in ms of the latest ledger entry
971
979
  * @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
972
980
  */
973
981
  // https://www.kraken.com/features/api#get-ledgers-info
974
982
  await this.loadMarkets();
975
- const request = {};
983
+ let request = {};
976
984
  let currency = undefined;
977
985
  if (code !== undefined) {
978
986
  currency = this.currency(code);
@@ -981,6 +989,7 @@ class kraken extends kraken$1 {
981
989
  if (since !== undefined) {
982
990
  request['start'] = this.parseToInt(since / 1000);
983
991
  }
992
+ [request, params] = this.handleUntilOption('end', request, params);
984
993
  const response = await this.privatePostLedgers(this.extend(request, params));
985
994
  // { error: [],
986
995
  // result: { ledger: { 'LPUAIB-TS774-UKHP7X': { refid: "A2B4HBV-L4MDIE-JU4N3N",
@@ -1459,7 +1468,7 @@ class kraken extends kraken$1 {
1459
1468
  id = this.safeString(txid, 0);
1460
1469
  }
1461
1470
  const clientOrderId = this.safeString(order, 'userref');
1462
- const rawTrades = this.safeValue(order, 'trades');
1471
+ const rawTrades = this.safeValue(order, 'trades', []);
1463
1472
  const trades = [];
1464
1473
  for (let i = 0; i < rawTrades.length; i++) {
1465
1474
  const rawTrade = rawTrades[i];
@@ -1927,6 +1936,7 @@ class kraken extends kraken$1 {
1927
1936
  /**
1928
1937
  * @method
1929
1938
  * @name kraken#fetchOpenOrders
1939
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenOrders
1930
1940
  * @description fetch all unfilled currently open orders
1931
1941
  * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenOrders
1932
1942
  * @param {string} symbol unified market symbol
@@ -1959,16 +1969,18 @@ class kraken extends kraken$1 {
1959
1969
  /**
1960
1970
  * @method
1961
1971
  * @name kraken#fetchClosedOrders
1972
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
1962
1973
  * @description fetches information on multiple closed orders made by the user
1963
1974
  * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
1964
1975
  * @param {string} symbol unified market symbol of the market orders were made in
1965
1976
  * @param {int} [since] the earliest time in ms to fetch orders for
1966
1977
  * @param {int} [limit] the maximum number of orde structures to retrieve
1967
1978
  * @param {object} [params] extra parameters specific to the kraken api endpoint
1979
+ * @param {int} [params.until] timestamp in ms of the latest entry
1968
1980
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1969
1981
  */
1970
1982
  await this.loadMarkets();
1971
- const request = {};
1983
+ let request = {};
1972
1984
  if (since !== undefined) {
1973
1985
  request['start'] = this.parseToInt(since / 1000);
1974
1986
  }
@@ -1978,6 +1990,7 @@ class kraken extends kraken$1 {
1978
1990
  request['userref'] = clientOrderId;
1979
1991
  query = this.omit(params, ['userref', 'clientOrderId']);
1980
1992
  }
1993
+ [request, params] = this.handleUntilOption('end', request, params);
1981
1994
  const response = await this.privatePostClosedOrders(this.extend(request, query));
1982
1995
  //
1983
1996
  // {
@@ -2157,6 +2170,7 @@ class kraken extends kraken$1 {
2157
2170
  /**
2158
2171
  * @method
2159
2172
  * @name kraken#fetchDeposits
2173
+ * @see https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentDeposits
2160
2174
  * @description fetch all deposits made to an account
2161
2175
  * @see https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentDeposits
2162
2176
  * @param {string} code unified currency code
@@ -561,8 +561,26 @@ class krakenfutures extends krakenfutures$1 {
561
561
  });
562
562
  }
563
563
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
564
+ /**
565
+ * @method
566
+ * @name kraken#fetchOHLCV
567
+ * @see https://docs.futures.kraken.com/#http-api-charts-candles
568
+ * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
569
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
570
+ * @param {string} timeframe the length of time each candle represents
571
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
572
+ * @param {int} [limit] the maximum amount of candles to fetch
573
+ * @param {object} [params] extra parameters specific to the kraken api endpoint
574
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
575
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
576
+ */
564
577
  await this.loadMarkets();
565
578
  const market = this.market(symbol);
579
+ let paginate = false;
580
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
581
+ if (paginate) {
582
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 5000);
583
+ }
566
584
  const request = {
567
585
  'symbol': market['id'],
568
586
  'price_type': this.safeString(params, 'price', 'trade'),
@@ -639,9 +657,15 @@ class krakenfutures extends krakenfutures$1 {
639
657
  * @param {int} [limit] Total number of trades, cannot exceed 100
640
658
  * @param {object} [params] Exchange specific params
641
659
  * @param {int} [params.until] Timestamp in ms of latest trade
660
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
642
661
  * @returns An array of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
643
662
  */
644
663
  await this.loadMarkets();
664
+ let paginate = false;
665
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
666
+ if (paginate) {
667
+ return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
668
+ }
645
669
  const market = this.market(symbol);
646
670
  const request = {
647
671
  'symbol': market['id'],
@@ -1558,9 +1558,15 @@ class kucoin extends kucoin$1 {
1558
1558
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
1559
1559
  * @param {int} [limit] the maximum amount of candles to fetch
1560
1560
  * @param {object} [params] extra parameters specific to the kucoin api endpoint
1561
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1561
1562
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
1562
1563
  */
1563
1564
  await this.loadMarkets();
1565
+ let paginate = false;
1566
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
1567
+ if (paginate) {
1568
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1500);
1569
+ }
1564
1570
  const market = this.market(symbol);
1565
1571
  const marketId = market['id'];
1566
1572
  const request = {
@@ -2216,8 +2222,15 @@ class kucoin extends kucoin$1 {
2216
2222
  * @param {string} [params.tradeType] TRADE for spot trading, MARGIN_TRADE for Margin Trading
2217
2223
  * @param {bool} [params.stop] True if fetching a stop order
2218
2224
  * @param {bool} [params.hf] false, // true for hf order
2225
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
2219
2226
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2220
2227
  */
2228
+ await this.loadMarkets;
2229
+ let paginate = false;
2230
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
2231
+ if (paginate) {
2232
+ return await this.fetchPaginatedCallDynamic('fetchClosedOrders', symbol, since, limit, params);
2233
+ }
2221
2234
  return await this.fetchOrdersByStatus('done', symbol, since, limit, params);
2222
2235
  }
2223
2236
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -2242,8 +2255,15 @@ class kucoin extends kucoin$1 {
2242
2255
  * @param {string} [params.orderIds] *stop orders only* comma seperated order ID list
2243
2256
  * @param {bool} [params.stop] True if fetching a stop order
2244
2257
  * @param {bool} [params.hf] false, // true for hf order
2258
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
2245
2259
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2246
2260
  */
2261
+ await this.loadMarkets;
2262
+ let paginate = false;
2263
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'paginate');
2264
+ if (paginate) {
2265
+ return await this.fetchPaginatedCallDynamic('fetchOpenOrders', symbol, since, limit, params);
2266
+ }
2247
2267
  return await this.fetchOrdersByStatus('active', symbol, since, limit, params);
2248
2268
  }
2249
2269
  async fetchOrder(id, symbol = undefined, params = {}) {
@@ -2530,11 +2550,18 @@ class kucoin extends kucoin$1 {
2530
2550
  * @param {int} [since] the earliest time in ms to fetch trades for
2531
2551
  * @param {int} [limit] the maximum number of trades structures to retrieve
2532
2552
  * @param {object} [params] extra parameters specific to the kucoin api endpoint
2553
+ * @param {int} [params.until] the latest time in ms to fetch entries for
2533
2554
  * @param {bool} [params.hf] false, // true for hf order
2555
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
2534
2556
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
2535
2557
  */
2536
2558
  await this.loadMarkets();
2537
- const request = {};
2559
+ let paginate = false;
2560
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
2561
+ if (paginate) {
2562
+ return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
2563
+ }
2564
+ let request = {};
2538
2565
  const hf = this.safeValue(params, 'hf', false);
2539
2566
  if (hf && symbol === undefined) {
2540
2567
  throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol parameter for hf orders');
@@ -2576,6 +2603,7 @@ class kucoin extends kucoin$1 {
2576
2603
  else {
2577
2604
  throw new errors.ExchangeError(this.id + ' fetchMyTradesMethod() invalid method');
2578
2605
  }
2606
+ [request, params] = this.handleUntilOption('endAt', request, params);
2579
2607
  const response = await this[method](this.extend(request, params));
2580
2608
  //
2581
2609
  // {
@@ -3017,6 +3045,8 @@ class kucoin extends kucoin$1 {
3017
3045
  /**
3018
3046
  * @method
3019
3047
  * @name kucoin#fetchDeposits
3048
+ * @see https://docs.kucoin.com/#get-deposit-list
3049
+ * @see https://docs.kucoin.com/#get-v1-historical-deposits-list
3020
3050
  * @description fetch all deposits made to an account
3021
3051
  * @see https://docs.kucoin.com/#get-deposit-list
3022
3052
  * @see https://docs.kucoin.com/#get-v1-historical-deposits-list
@@ -3024,10 +3054,17 @@ class kucoin extends kucoin$1 {
3024
3054
  * @param {int} [since] the earliest time in ms to fetch deposits for
3025
3055
  * @param {int} [limit] the maximum number of deposits structures to retrieve
3026
3056
  * @param {object} [params] extra parameters specific to the kucoin api endpoint
3057
+ * @param {int} [params.until] the latest time in ms to fetch entries for
3058
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
3027
3059
  * @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
3028
3060
  */
3029
3061
  await this.loadMarkets();
3030
- const request = {};
3062
+ let paginate = false;
3063
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
3064
+ if (paginate) {
3065
+ return await this.fetchPaginatedCallDynamic('fetchDeposits', code, since, limit, params);
3066
+ }
3067
+ let request = {};
3031
3068
  let currency = undefined;
3032
3069
  if (code !== undefined) {
3033
3070
  currency = this.currency(code);
@@ -3047,6 +3084,7 @@ class kucoin extends kucoin$1 {
3047
3084
  request['startAt'] = since;
3048
3085
  }
3049
3086
  }
3087
+ [request, params] = this.handleUntilOption('endAt', request, params);
3050
3088
  const response = await this[method](this.extend(request, params));
3051
3089
  //
3052
3090
  // {
@@ -3100,10 +3138,17 @@ class kucoin extends kucoin$1 {
3100
3138
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
3101
3139
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
3102
3140
  * @param {object} [params] extra parameters specific to the kucoin api endpoint
3141
+ * @param {int} [params.until] the latest time in ms to fetch entries for
3142
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
3103
3143
  * @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
3104
3144
  */
3105
3145
  await this.loadMarkets();
3106
- const request = {};
3146
+ let paginate = false;
3147
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
3148
+ if (paginate) {
3149
+ return await this.fetchPaginatedCallDynamic('fetchWithdrawals', code, since, limit, params);
3150
+ }
3151
+ let request = {};
3107
3152
  let currency = undefined;
3108
3153
  if (code !== undefined) {
3109
3154
  currency = this.currency(code);
@@ -3123,6 +3168,7 @@ class kucoin extends kucoin$1 {
3123
3168
  request['startAt'] = since;
3124
3169
  }
3125
3170
  }
3171
+ [request, params] = this.handleUntilOption('endAt', request, params);
3126
3172
  const response = await this[method](this.extend(request, params));
3127
3173
  //
3128
3174
  // {
@@ -3609,17 +3655,25 @@ class kucoin extends kucoin$1 {
3609
3655
  /**
3610
3656
  * @method
3611
3657
  * @name kucoin#fetchLedger
3658
+ * @see https://docs.kucoin.com/#get-account-ledgers
3612
3659
  * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
3613
3660
  * @see https://docs.kucoin.com/#get-account-ledgers
3614
3661
  * @param {string} code unified currency code, default is undefined
3615
3662
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
3616
3663
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
3617
3664
  * @param {object} [params] extra parameters specific to the kucoin api endpoint
3665
+ * @param {int} [params.until] the latest time in ms to fetch entries for
3666
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
3618
3667
  * @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
3619
3668
  */
3620
3669
  await this.loadMarkets();
3621
3670
  await this.loadAccounts();
3622
- const request = {
3671
+ let paginate = false;
3672
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
3673
+ if (paginate) {
3674
+ return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
3675
+ }
3676
+ let request = {
3623
3677
  // 'currency': currency['id'], // can choose up to 10, if not provided returns for all currencies by default
3624
3678
  // 'direction': 'in', // 'out'
3625
3679
  // 'bizType': 'DEPOSIT', // DEPOSIT, WITHDRAW, TRANSFER, SUB_TRANSFER,TRADE_EXCHANGE, MARGIN_EXCHANGE, KUCOIN_BONUS (optional)
@@ -3635,6 +3689,7 @@ class kucoin extends kucoin$1 {
3635
3689
  currency = this.currency(code);
3636
3690
  request['currency'] = currency['id'];
3637
3691
  }
3692
+ [request, params] = this.handleUntilOption('endAt', request, params);
3638
3693
  const response = await this.privateGetAccountsLedgers(this.extend(request, params));
3639
3694
  //
3640
3695
  // {
@@ -537,9 +537,15 @@ class kucoinfutures extends kucoinfutures$1 {
537
537
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
538
538
  * @param {int} [limit] the maximum amount of candles to fetch
539
539
  * @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
540
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
540
541
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
541
542
  */
542
543
  await this.loadMarkets();
544
+ let paginate = false;
545
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
546
+ if (paginate) {
547
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 200);
548
+ }
543
549
  const market = this.market(symbol);
544
550
  const marketId = market['id'];
545
551
  const parsedTimeframe = this.safeInteger(this.timeframes, timeframe);
@@ -1419,9 +1425,15 @@ class kucoinfutures extends kucoinfutures$1 {
1419
1425
  * @param {int} [params.until] End time in ms
1420
1426
  * @param {string} [params.side] buy or sell
1421
1427
  * @param {string} [params.type] limit or market
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](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1422
1429
  * @returns An [array of order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1423
1430
  */
1424
1431
  await this.loadMarkets();
1432
+ let paginate = false;
1433
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOrdersByStatus', 'paginate');
1434
+ if (paginate) {
1435
+ return await this.fetchPaginatedCallDynamic('fetchOrdersByStatus', symbol, since, limit, params);
1436
+ }
1425
1437
  const stop = this.safeValue(params, 'stop');
1426
1438
  const until = this.safeInteger2(params, 'until', 'till');
1427
1439
  params = this.omit(params, ['stop', 'until', 'till']);
@@ -1519,8 +1531,15 @@ class kucoinfutures extends kucoinfutures$1 {
1519
1531
  * @param {int} [params.till] end time in ms
1520
1532
  * @param {string} [params.side] buy or sell
1521
1533
  * @param {string} [params.type] limit, or market
1534
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1522
1535
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1523
1536
  */
1537
+ await this.loadMarkets;
1538
+ let paginate = false;
1539
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
1540
+ if (paginate) {
1541
+ return await this.fetchPaginatedCallDynamic('fetchClosedOrders', symbol, since, limit, params);
1542
+ }
1524
1543
  return await this.fetchOrdersByStatus('done', symbol, since, limit, params);
1525
1544
  }
1526
1545
  async fetchOrder(id = undefined, symbol = undefined, params = {}) {
@@ -1879,15 +1898,23 @@ class kucoinfutures extends kucoinfutures$1 {
1879
1898
  /**
1880
1899
  * @method
1881
1900
  * @name kucoinfutures#fetchMyTrades
1901
+ * @see https://docs.kucoin.com/futures/#get-fills
1882
1902
  * @description fetch all trades made by the user
1883
1903
  * @param {string} symbol unified market symbol
1884
1904
  * @param {int} [since] the earliest time in ms to fetch trades for
1885
1905
  * @param {int} [limit] the maximum number of trades structures to retrieve
1886
1906
  * @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
1907
+ * @param {int} [params.until] End time in ms
1908
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1887
1909
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
1888
1910
  */
1889
1911
  await this.loadMarkets();
1890
- const request = {
1912
+ let paginate = false;
1913
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
1914
+ if (paginate) {
1915
+ return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
1916
+ }
1917
+ let request = {
1891
1918
  // orderId (String) [optional] Fills for a specific order (other parameters can be ignored if specified)
1892
1919
  // symbol (String) [optional] Symbol of the contract
1893
1920
  // side (String) [optional] buy or sell
@@ -1903,6 +1930,7 @@ class kucoinfutures extends kucoinfutures$1 {
1903
1930
  if (since !== undefined) {
1904
1931
  request['startAt'] = since;
1905
1932
  }
1933
+ [request, params] = this.handleUntilOption('endAt', request, params);
1906
1934
  const response = await this.futuresPrivateGetFills(this.extend(request, params));
1907
1935
  //
1908
1936
  // {
@@ -2303,12 +2331,18 @@ class kucoinfutures extends kucoinfutures$1 {
2303
2331
  * @param {int} [since] not used by kucuoinfutures
2304
2332
  * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
2305
2333
  * @param {object} [params] extra parameters specific to the okx api endpoint
2334
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
2306
2335
  * @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
2307
2336
  */
2308
2337
  if (symbol === undefined) {
2309
2338
  throw new errors.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
2310
2339
  }
2311
2340
  await this.loadMarkets();
2341
+ let paginate = false;
2342
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
2343
+ if (paginate) {
2344
+ return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params);
2345
+ }
2312
2346
  const market = this.market(symbol);
2313
2347
  const request = {
2314
2348
  'symbol': market['id'],