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/gate.js CHANGED
@@ -2827,10 +2827,16 @@ export default class gate extends Exchange {
2827
2827
  * @param {object} [params] extra parameters specific to the gateio api endpoint
2828
2828
  * @param {string} [params.price] "mark" or "index" for mark price and index price candles
2829
2829
  * @param {int} [params.until] timestamp in ms of the latest candle to fetch
2830
+ * @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)
2830
2831
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume (units in quote currency)
2831
2832
  */
2832
2833
  await this.loadMarkets();
2833
2834
  const market = this.market(symbol);
2835
+ let paginate = false;
2836
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
2837
+ if (paginate) {
2838
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000);
2839
+ }
2834
2840
  if (market['option']) {
2835
2841
  return await this.fetchOptionOHLCV(symbol, timeframe, since, limit, params);
2836
2842
  }
@@ -2996,9 +3002,16 @@ export default class gate extends Exchange {
2996
3002
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
2997
3003
  * @param {int} [limit] the maximum amount of trades to fetch
2998
3004
  * @param {object} [params] extra parameters specific to the gate api endpoint
3005
+ * @param {int} [params.until] timestamp in ms of the latest trade to fetch
3006
+ * @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)
2999
3007
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
3000
3008
  */
3001
3009
  await this.loadMarkets();
3010
+ let paginate = false;
3011
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
3012
+ if (paginate) {
3013
+ return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
3014
+ }
3002
3015
  const market = this.market(symbol);
3003
3016
  //
3004
3017
  // spot
@@ -3029,6 +3042,11 @@ export default class gate extends Exchange {
3029
3042
  'future': 'publicDeliveryGetSettleTrades',
3030
3043
  'option': 'publicOptionsGetTrades',
3031
3044
  });
3045
+ const until = this.safeInteger2(params, 'to', 'until');
3046
+ if (until !== undefined) {
3047
+ params = this.omit(params, ['until']);
3048
+ request['to'] = this.parseToInt(until / 1000);
3049
+ }
3032
3050
  if (limit !== undefined) {
3033
3051
  request['limit'] = limit; // default 100, max 1000
3034
3052
  }
@@ -3136,9 +3154,15 @@ export default class gate extends Exchange {
3136
3154
  * @param {int} [params.offset] *contract only* list offset, starting from 0
3137
3155
  * @param {string} [params.last_id] *contract only* specify list staring point using the id of last record in previous list-query results
3138
3156
  * @param {int} [params.count_total] *contract only* whether to return total number matched, default to 0(no return)
3157
+ * @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)
3139
3158
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
3140
3159
  */
3141
3160
  await this.loadMarkets();
3161
+ let paginate = false;
3162
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
3163
+ if (paginate) {
3164
+ return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
3165
+ }
3142
3166
  let type = undefined;
3143
3167
  let marginMode = undefined;
3144
3168
  let request = {};
@@ -3397,11 +3421,18 @@ export default class gate extends Exchange {
3397
3421
  * @param {string} code unified currency code
3398
3422
  * @param {int} [since] the earliest time in ms to fetch deposits for
3399
3423
  * @param {int} [limit] the maximum number of deposits structures to retrieve
3424
+ * @param {int} [params.until] end time in ms
3400
3425
  * @param {object} [params] extra parameters specific to the gate api endpoint
3426
+ * @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)
3401
3427
  * @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
3402
3428
  */
3403
3429
  await this.loadMarkets();
3404
- const request = {};
3430
+ let paginate = false;
3431
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
3432
+ if (paginate) {
3433
+ return await this.fetchPaginatedCallDynamic('fetchDeposits', code, since, limit, params);
3434
+ }
3435
+ let request = {};
3405
3436
  let currency = undefined;
3406
3437
  if (code !== undefined) {
3407
3438
  currency = this.currency(code);
@@ -3415,6 +3446,7 @@ export default class gate extends Exchange {
3415
3446
  request['from'] = start;
3416
3447
  request['to'] = this.sum(start, 30 * 24 * 60 * 60);
3417
3448
  }
3449
+ [request, params] = this.handleUntilOption('to', request, params);
3418
3450
  const response = await this.privateWalletGetDeposits(this.extend(request, params));
3419
3451
  return this.parseTransactions(response, currency);
3420
3452
  }
@@ -3427,10 +3459,17 @@ export default class gate extends Exchange {
3427
3459
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
3428
3460
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
3429
3461
  * @param {object} [params] extra parameters specific to the gate api endpoint
3462
+ * @param {int} [params.until] end time in ms
3463
+ * @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)
3430
3464
  * @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
3431
3465
  */
3432
3466
  await this.loadMarkets();
3433
- const request = {};
3467
+ let paginate = false;
3468
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
3469
+ if (paginate) {
3470
+ return await this.fetchPaginatedCallDynamic('fetchWithdrawals', code, since, limit, params);
3471
+ }
3472
+ let request = {};
3434
3473
  let currency = undefined;
3435
3474
  if (code !== undefined) {
3436
3475
  currency = this.currency(code);
@@ -3444,6 +3483,7 @@ export default class gate extends Exchange {
3444
3483
  request['from'] = start;
3445
3484
  request['to'] = this.sum(start, 30 * 24 * 60 * 60);
3446
3485
  }
3486
+ [request, params] = this.handleUntilOption('to', request, params);
3447
3487
  const response = await this.privateWalletGetWithdrawals(this.extend(request, params));
3448
3488
  return this.parseTransactions(response, currency);
3449
3489
  }
@@ -5732,6 +5772,11 @@ export default class gate extends Exchange {
5732
5772
  * @returns {object} an open interest structure{@link https://github.com/ccxt/ccxt/wiki/Manual#interest-history-structure}
5733
5773
  */
5734
5774
  await this.loadMarkets();
5775
+ let paginate = false;
5776
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOpenInterestHistory', 'paginate', false);
5777
+ if (paginate) {
5778
+ return await this.fetchPaginatedCallDeterministic('fetchOpenInterestHistory', symbol, since, limit, timeframe, params, 100);
5779
+ }
5735
5780
  const market = this.market(symbol);
5736
5781
  if (!market['swap']) {
5737
5782
  throw new BadRequest(this.id + ' fetchOpenInterest() supports swap markets only');
@@ -5990,13 +6035,20 @@ export default class gate extends Exchange {
5990
6035
  * @param {int} [since] timestamp in ms of the earliest ledger entry
5991
6036
  * @param {int} [limit] max number of ledger entries to return
5992
6037
  * @param {object} [params] extra parameters specific to the gate api endpoint
6038
+ * @param {int} [params.until] end time in ms
6039
+ * @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)
5993
6040
  * @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
5994
6041
  */
5995
6042
  await this.loadMarkets();
6043
+ let paginate = false;
6044
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
6045
+ if (paginate) {
6046
+ return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
6047
+ }
5996
6048
  let type = undefined;
5997
6049
  let currency = undefined;
5998
6050
  let response = undefined;
5999
- const request = {};
6051
+ let request = {};
6000
6052
  [type, params] = this.handleMarketTypeAndParams('fetchLedger', undefined, params);
6001
6053
  if ((type === 'spot') || (type === 'margin')) {
6002
6054
  if (code !== undefined) {
@@ -6016,6 +6068,7 @@ export default class gate extends Exchange {
6016
6068
  if (limit !== undefined) {
6017
6069
  request['limit'] = limit;
6018
6070
  }
6071
+ [request, params] = this.handleUntilOption('to', request, params);
6019
6072
  if (type === 'spot') {
6020
6073
  response = await this.privateSpotGetAccountBook(this.extend(request, params));
6021
6074
  }
package/js/src/huobi.d.ts CHANGED
@@ -55,10 +55,10 @@ export default class huobi extends Exchange {
55
55
  parseTrade(trade: any, market?: any): import("./base/types.js").Trade;
56
56
  fetchOrderTrades(id: string, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
57
57
  fetchSpotOrderTrades(id: string, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
58
- fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
58
+ fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
59
59
  fetchTrades(symbol: string, since?: Int, limit?: number, params?: {}): Promise<any>;
60
60
  parseOHLCV(ohlcv: any, market?: any): number[];
61
- fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").OHLCV[]>;
61
+ fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
62
62
  fetchAccounts(params?: {}): Promise<any[]>;
63
63
  parseAccount(account: any): {
64
64
  info: any;
package/js/src/huobi.js CHANGED
@@ -2359,21 +2359,31 @@ export default class huobi extends Exchange {
2359
2359
  /**
2360
2360
  * @method
2361
2361
  * @name huobi#fetchMyTrades
2362
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-history-match-results-via-multiple-fields-new
2363
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-history-match-results-via-multiple-fields-new
2364
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#search-match-results
2362
2365
  * @description fetch all trades made by the user
2363
2366
  * @param {string} symbol unified market symbol
2364
2367
  * @param {int} [since] the earliest time in ms to fetch trades for
2365
2368
  * @param {int} [limit] the maximum number of trades structures to retrieve
2366
2369
  * @param {object} [params] extra parameters specific to the huobi api endpoint
2370
+ * @param {int} [params.until] the latest time in ms to fetch trades for
2371
+ * @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)
2367
2372
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
2368
2373
  */
2369
2374
  await this.loadMarkets();
2375
+ let paginate = false;
2376
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
2377
+ if (paginate) {
2378
+ return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
2379
+ }
2370
2380
  let market = undefined;
2371
2381
  if (symbol !== undefined) {
2372
2382
  market = this.market(symbol);
2373
2383
  }
2374
2384
  let marketType = undefined;
2375
2385
  [marketType, params] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
2376
- const request = {
2386
+ let request = {
2377
2387
  // spot -----------------------------------------------------------
2378
2388
  // 'symbol': market['id'],
2379
2389
  // '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',
@@ -2405,6 +2415,7 @@ export default class huobi extends Exchange {
2405
2415
  request['start-time'] = since; // a date within 120 days from today
2406
2416
  // request['end-time'] = this.sum (since, 172800000); // 48 hours window
2407
2417
  }
2418
+ [request, params] = this.handleUntilOption('end-time', request, params);
2408
2419
  method = 'spotPrivateGetV1OrderMatchresults';
2409
2420
  }
2410
2421
  else {
@@ -2415,6 +2426,7 @@ export default class huobi extends Exchange {
2415
2426
  request['start_time'] = since; // a date within 120 days from today
2416
2427
  // request['end_time'] = this.sum (request['start_time'], 172800000); // 48 hours window
2417
2428
  }
2429
+ [request, params] = this.handleUntilOption('end_time', request, params);
2418
2430
  if (limit !== undefined) {
2419
2431
  request['page_size'] = limit; // default 100, max 500
2420
2432
  }
@@ -2519,6 +2531,10 @@ export default class huobi extends Exchange {
2519
2531
  /**
2520
2532
  * @method
2521
2533
  * @name huobi#fetchTrades
2534
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-the-most-recent-trades
2535
+ * @see https://huobiapi.github.io/docs/dm/v1/en/#query-a-batch-of-trade-records-of-a-contract
2536
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-a-batch-of-trade-records-of-a-contract
2537
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-a-batch-of-trade-records-of-a-contract
2522
2538
  * @description get the list of most recent trades for a particular symbol
2523
2539
  * @param {string} symbol unified symbol of the market to fetch trades for
2524
2540
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
@@ -2629,9 +2645,15 @@ export default class huobi extends Exchange {
2629
2645
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
2630
2646
  * @param {int} [limit] the maximum amount of candles to fetch
2631
2647
  * @param {object} [params] extra parameters specific to the huobi api endpoint
2648
+ * @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)
2632
2649
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
2633
2650
  */
2634
2651
  await this.loadMarkets();
2652
+ let paginate = false;
2653
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
2654
+ if (paginate) {
2655
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000);
2656
+ }
2635
2657
  const market = this.market(symbol);
2636
2658
  const request = {
2637
2659
  'period': this.safeString(this.timeframes, timeframe, timeframe),
@@ -3544,7 +3566,7 @@ export default class huobi extends Exchange {
3544
3566
  }
3545
3567
  await this.loadMarkets();
3546
3568
  let market = undefined;
3547
- const request = {
3569
+ let request = {
3548
3570
  // spot_private_get_v1_order_orders GET /v1/order/orders ----------
3549
3571
  // 'symbol': market['id'], // required
3550
3572
  // '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',
@@ -3569,6 +3591,7 @@ export default class huobi extends Exchange {
3569
3591
  request['start-time'] = since; // a window of 48 hours within 180 days
3570
3592
  request['end-time'] = this.sum(since, 48 * 60 * 60 * 1000);
3571
3593
  }
3594
+ [request, params] = this.handleUntilOption('end-time', request, params);
3572
3595
  if (limit !== undefined) {
3573
3596
  request['size'] = limit;
3574
3597
  }
@@ -3612,7 +3635,7 @@ export default class huobi extends Exchange {
3612
3635
  this.checkRequiredSymbol('fetchContractOrders', symbol);
3613
3636
  await this.loadMarkets();
3614
3637
  const market = this.market(symbol);
3615
- const request = {
3638
+ let request = {
3616
3639
  // POST /api/v1/contract_hisorders inverse futures ----------------
3617
3640
  // 'symbol': market['settleId'], // BTC, ETH, ...
3618
3641
  // '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
@@ -3641,6 +3664,7 @@ export default class huobi extends Exchange {
3641
3664
  request['contract'] = market['id'];
3642
3665
  request['type'] = 1; // 1:All Orders,2:Order in Finished Status
3643
3666
  }
3667
+ [request, params] = this.handleUntilOption('end_time', request, params);
3644
3668
  if (market['linear']) {
3645
3669
  let marginMode = undefined;
3646
3670
  [marginMode, params] = this.handleMarginModeAndParams('fetchContractOrders', params);
@@ -3851,6 +3875,12 @@ export default class huobi extends Exchange {
3851
3875
  /**
3852
3876
  * @method
3853
3877
  * @name huobi#fetchOrders
3878
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#search-past-orders
3879
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#search-historical-orders-within-48-hours
3880
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-history-orders-new
3881
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-history-orders-new
3882
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-history-orders-new
3883
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-history-orders-via-multiple-fields-new
3854
3884
  * @description fetches information on multiple orders made by the user
3855
3885
  * @param {string} symbol unified market symbol of the market orders were made in
3856
3886
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -3858,6 +3888,7 @@ export default class huobi extends Exchange {
3858
3888
  * @param {object} [params] extra parameters specific to the huobi api endpoint
3859
3889
  * @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
3860
3890
  * @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
3891
+ * @param {int} [params.until] the latest time in ms to fetch entries for
3861
3892
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
3862
3893
  */
3863
3894
  await this.loadMarkets();
@@ -3884,14 +3915,27 @@ export default class huobi extends Exchange {
3884
3915
  /**
3885
3916
  * @method
3886
3917
  * @name huobi#fetchClosedOrders
3918
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#search-past-orders
3919
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#search-historical-orders-within-48-hours
3920
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-history-orders-new
3921
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-history-orders-new
3922
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-history-orders-new
3923
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-history-orders-via-multiple-fields-new
3887
3924
  * @description fetches information on multiple closed orders made by the user
3888
3925
  * @param {string} symbol unified market symbol of the market orders were made in
3889
3926
  * @param {int} [since] the earliest time in ms to fetch orders for
3890
3927
  * @param {int} [limit] the maximum number of orde structures to retrieve
3891
3928
  * @param {object} [params] extra parameters specific to the huobi api endpoint
3929
+ * @param {int} [params.until] the latest time in ms to fetch entries for
3930
+ * @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)
3892
3931
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
3893
3932
  */
3894
3933
  await this.loadMarkets();
3934
+ let paginate = false;
3935
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
3936
+ if (paginate) {
3937
+ return await this.fetchPaginatedCallDynamic('fetchClosedOrders', symbol, since, limit, params, 100);
3938
+ }
3895
3939
  let market = undefined;
3896
3940
  if (symbol !== undefined) {
3897
3941
  market = this.market(symbol);
@@ -3911,6 +3955,9 @@ export default class huobi extends Exchange {
3911
3955
  /**
3912
3956
  * @method
3913
3957
  * @name huobi#fetchOpenOrders
3958
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-open-orders
3959
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-current-unfilled-order-acquisition
3960
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-current-unfilled-order-acquisition
3914
3961
  * @description fetch all unfilled currently open orders
3915
3962
  * @param {string} symbol unified market symbol
3916
3963
  * @param {int} [since] the earliest time in ms to fetch open orders for
@@ -6021,6 +6068,8 @@ export default class huobi extends Exchange {
6021
6068
  /**
6022
6069
  * @method
6023
6070
  * @name huobi#fetchFundingRateHistory
6071
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-historical-funding-rate
6072
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-historical-funding-rate
6024
6073
  * @description fetches historical funding rate prices
6025
6074
  * @param {string} symbol unified symbol of the market to fetch the funding rate history for
6026
6075
  * @param {int} [since] not used by huobi, but filtered internally by ccxt
@@ -6029,6 +6078,11 @@ export default class huobi extends Exchange {
6029
6078
  * @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
6030
6079
  */
6031
6080
  this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
6081
+ let paginate = false;
6082
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
6083
+ if (paginate) {
6084
+ return await this.fetchPaginatedCallCursor('fetchFundingRateHistory', symbol, since, limit, params, 'page_index', 'current_page', 1, 50);
6085
+ }
6032
6086
  await this.loadMarkets();
6033
6087
  const market = this.market(symbol);
6034
6088
  const request = {
@@ -6068,10 +6122,12 @@ export default class huobi extends Exchange {
6068
6122
  // }
6069
6123
  //
6070
6124
  const data = this.safeValue(response, 'data');
6125
+ const cursor = this.safeValue(data, 'current_page');
6071
6126
  const result = this.safeValue(data, 'data', []);
6072
6127
  const rates = [];
6073
6128
  for (let i = 0; i < result.length; i++) {
6074
6129
  const entry = result[i];
6130
+ entry['current_page'] = cursor;
6075
6131
  const marketId = this.safeString(entry, 'contract_code');
6076
6132
  const symbolInner = this.safeSymbol(marketId);
6077
6133
  const timestamp = this.safeInteger(entry, 'funding_time');
@@ -7232,16 +7288,24 @@ export default class huobi extends Exchange {
7232
7288
  /**
7233
7289
  * @method
7234
7290
  * @name huobi#fetchLedger
7291
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-account-history
7235
7292
  * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
7236
7293
  * @param {string} code unified currency code, default is undefined
7237
7294
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
7238
7295
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
7239
7296
  * @param {object} [params] extra parameters specific to the huobi api endpoint
7297
+ * @param {int} [params.until] the latest time in ms to fetch entries for
7298
+ * @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)
7240
7299
  * @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
7241
7300
  */
7242
7301
  await this.loadMarkets();
7302
+ let paginate = false;
7303
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
7304
+ if (paginate) {
7305
+ return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params, 500);
7306
+ }
7243
7307
  const accountId = await this.fetchAccountIdByType('spot', undefined, undefined, params);
7244
- const request = {
7308
+ let request = {
7245
7309
  'accountId': accountId,
7246
7310
  // 'currency': code,
7247
7311
  // 'transactTypes': 'all', // default all
@@ -7262,6 +7326,7 @@ export default class huobi extends Exchange {
7262
7326
  if (limit !== undefined) {
7263
7327
  request['limit'] = limit; // max 500
7264
7328
  }
7329
+ [request, params] = this.handleUntilOption('endTime', request, params);
7265
7330
  const response = await this.spotPrivateGetV2AccountLedger(this.extend(request, params));
7266
7331
  //
7267
7332
  // {
@@ -33,7 +33,7 @@ export default class kraken extends Exchange {
33
33
  fetchTickers(symbols?: string[], params?: {}): Promise<any>;
34
34
  fetchTicker(symbol: string, params?: {}): Promise<import("./base/types.js").Ticker>;
35
35
  parseOHLCV(ohlcv: any, market?: any): number[];
36
- fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").OHLCV[]>;
36
+ fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
37
37
  parseLedgerEntryType(type: any): string;
38
38
  parseLedgerEntry(item: any, currency?: any): {
39
39
  info: any;
@@ -48,7 +48,7 @@ export default class kraken extends Exchange {
48
48
  before: any;
49
49
  after: number;
50
50
  status: string;
51
- timestamp: any;
51
+ timestamp: number;
52
52
  datetime: string;
53
53
  fee: {
54
54
  cost: number;
package/js/src/kraken.js CHANGED
@@ -863,9 +863,15 @@ export default class kraken extends Exchange {
863
863
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
864
864
  * @param {int} [limit] the maximum amount of candles to fetch
865
865
  * @param {object} [params] extra parameters specific to the kraken api endpoint
866
+ * @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
867
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
867
868
  */
868
869
  await this.loadMarkets();
870
+ let paginate = false;
871
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
872
+ if (paginate) {
873
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 720);
874
+ }
869
875
  const market = this.market(symbol);
870
876
  const parsedTimeframe = this.safeInteger(this.timeframes, timeframe);
871
877
  const request = {
@@ -939,11 +945,7 @@ export default class kraken extends Exchange {
939
945
  else {
940
946
  direction = 'in';
941
947
  }
942
- const time = this.safeNumber(item, 'time');
943
- let timestamp = undefined;
944
- if (time !== undefined) {
945
- timestamp = this.parseToInt(time * 1000);
946
- }
948
+ const timestamp = this.safeIntegerProduct(item, 'time', 1000);
947
949
  return {
948
950
  'info': item,
949
951
  'id': id,
@@ -969,17 +971,19 @@ export default class kraken extends Exchange {
969
971
  /**
970
972
  * @method
971
973
  * @name kraken#fetchLedger
974
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getLedgers
972
975
  * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
973
976
  * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getLedgers
974
977
  * @param {string} code unified currency code, default is undefined
975
978
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
976
979
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
977
980
  * @param {object} [params] extra parameters specific to the kraken api endpoint
981
+ * @param {int} [params.until] timestamp in ms of the latest ledger entry
978
982
  * @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
979
983
  */
980
984
  // https://www.kraken.com/features/api#get-ledgers-info
981
985
  await this.loadMarkets();
982
- const request = {};
986
+ let request = {};
983
987
  let currency = undefined;
984
988
  if (code !== undefined) {
985
989
  currency = this.currency(code);
@@ -988,6 +992,7 @@ export default class kraken extends Exchange {
988
992
  if (since !== undefined) {
989
993
  request['start'] = this.parseToInt(since / 1000);
990
994
  }
995
+ [request, params] = this.handleUntilOption('end', request, params);
991
996
  const response = await this.privatePostLedgers(this.extend(request, params));
992
997
  // { error: [],
993
998
  // result: { ledger: { 'LPUAIB-TS774-UKHP7X': { refid: "A2B4HBV-L4MDIE-JU4N3N",
@@ -1466,7 +1471,7 @@ export default class kraken extends Exchange {
1466
1471
  id = this.safeString(txid, 0);
1467
1472
  }
1468
1473
  const clientOrderId = this.safeString(order, 'userref');
1469
- const rawTrades = this.safeValue(order, 'trades');
1474
+ const rawTrades = this.safeValue(order, 'trades', []);
1470
1475
  const trades = [];
1471
1476
  for (let i = 0; i < rawTrades.length; i++) {
1472
1477
  const rawTrade = rawTrades[i];
@@ -1934,6 +1939,7 @@ export default class kraken extends Exchange {
1934
1939
  /**
1935
1940
  * @method
1936
1941
  * @name kraken#fetchOpenOrders
1942
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenOrders
1937
1943
  * @description fetch all unfilled currently open orders
1938
1944
  * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenOrders
1939
1945
  * @param {string} symbol unified market symbol
@@ -1966,16 +1972,18 @@ export default class kraken extends Exchange {
1966
1972
  /**
1967
1973
  * @method
1968
1974
  * @name kraken#fetchClosedOrders
1975
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
1969
1976
  * @description fetches information on multiple closed orders made by the user
1970
1977
  * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
1971
1978
  * @param {string} symbol unified market symbol of the market orders were made in
1972
1979
  * @param {int} [since] the earliest time in ms to fetch orders for
1973
1980
  * @param {int} [limit] the maximum number of orde structures to retrieve
1974
1981
  * @param {object} [params] extra parameters specific to the kraken api endpoint
1982
+ * @param {int} [params.until] timestamp in ms of the latest entry
1975
1983
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1976
1984
  */
1977
1985
  await this.loadMarkets();
1978
- const request = {};
1986
+ let request = {};
1979
1987
  if (since !== undefined) {
1980
1988
  request['start'] = this.parseToInt(since / 1000);
1981
1989
  }
@@ -1985,6 +1993,7 @@ export default class kraken extends Exchange {
1985
1993
  request['userref'] = clientOrderId;
1986
1994
  query = this.omit(params, ['userref', 'clientOrderId']);
1987
1995
  }
1996
+ [request, params] = this.handleUntilOption('end', request, params);
1988
1997
  const response = await this.privatePostClosedOrders(this.extend(request, query));
1989
1998
  //
1990
1999
  // {
@@ -2164,6 +2173,7 @@ export default class kraken extends Exchange {
2164
2173
  /**
2165
2174
  * @method
2166
2175
  * @name kraken#fetchDeposits
2176
+ * @see https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentDeposits
2167
2177
  * @description fetch all deposits made to an account
2168
2178
  * @see https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentDeposits
2169
2179
  * @param {string} code unified currency code
@@ -10,9 +10,9 @@ export default class krakenfutures extends Exchange {
10
10
  fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<import("./base/types.js").OrderBook>;
11
11
  fetchTickers(symbols?: string[], params?: {}): Promise<import("./base/types.js").Dictionary<import("./base/types.js").Ticker>>;
12
12
  parseTicker(ticker: any, market?: any): import("./base/types.js").Ticker;
13
- fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").OHLCV[]>;
13
+ fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
14
14
  parseOHLCV(ohlcv: any, market?: any): number[];
15
- fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
15
+ fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
16
16
  parseTrade(trade: any, market?: any): import("./base/types.js").Trade;
17
17
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<import("./base/types.js").Order>;
18
18
  editOrder(id: string, symbol: any, type: any, side: any, amount?: any, price?: any, params?: {}): Promise<any>;
@@ -564,8 +564,26 @@ export default class krakenfutures extends Exchange {
564
564
  });
565
565
  }
566
566
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
567
+ /**
568
+ * @method
569
+ * @name kraken#fetchOHLCV
570
+ * @see https://docs.futures.kraken.com/#http-api-charts-candles
571
+ * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
572
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
573
+ * @param {string} timeframe the length of time each candle represents
574
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
575
+ * @param {int} [limit] the maximum amount of candles to fetch
576
+ * @param {object} [params] extra parameters specific to the kraken api endpoint
577
+ * @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)
578
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
579
+ */
567
580
  await this.loadMarkets();
568
581
  const market = this.market(symbol);
582
+ let paginate = false;
583
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
584
+ if (paginate) {
585
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 5000);
586
+ }
569
587
  const request = {
570
588
  'symbol': market['id'],
571
589
  'price_type': this.safeString(params, 'price', 'trade'),
@@ -642,9 +660,15 @@ export default class krakenfutures extends Exchange {
642
660
  * @param {int} [limit] Total number of trades, cannot exceed 100
643
661
  * @param {object} [params] Exchange specific params
644
662
  * @param {int} [params.until] Timestamp in ms of latest trade
663
+ * @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)
645
664
  * @returns An array of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
646
665
  */
647
666
  await this.loadMarkets();
667
+ let paginate = false;
668
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
669
+ if (paginate) {
670
+ return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
671
+ }
648
672
  const market = this.market(symbol);
649
673
  const request = {
650
674
  'symbol': market['id'],
@@ -52,7 +52,7 @@ export default class kucoin extends Exchange {
52
52
  fetchTickers(symbols?: string[], params?: {}): Promise<any>;
53
53
  fetchTicker(symbol: string, params?: {}): Promise<import("./base/types.js").Ticker>;
54
54
  parseOHLCV(ohlcv: any, market?: any): number[];
55
- fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").OHLCV[]>;
55
+ fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
56
56
  createDepositAddress(code: string, params?: {}): Promise<{
57
57
  info: any;
58
58
  currency: any;
@@ -82,12 +82,12 @@ export default class kucoin extends Exchange {
82
82
  cancelOrder(id: string, symbol?: string, params?: {}): Promise<any>;
83
83
  cancelAllOrders(symbol?: string, params?: {}): Promise<any>;
84
84
  fetchOrdersByStatus(status: any, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
85
- fetchClosedOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
86
- fetchOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
85
+ fetchClosedOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
86
+ fetchOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
87
87
  fetchOrder(id: string, symbol?: string, params?: {}): Promise<import("./base/types.js").Order>;
88
88
  parseOrder(order: any, market?: any): import("./base/types.js").Order;
89
- fetchOrderTrades(id: string, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
90
- fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
89
+ fetchOrderTrades(id: string, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
90
+ fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
91
91
  fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
92
92
  parseTrade(trade: any, market?: any): import("./base/types.js").Trade;
93
93
  fetchTradingFee(symbol: string, params?: {}): Promise<{