ccxt 4.3.19 → 4.3.21

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 (56) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/ccxt.js +1 -1
  3. package/dist/cjs/src/base/Exchange.js +3 -0
  4. package/dist/cjs/src/base/functions/platform.js +3 -1
  5. package/dist/cjs/src/base/functions.js +1 -0
  6. package/dist/cjs/src/binance.js +10 -1
  7. package/dist/cjs/src/bitget.js +3 -0
  8. package/dist/cjs/src/bitmex.js +1 -0
  9. package/dist/cjs/src/bybit.js +38 -9
  10. package/dist/cjs/src/coinex.js +180 -201
  11. package/dist/cjs/src/hyperliquid.js +24 -2
  12. package/dist/cjs/src/okx.js +3 -0
  13. package/dist/cjs/src/phemex.js +17 -6
  14. package/dist/cjs/src/pro/htx.js +12 -7
  15. package/dist/cjs/src/pro/kucoinfutures.js +92 -0
  16. package/dist/cjs/src/pro/woo.js +52 -24
  17. package/js/ccxt.d.ts +1 -1
  18. package/js/ccxt.js +1 -1
  19. package/js/src/abstract/binance.d.ts +1 -0
  20. package/js/src/abstract/binancecoinm.d.ts +1 -0
  21. package/js/src/abstract/binanceus.d.ts +1 -0
  22. package/js/src/abstract/binanceusdm.d.ts +1 -0
  23. package/js/src/abstract/bitget.d.ts +3 -0
  24. package/js/src/abstract/okx.d.ts +3 -0
  25. package/js/src/ascendex.d.ts +1 -1
  26. package/js/src/base/Exchange.d.ts +1 -1
  27. package/js/src/base/Exchange.js +3 -0
  28. package/js/src/base/functions/platform.d.ts +2 -1
  29. package/js/src/base/functions/platform.js +3 -2
  30. package/js/src/binance.d.ts +1 -1
  31. package/js/src/binance.js +10 -1
  32. package/js/src/bingx.d.ts +1 -1
  33. package/js/src/bitget.d.ts +1 -1
  34. package/js/src/bitget.js +3 -0
  35. package/js/src/bitmex.js +1 -0
  36. package/js/src/bybit.d.ts +1 -0
  37. package/js/src/bybit.js +38 -9
  38. package/js/src/coinex.d.ts +2 -2
  39. package/js/src/coinex.js +180 -201
  40. package/js/src/delta.d.ts +1 -1
  41. package/js/src/digifinex.d.ts +1 -1
  42. package/js/src/exmo.d.ts +1 -1
  43. package/js/src/gate.d.ts +1 -1
  44. package/js/src/hitbtc.d.ts +1 -1
  45. package/js/src/hyperliquid.d.ts +1 -1
  46. package/js/src/hyperliquid.js +24 -2
  47. package/js/src/okx.d.ts +1 -1
  48. package/js/src/okx.js +3 -0
  49. package/js/src/phemex.d.ts +1 -1
  50. package/js/src/phemex.js +17 -6
  51. package/js/src/pro/htx.js +12 -7
  52. package/js/src/pro/kucoinfutures.d.ts +3 -1
  53. package/js/src/pro/kucoinfutures.js +93 -1
  54. package/js/src/pro/woo.d.ts +2 -1
  55. package/js/src/pro/woo.js +52 -24
  56. package/package.json +1 -1
package/README.md CHANGED
@@ -215,13 +215,13 @@ console.log(version, Object.keys(exchanges));
215
215
 
216
216
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
217
217
 
218
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.19/dist/ccxt.browser.js
219
- * unpkg: https://unpkg.com/ccxt@4.3.19/dist/ccxt.browser.js
218
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.21/dist/ccxt.browser.js
219
+ * unpkg: https://unpkg.com/ccxt@4.3.21/dist/ccxt.browser.js
220
220
 
221
221
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
222
222
 
223
223
  ```HTML
224
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.19/dist/ccxt.browser.js"></script>
224
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.21/dist/ccxt.browser.js"></script>
225
225
  ```
226
226
 
227
227
  Creates a global `ccxt` object:
package/dist/cjs/ccxt.js CHANGED
@@ -184,7 +184,7 @@ var woofipro$1 = require('./src/pro/woofipro.js');
184
184
 
185
185
  //-----------------------------------------------------------------------------
186
186
  // this is updated by vss.js when building
187
- const version = '4.3.19';
187
+ const version = '4.3.21';
188
188
  Exchange["default"].ccxtVersion = version;
189
189
  const exchanges = {
190
190
  'ace': ace,
@@ -5948,6 +5948,9 @@ class Exchange {
5948
5948
  if (method === 'fetchAccounts') {
5949
5949
  response = await this[method](params);
5950
5950
  }
5951
+ else if (method === 'getLeverageTiersPaginated') {
5952
+ response = await this[method](symbol, params);
5953
+ }
5951
5954
  else {
5952
5955
  response = await this[method](symbol, since, maxEntriesPerRequest, params);
5953
5956
  }
@@ -19,9 +19,11 @@ const isElectron = typeof process !== 'undefined' &&
19
19
  typeof process.versions.electron !== 'undefined';
20
20
  const isWebWorker = typeof WorkerGlobalScope !== 'undefined' && (self instanceof WorkerGlobalScope);
21
21
  const isWindows = typeof process !== 'undefined' && process.platform === "win32";
22
- const isNode = !(isBrowser || isWebWorker);
22
+ const isDeno = typeof Deno !== 'undefined';
23
+ const isNode = !(isBrowser || isWebWorker || isDeno);
23
24
 
24
25
  exports.isBrowser = isBrowser;
26
+ exports.isDeno = isDeno;
25
27
  exports.isElectron = isElectron;
26
28
  exports.isNode = isNode;
27
29
  exports.isWebWorker = isWebWorker;
@@ -17,6 +17,7 @@ var misc = require('./functions/misc.js');
17
17
  /* ------------------------------------------------------------------------ */
18
18
 
19
19
  exports.isBrowser = platform.isBrowser;
20
+ exports.isDeno = platform.isDeno;
20
21
  exports.isElectron = platform.isElectron;
21
22
  exports.isNode = platform.isNode;
22
23
  exports.isWebWorker = platform.isWebWorker;
@@ -130,7 +130,7 @@ class binance extends binance$1 {
130
130
  'fetchPositions': true,
131
131
  'fetchPositionsHistory': false,
132
132
  'fetchPositionsRisk': true,
133
- 'fetchPremiumIndexOHLCV': false,
133
+ 'fetchPremiumIndexOHLCV': true,
134
134
  'fetchSettlementHistory': true,
135
135
  'fetchStatus': true,
136
136
  'fetchTicker': true,
@@ -779,6 +779,7 @@ class binance extends binance$1 {
779
779
  'continuousKlines': { 'cost': 1, 'byLimit': [[99, 1], [499, 2], [1000, 5], [10000, 10]] },
780
780
  'markPriceKlines': { 'cost': 1, 'byLimit': [[99, 1], [499, 2], [1000, 5], [10000, 10]] },
781
781
  'indexPriceKlines': { 'cost': 1, 'byLimit': [[99, 1], [499, 2], [1000, 5], [10000, 10]] },
782
+ 'premiumIndexKlines': { 'cost': 1, 'byLimit': [[99, 1], [499, 2], [1000, 5], [10000, 10]] },
782
783
  'fundingRate': 1,
783
784
  'fundingInfo': 1,
784
785
  'premiumIndex': 1,
@@ -4296,6 +4297,14 @@ class binance extends binance$1 {
4296
4297
  response = await this.fapiPublicGetIndexPriceKlines(this.extend(request, params));
4297
4298
  }
4298
4299
  }
4300
+ else if (price === 'premiumIndex') {
4301
+ if (market['inverse']) {
4302
+ response = await this.dapiPublicGetPremiumIndexKlines(this.extend(request, params));
4303
+ }
4304
+ else {
4305
+ response = await this.fapiPublicGetPremiumIndexKlines(this.extend(request, params));
4306
+ }
4307
+ }
4299
4308
  else if (market['linear']) {
4300
4309
  response = await this.fapiPublicGetKlines(this.extend(request, params));
4301
4310
  }
@@ -310,6 +310,9 @@ class bitget extends bitget$1 {
310
310
  'v2/spot/account/subaccount-assets': 2,
311
311
  'v2/spot/account/bills': 2,
312
312
  'v2/spot/account/transferRecords': 1,
313
+ 'v2/account/funding-assets': 2,
314
+ 'v2/account/bot-assets': 2,
315
+ 'v2/account/all-account-balance': 20,
313
316
  'v2/spot/wallet/deposit-address': 2,
314
317
  'v2/spot/wallet/deposit-records': 2,
315
318
  'v2/spot/wallet/withdrawal-records': 2,
@@ -241,6 +241,7 @@ class bitmex extends bitmex$1 {
241
241
  'orderQty is invalid': errors.InvalidOrder,
242
242
  'Invalid price': errors.InvalidOrder,
243
243
  'Invalid stopPx for ordType': errors.InvalidOrder,
244
+ 'Account is restricted': errors.PermissionDenied, // {"error":{"message":"Account is restricted","name":"HTTPError"}}
244
245
  },
245
246
  'broad': {
246
247
  'Signature not valid': errors.AuthenticationError,
@@ -8148,6 +8148,35 @@ class bybit extends bybit$1 {
8148
8148
  'datetime': this.iso8601(timestamp),
8149
8149
  });
8150
8150
  }
8151
+ async getLeverageTiersPaginated(symbol = undefined, params = {}) {
8152
+ await this.loadMarkets();
8153
+ let market = undefined;
8154
+ if (symbol !== undefined) {
8155
+ market = this.market(symbol);
8156
+ }
8157
+ let paginate = false;
8158
+ [paginate, params] = this.handleOptionAndParams(params, 'getLeverageTiersPaginated', 'paginate');
8159
+ if (paginate) {
8160
+ return await this.fetchPaginatedCallCursor('getLeverageTiersPaginated', symbol, undefined, undefined, params, 'nextPageCursor', 'cursor', undefined, 100);
8161
+ }
8162
+ let subType = undefined;
8163
+ [subType, params] = this.handleSubTypeAndParams('getLeverageTiersPaginated', market, params, 'linear');
8164
+ const request = {
8165
+ 'category': subType,
8166
+ };
8167
+ const response = await this.publicGetV5MarketRiskLimit(this.extend(request, params));
8168
+ const result = this.addPaginationCursorToResult(response);
8169
+ const first = this.safeDict(result, 0);
8170
+ const total = result.length;
8171
+ const lastIndex = total - 1;
8172
+ const last = this.safeDict(result, lastIndex);
8173
+ const cursorValue = this.safeString(first, 'nextPageCursor');
8174
+ last['info'] = {
8175
+ 'nextPageCursor': cursorValue,
8176
+ };
8177
+ result[lastIndex] = last;
8178
+ return result;
8179
+ }
8151
8180
  async fetchLeverageTiers(symbols = undefined, params = {}) {
8152
8181
  /**
8153
8182
  * @method
@@ -8157,24 +8186,20 @@ class bybit extends bybit$1 {
8157
8186
  * @param {string[]} [symbols] a list of unified market symbols
8158
8187
  * @param {object} [params] extra parameters specific to the exchange API endpoint
8159
8188
  * @param {string} [params.subType] market subType, ['linear', 'inverse'], default is 'linear'
8189
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
8160
8190
  * @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
8161
8191
  */
8162
8192
  await this.loadMarkets();
8163
8193
  let market = undefined;
8194
+ let symbol = undefined;
8164
8195
  if (symbols !== undefined) {
8165
8196
  market = this.market(symbols[0]);
8166
8197
  if (market['spot']) {
8167
8198
  throw new errors.NotSupported(this.id + ' fetchLeverageTiers() is not supported for spot market');
8168
8199
  }
8200
+ symbol = market['symbol'];
8169
8201
  }
8170
- let subType = undefined;
8171
- [subType, params] = this.handleSubTypeAndParams('fetchTickers', market, params, 'linear');
8172
- const request = {
8173
- 'category': subType,
8174
- };
8175
- const response = await this.publicGetV5MarketRiskLimit(this.extend(request, params));
8176
- const result = this.safeDict(response, 'result', {});
8177
- const data = this.safeList(result, 'list', []);
8202
+ const data = await this.getLeverageTiersPaginated(symbol, this.extend({ 'paginate': true, 'paginationCalls': 20 }, params));
8178
8203
  symbols = this.marketSymbols(symbols);
8179
8204
  return this.parseLeverageTiers(data, symbols, 'symbol');
8180
8205
  }
@@ -8200,9 +8225,13 @@ class bybit extends bybit$1 {
8200
8225
  for (let i = 0; i < keys.length; i++) {
8201
8226
  const marketId = keys[i];
8202
8227
  const entry = grouped[marketId];
8228
+ for (let j = 0; j < entry.length; j++) {
8229
+ const id = this.safeInteger(entry[j], 'id');
8230
+ entry[j]['id'] = id;
8231
+ }
8203
8232
  const market = this.safeMarket(marketId, undefined, undefined, 'contract');
8204
8233
  const symbol = market['symbol'];
8205
- tiers[symbol] = this.parseMarketLeverageTiers(entry, market);
8234
+ tiers[symbol] = this.parseMarketLeverageTiers(this.sortBy(entry, 'id'), market);
8206
8235
  }
8207
8236
  return tiers;
8208
8237
  }