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/kucoin.js CHANGED
@@ -1561,9 +1561,15 @@ export default class kucoin extends Exchange {
1561
1561
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
1562
1562
  * @param {int} [limit] the maximum amount of candles to fetch
1563
1563
  * @param {object} [params] extra parameters specific to the kucoin api endpoint
1564
+ * @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
1565
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
1565
1566
  */
1566
1567
  await this.loadMarkets();
1568
+ let paginate = false;
1569
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
1570
+ if (paginate) {
1571
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1500);
1572
+ }
1567
1573
  const market = this.market(symbol);
1568
1574
  const marketId = market['id'];
1569
1575
  const request = {
@@ -2219,8 +2225,15 @@ export default class kucoin extends Exchange {
2219
2225
  * @param {string} [params.tradeType] TRADE for spot trading, MARGIN_TRADE for Margin Trading
2220
2226
  * @param {bool} [params.stop] True if fetching a stop order
2221
2227
  * @param {bool} [params.hf] false, // true for hf order
2228
+ * @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)
2222
2229
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2223
2230
  */
2231
+ await this.loadMarkets;
2232
+ let paginate = false;
2233
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
2234
+ if (paginate) {
2235
+ return await this.fetchPaginatedCallDynamic('fetchClosedOrders', symbol, since, limit, params);
2236
+ }
2224
2237
  return await this.fetchOrdersByStatus('done', symbol, since, limit, params);
2225
2238
  }
2226
2239
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -2245,8 +2258,15 @@ export default class kucoin extends Exchange {
2245
2258
  * @param {string} [params.orderIds] *stop orders only* comma seperated order ID list
2246
2259
  * @param {bool} [params.stop] True if fetching a stop order
2247
2260
  * @param {bool} [params.hf] false, // true for hf order
2261
+ * @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)
2248
2262
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2249
2263
  */
2264
+ await this.loadMarkets;
2265
+ let paginate = false;
2266
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'paginate');
2267
+ if (paginate) {
2268
+ return await this.fetchPaginatedCallDynamic('fetchOpenOrders', symbol, since, limit, params);
2269
+ }
2250
2270
  return await this.fetchOrdersByStatus('active', symbol, since, limit, params);
2251
2271
  }
2252
2272
  async fetchOrder(id, symbol = undefined, params = {}) {
@@ -2533,11 +2553,18 @@ export default class kucoin extends Exchange {
2533
2553
  * @param {int} [since] the earliest time in ms to fetch trades for
2534
2554
  * @param {int} [limit] the maximum number of trades structures to retrieve
2535
2555
  * @param {object} [params] extra parameters specific to the kucoin api endpoint
2556
+ * @param {int} [params.until] the latest time in ms to fetch entries for
2536
2557
  * @param {bool} [params.hf] false, // true for hf order
2558
+ * @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)
2537
2559
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
2538
2560
  */
2539
2561
  await this.loadMarkets();
2540
- const request = {};
2562
+ let paginate = false;
2563
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
2564
+ if (paginate) {
2565
+ return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
2566
+ }
2567
+ let request = {};
2541
2568
  const hf = this.safeValue(params, 'hf', false);
2542
2569
  if (hf && symbol === undefined) {
2543
2570
  throw new ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol parameter for hf orders');
@@ -2579,6 +2606,7 @@ export default class kucoin extends Exchange {
2579
2606
  else {
2580
2607
  throw new ExchangeError(this.id + ' fetchMyTradesMethod() invalid method');
2581
2608
  }
2609
+ [request, params] = this.handleUntilOption('endAt', request, params);
2582
2610
  const response = await this[method](this.extend(request, params));
2583
2611
  //
2584
2612
  // {
@@ -3020,6 +3048,8 @@ export default class kucoin extends Exchange {
3020
3048
  /**
3021
3049
  * @method
3022
3050
  * @name kucoin#fetchDeposits
3051
+ * @see https://docs.kucoin.com/#get-deposit-list
3052
+ * @see https://docs.kucoin.com/#get-v1-historical-deposits-list
3023
3053
  * @description fetch all deposits made to an account
3024
3054
  * @see https://docs.kucoin.com/#get-deposit-list
3025
3055
  * @see https://docs.kucoin.com/#get-v1-historical-deposits-list
@@ -3027,10 +3057,17 @@ export default class kucoin extends Exchange {
3027
3057
  * @param {int} [since] the earliest time in ms to fetch deposits for
3028
3058
  * @param {int} [limit] the maximum number of deposits structures to retrieve
3029
3059
  * @param {object} [params] extra parameters specific to the kucoin api endpoint
3060
+ * @param {int} [params.until] the latest time in ms to fetch entries for
3061
+ * @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)
3030
3062
  * @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
3031
3063
  */
3032
3064
  await this.loadMarkets();
3033
- const request = {};
3065
+ let paginate = false;
3066
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
3067
+ if (paginate) {
3068
+ return await this.fetchPaginatedCallDynamic('fetchDeposits', code, since, limit, params);
3069
+ }
3070
+ let request = {};
3034
3071
  let currency = undefined;
3035
3072
  if (code !== undefined) {
3036
3073
  currency = this.currency(code);
@@ -3050,6 +3087,7 @@ export default class kucoin extends Exchange {
3050
3087
  request['startAt'] = since;
3051
3088
  }
3052
3089
  }
3090
+ [request, params] = this.handleUntilOption('endAt', request, params);
3053
3091
  const response = await this[method](this.extend(request, params));
3054
3092
  //
3055
3093
  // {
@@ -3103,10 +3141,17 @@ export default class kucoin extends Exchange {
3103
3141
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
3104
3142
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
3105
3143
  * @param {object} [params] extra parameters specific to the kucoin api endpoint
3144
+ * @param {int} [params.until] the latest time in ms to fetch entries for
3145
+ * @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)
3106
3146
  * @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
3107
3147
  */
3108
3148
  await this.loadMarkets();
3109
- const request = {};
3149
+ let paginate = false;
3150
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
3151
+ if (paginate) {
3152
+ return await this.fetchPaginatedCallDynamic('fetchWithdrawals', code, since, limit, params);
3153
+ }
3154
+ let request = {};
3110
3155
  let currency = undefined;
3111
3156
  if (code !== undefined) {
3112
3157
  currency = this.currency(code);
@@ -3126,6 +3171,7 @@ export default class kucoin extends Exchange {
3126
3171
  request['startAt'] = since;
3127
3172
  }
3128
3173
  }
3174
+ [request, params] = this.handleUntilOption('endAt', request, params);
3129
3175
  const response = await this[method](this.extend(request, params));
3130
3176
  //
3131
3177
  // {
@@ -3612,17 +3658,25 @@ export default class kucoin extends Exchange {
3612
3658
  /**
3613
3659
  * @method
3614
3660
  * @name kucoin#fetchLedger
3661
+ * @see https://docs.kucoin.com/#get-account-ledgers
3615
3662
  * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
3616
3663
  * @see https://docs.kucoin.com/#get-account-ledgers
3617
3664
  * @param {string} code unified currency code, default is undefined
3618
3665
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
3619
3666
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
3620
3667
  * @param {object} [params] extra parameters specific to the kucoin api endpoint
3668
+ * @param {int} [params.until] the latest time in ms to fetch entries for
3669
+ * @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)
3621
3670
  * @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
3622
3671
  */
3623
3672
  await this.loadMarkets();
3624
3673
  await this.loadAccounts();
3625
- const request = {
3674
+ let paginate = false;
3675
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
3676
+ if (paginate) {
3677
+ return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
3678
+ }
3679
+ let request = {
3626
3680
  // 'currency': currency['id'], // can choose up to 10, if not provided returns for all currencies by default
3627
3681
  // 'direction': 'in', // 'out'
3628
3682
  // 'bizType': 'DEPOSIT', // DEPOSIT, WITHDRAW, TRANSFER, SUB_TRANSFER,TRADE_EXCHANGE, MARGIN_EXCHANGE, KUCOIN_BONUS (optional)
@@ -3638,6 +3692,7 @@ export default class kucoin extends Exchange {
3638
3692
  currency = this.currency(code);
3639
3693
  request['currency'] = currency['id'];
3640
3694
  }
3695
+ [request, params] = this.handleUntilOption('endAt', request, params);
3641
3696
  const response = await this.privateGetAccountsLedgers(this.extend(request, params));
3642
3697
  //
3643
3698
  // {
@@ -11,7 +11,7 @@ export default class kucoinfutures extends kucoin {
11
11
  }>;
12
12
  fetchMarkets(params?: {}): Promise<any[]>;
13
13
  fetchTime(params?: {}): Promise<number>;
14
- fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").OHLCV[]>;
14
+ fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
15
15
  parseOHLCV(ohlcv: any, market?: any): number[];
16
16
  fetchDepositAddress(code: string, params?: {}): Promise<{
17
17
  info: any;
@@ -65,8 +65,8 @@ export default class kucoinfutures extends kucoin {
65
65
  symbol: any;
66
66
  status: any;
67
67
  };
68
- fetchOrdersByStatus(status: any, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
69
- fetchClosedOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
68
+ fetchOrdersByStatus(status: any, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
69
+ fetchClosedOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
70
70
  fetchOrder(id?: any, symbol?: string, params?: {}): Promise<import("./base/types.js").Order>;
71
71
  parseOrder(order: any, market?: any): import("./base/types.js").Order;
72
72
  fetchFundingRate(symbol: string, params?: {}): Promise<{
@@ -103,7 +103,7 @@ export default class kucoinfutures extends kucoin {
103
103
  info: any;
104
104
  };
105
105
  parseTransferStatus(status: any): string;
106
- fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
106
+ fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
107
107
  fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
108
108
  parseTrade(trade: any, market?: any): import("./base/types.js").Trade;
109
109
  fetchDeposits(code?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
@@ -540,9 +540,15 @@ export default class kucoinfutures extends kucoin {
540
540
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
541
541
  * @param {int} [limit] the maximum amount of candles to fetch
542
542
  * @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
543
+ * @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)
543
544
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
544
545
  */
545
546
  await this.loadMarkets();
547
+ let paginate = false;
548
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
549
+ if (paginate) {
550
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 200);
551
+ }
546
552
  const market = this.market(symbol);
547
553
  const marketId = market['id'];
548
554
  const parsedTimeframe = this.safeInteger(this.timeframes, timeframe);
@@ -1422,9 +1428,15 @@ export default class kucoinfutures extends kucoin {
1422
1428
  * @param {int} [params.until] End time in ms
1423
1429
  * @param {string} [params.side] buy or sell
1424
1430
  * @param {string} [params.type] limit or market
1431
+ * @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)
1425
1432
  * @returns An [array of order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1426
1433
  */
1427
1434
  await this.loadMarkets();
1435
+ let paginate = false;
1436
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOrdersByStatus', 'paginate');
1437
+ if (paginate) {
1438
+ return await this.fetchPaginatedCallDynamic('fetchOrdersByStatus', symbol, since, limit, params);
1439
+ }
1428
1440
  const stop = this.safeValue(params, 'stop');
1429
1441
  const until = this.safeInteger2(params, 'until', 'till');
1430
1442
  params = this.omit(params, ['stop', 'until', 'till']);
@@ -1522,8 +1534,15 @@ export default class kucoinfutures extends kucoin {
1522
1534
  * @param {int} [params.till] end time in ms
1523
1535
  * @param {string} [params.side] buy or sell
1524
1536
  * @param {string} [params.type] limit, or market
1537
+ * @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)
1525
1538
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1526
1539
  */
1540
+ await this.loadMarkets;
1541
+ let paginate = false;
1542
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
1543
+ if (paginate) {
1544
+ return await this.fetchPaginatedCallDynamic('fetchClosedOrders', symbol, since, limit, params);
1545
+ }
1527
1546
  return await this.fetchOrdersByStatus('done', symbol, since, limit, params);
1528
1547
  }
1529
1548
  async fetchOrder(id = undefined, symbol = undefined, params = {}) {
@@ -1882,15 +1901,23 @@ export default class kucoinfutures extends kucoin {
1882
1901
  /**
1883
1902
  * @method
1884
1903
  * @name kucoinfutures#fetchMyTrades
1904
+ * @see https://docs.kucoin.com/futures/#get-fills
1885
1905
  * @description fetch all trades made by the user
1886
1906
  * @param {string} symbol unified market symbol
1887
1907
  * @param {int} [since] the earliest time in ms to fetch trades for
1888
1908
  * @param {int} [limit] the maximum number of trades structures to retrieve
1889
1909
  * @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
1910
+ * @param {int} [params.until] End time in ms
1911
+ * @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)
1890
1912
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
1891
1913
  */
1892
1914
  await this.loadMarkets();
1893
- const request = {
1915
+ let paginate = false;
1916
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
1917
+ if (paginate) {
1918
+ return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
1919
+ }
1920
+ let request = {
1894
1921
  // orderId (String) [optional] Fills for a specific order (other parameters can be ignored if specified)
1895
1922
  // symbol (String) [optional] Symbol of the contract
1896
1923
  // side (String) [optional] buy or sell
@@ -1906,6 +1933,7 @@ export default class kucoinfutures extends kucoin {
1906
1933
  if (since !== undefined) {
1907
1934
  request['startAt'] = since;
1908
1935
  }
1936
+ [request, params] = this.handleUntilOption('endAt', request, params);
1909
1937
  const response = await this.futuresPrivateGetFills(this.extend(request, params));
1910
1938
  //
1911
1939
  // {
@@ -2306,12 +2334,18 @@ export default class kucoinfutures extends kucoin {
2306
2334
  * @param {int} [since] not used by kucuoinfutures
2307
2335
  * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
2308
2336
  * @param {object} [params] extra parameters specific to the okx api endpoint
2337
+ * @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)
2309
2338
  * @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
2310
2339
  */
2311
2340
  if (symbol === undefined) {
2312
2341
  throw new ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
2313
2342
  }
2314
2343
  await this.loadMarkets();
2344
+ let paginate = false;
2345
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
2346
+ if (paginate) {
2347
+ return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params);
2348
+ }
2315
2349
  const market = this.market(symbol);
2316
2350
  const request = {
2317
2351
  'symbol': market['id'],
package/js/src/kuna.d.ts CHANGED
@@ -3,6 +3,7 @@ import { Int, OrderSide, OrderType } from './base/types.js';
3
3
  /**
4
4
  * @class kuna
5
5
  * @extends Exchange
6
+ * @description Use the public-key as your apiKey
6
7
  */
7
8
  export default class kuna extends Exchange {
8
9
  describe(): any;
package/js/src/kuna.js CHANGED
@@ -9,10 +9,12 @@ import Exchange from './abstract/kuna.js';
9
9
  import { ArgumentsRequired, InsufficientFunds, OrderNotFound, NotSupported } from './base/errors.js';
10
10
  import { TICK_SIZE } from './base/functions/number.js';
11
11
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
12
+ import { sha384 } from './static_dependencies/noble-hashes/sha512.js';
12
13
  // ---------------------------------------------------------------------------
13
14
  /**
14
15
  * @class kuna
15
16
  * @extends Exchange
17
+ * @description Use the public-key as your apiKey
16
18
  */
17
19
  export default class kuna extends Exchange {
18
20
  describe() {
@@ -70,6 +72,7 @@ export default class kuna extends Exchange {
70
72
  'api': {
71
73
  'xreserve': 'https://api.xreserve.fund',
72
74
  'v3': 'https://api.kuna.io',
75
+ 'v4': 'https://api.kuna.io',
73
76
  'public': 'https://kuna.io',
74
77
  'private': 'https://kuna.io', // v2
75
78
  },
@@ -88,6 +91,54 @@ export default class kuna extends Exchange {
88
91
  'delegate-transfer': 1,
89
92
  },
90
93
  },
94
+ 'v4': {
95
+ 'private': {
96
+ 'get': {
97
+ 'me': 1,
98
+ 'getBalance': 1,
99
+ 'active': 1,
100
+ 'order/history': 1,
101
+ 'order/private/{id}/trades': 1,
102
+ 'order/details/{id}?withTrades={withTrades}': 1,
103
+ 'trade/history': 1,
104
+ 'transaction/{hash}': 1,
105
+ 'deposit/preRequest': 1,
106
+ 'deposit/crypto/address': 1,
107
+ 'deposit/crypto/getMerchantAddress': 1,
108
+ 'deposit/history': 1,
109
+ 'deposit/details/{depositId}': 1,
110
+ 'withdraw/preRequest': 1,
111
+ 'withdraw/history': 1,
112
+ 'withdraw/details/{withdrawId}': 1,
113
+ 'kuna-code/{id}': 1,
114
+ 'kuna-code/{code}/check': 1,
115
+ 'kuna-code/issued-by-me': 1,
116
+ 'kuna-code/redeemed-by-me': 1,
117
+ },
118
+ 'post': {
119
+ 'order/create': 1,
120
+ 'order/cancel': 1,
121
+ 'order/cancel/multi': 1,
122
+ 'deposit/crypto/generateAddress': 1,
123
+ 'deposit/crypto/generateMerchantAddress': 1,
124
+ 'withdraw/create': 1,
125
+ 'kuna-code': 1,
126
+ },
127
+ 'put': {
128
+ 'kuna-code/redeem': 1,
129
+ },
130
+ },
131
+ 'public': {
132
+ 'get': {
133
+ 'timestamp': 1,
134
+ 'fees': 1,
135
+ 'currencies?type={type}': 1,
136
+ 'markets/getAll': 1,
137
+ 'markets/tickers?pairs={pairs}': 1,
138
+ 'order/book/{pairs}': 1,
139
+ },
140
+ },
141
+ },
91
142
  'v3': {
92
143
  'public': {
93
144
  'get': {
@@ -295,6 +346,9 @@ export default class kuna extends Exchange {
295
346
  '2002': InsufficientFunds,
296
347
  '2003': OrderNotFound,
297
348
  },
349
+ 'options': {
350
+ // 'account': 'pro' // Only for pro accounts
351
+ },
298
352
  });
299
353
  }
300
354
  async fetchTime(params = {}) {
@@ -851,20 +905,53 @@ export default class kuna extends Exchange {
851
905
  let url = undefined;
852
906
  if (Array.isArray(api)) {
853
907
  const [version, access] = api;
854
- url = this.urls['api'][version] + '/' + version + '/' + this.implodeParams(path, params);
855
- if (access === 'public') {
856
- if (method === 'GET') {
857
- if (Object.keys(params).length) {
858
- url += '?' + this.urlencode(params);
908
+ if (version === 'v3') {
909
+ url = this.urls['api'][version] + '/' + version + '/' + this.implodeParams(path, params);
910
+ if (access === 'public') {
911
+ if (method === 'GET') {
912
+ if (Object.keys(params).length) {
913
+ url += '?' + this.urlencode(params);
914
+ }
915
+ }
916
+ else if ((method === 'POST') || (method === 'PUT')) {
917
+ headers = { 'Content-Type': 'application/json' };
918
+ body = this.json(params);
859
919
  }
860
920
  }
861
- else if ((method === 'POST') || (method === 'PUT')) {
862
- headers = { 'Content-Type': 'application/json' };
863
- body = this.json(params);
921
+ else if (access === 'private') {
922
+ throw new NotSupported(this.id + ' private v3 API is not supported yet');
864
923
  }
865
924
  }
866
- else if (access === 'private') {
867
- throw new NotSupported(this.id + ' private v3 API is not supported yet');
925
+ else if (version === 'v4') {
926
+ const splitPath = path.split('/');
927
+ const splitPathLength = splitPath.length;
928
+ let urlPath = '';
929
+ if ((splitPathLength > 1) && (splitPath[0] !== 'kuna-code')) {
930
+ let pathTail = '';
931
+ for (let i = 1; i < splitPathLength; i++) {
932
+ pathTail += splitPath[i];
933
+ }
934
+ urlPath = '/' + version + '/' + splitPath[0] + '/' + access + '/' + this.implodeParams(pathTail, params);
935
+ }
936
+ else {
937
+ urlPath = '/' + version + '/' + access + '/' + this.implodeParams(path, params);
938
+ }
939
+ url = this.urls['api'][version] + urlPath;
940
+ if (access === 'private') {
941
+ const nonce = this.nonce();
942
+ const auth = urlPath + nonce + this.json(params);
943
+ headers = {
944
+ 'content-type': 'application/json',
945
+ 'accept': 'application/json',
946
+ 'nonce': nonce,
947
+ 'public-key': this.apiKey,
948
+ 'signature': this.hmac(this.encode(auth), this.encode(this.secret), sha384, 'hex'),
949
+ };
950
+ const account = this.safeString(this.options, 'account');
951
+ if (account === 'pro') {
952
+ headers['account'] = 'pro';
953
+ }
954
+ }
868
955
  }
869
956
  }
870
957
  else {
package/js/src/okx.d.ts CHANGED
@@ -76,9 +76,9 @@ export default class okx extends Exchange {
76
76
  fetchTickersByType(type: any, symbols?: string[], params?: {}): Promise<import("./base/types.js").Dictionary<import("./base/types.js").Ticker>>;
77
77
  fetchTickers(symbols?: string[], params?: {}): Promise<import("./base/types.js").Dictionary<import("./base/types.js").Ticker>>;
78
78
  parseTrade(trade: any, market?: any): import("./base/types.js").Trade;
79
- fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
79
+ fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
80
80
  parseOHLCV(ohlcv: any, market?: any): number[];
81
- fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").OHLCV[]>;
81
+ fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
82
82
  fetchFundingRateHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
83
83
  parseBalanceByType(type: any, response: any): import("./base/types.js").Balances;
84
84
  parseTradingBalance(response: any): import("./base/types.js").Balances;
@@ -106,11 +106,11 @@ export default class okx extends Exchange {
106
106
  parseOrderStatus(status: any): string;
107
107
  parseOrder(order: any, market?: any): import("./base/types.js").Order;
108
108
  fetchOrder(id: string, symbol?: string, params?: {}): Promise<import("./base/types.js").Order>;
109
- fetchOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
109
+ fetchOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
110
110
  fetchCanceledOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
111
- fetchClosedOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
112
- fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
113
- fetchOrderTrades(id: string, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
111
+ fetchClosedOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
112
+ fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
113
+ fetchOrderTrades(id: string, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
114
114
  fetchLedger(code?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
115
115
  parseLedgerEntryType(type: any): string;
116
116
  parseLedgerEntry(item: any, currency?: any): {