ccxt 4.2.86 → 4.2.87

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 (93) hide show
  1. package/README.md +3 -3
  2. package/build.sh +1 -1
  3. package/dist/ccxt.browser.js +671 -130
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/ccxt.js +1 -1
  6. package/dist/cjs/src/ascendex.js +11 -1
  7. package/dist/cjs/src/binance.js +14 -1
  8. package/dist/cjs/src/bingx.js +37 -1
  9. package/dist/cjs/src/bitfinex.js +3 -0
  10. package/dist/cjs/src/bitfinex2.js +16 -1
  11. package/dist/cjs/src/bitflyer.js +19 -0
  12. package/dist/cjs/src/bitget.js +15 -1
  13. package/dist/cjs/src/bitopro.js +3 -0
  14. package/dist/cjs/src/bitrue.js +13 -7
  15. package/dist/cjs/src/bitvavo.js +3 -0
  16. package/dist/cjs/src/btcmarkets.js +1 -1
  17. package/dist/cjs/src/btcturk.js +2 -1
  18. package/dist/cjs/src/coinex.js +182 -54
  19. package/dist/cjs/src/currencycom.js +1 -1
  20. package/dist/cjs/src/delta.js +3 -1
  21. package/dist/cjs/src/digifinex.js +4 -2
  22. package/dist/cjs/src/exmo.js +11 -12
  23. package/dist/cjs/src/gate.js +5 -2
  24. package/dist/cjs/src/hitbtc.js +26 -2
  25. package/dist/cjs/src/htx.js +2 -2
  26. package/dist/cjs/src/huobijp.js +1 -1
  27. package/dist/cjs/src/hyperliquid.js +249 -12
  28. package/dist/cjs/src/idex.js +1 -1
  29. package/dist/cjs/src/krakenfutures.js +2 -6
  30. package/dist/cjs/src/lbank.js +3 -0
  31. package/dist/cjs/src/oceanex.js +1 -1
  32. package/dist/cjs/src/okx.js +24 -10
  33. package/dist/cjs/src/phemex.js +3 -1
  34. package/dist/cjs/src/pro/kucoin.js +11 -6
  35. package/dist/cjs/src/wazirx.js +1 -1
  36. package/dist/cjs/src/zonda.js +3 -0
  37. package/examples/js/benchmark.js +104 -0
  38. package/examples/ts/benchmark.ts +134 -0
  39. package/js/ccxt.d.ts +1 -1
  40. package/js/ccxt.js +1 -1
  41. package/js/src/ascendex.d.ts +5 -12
  42. package/js/src/ascendex.js +11 -1
  43. package/js/src/base/Exchange.d.ts +4 -4
  44. package/js/src/base/types.d.ts +11 -0
  45. package/js/src/binance.d.ts +4 -11
  46. package/js/src/binance.js +14 -1
  47. package/js/src/bingx.d.ts +5 -2
  48. package/js/src/bingx.js +37 -1
  49. package/js/src/bitfinex.js +3 -0
  50. package/js/src/bitfinex2.d.ts +3 -17
  51. package/js/src/bitfinex2.js +16 -1
  52. package/js/src/bitflyer.d.ts +1 -0
  53. package/js/src/bitflyer.js +20 -1
  54. package/js/src/bitget.d.ts +5 -12
  55. package/js/src/bitget.js +15 -1
  56. package/js/src/bitopro.js +3 -0
  57. package/js/src/bitrue.d.ts +3 -17
  58. package/js/src/bitrue.js +13 -7
  59. package/js/src/bitvavo.js +3 -0
  60. package/js/src/btcmarkets.js +1 -1
  61. package/js/src/btcturk.js +2 -1
  62. package/js/src/coinex.d.ts +4 -11
  63. package/js/src/coinex.js +182 -54
  64. package/js/src/currencycom.js +1 -1
  65. package/js/src/delta.d.ts +5 -37
  66. package/js/src/delta.js +3 -1
  67. package/js/src/digifinex.d.ts +5 -13
  68. package/js/src/digifinex.js +4 -2
  69. package/js/src/exmo.d.ts +5 -37
  70. package/js/src/exmo.js +11 -12
  71. package/js/src/gate.d.ts +5 -33
  72. package/js/src/gate.js +5 -2
  73. package/js/src/hitbtc.d.ts +5 -12
  74. package/js/src/hitbtc.js +26 -2
  75. package/js/src/htx.js +2 -2
  76. package/js/src/huobijp.js +1 -1
  77. package/js/src/hyperliquid.d.ts +7 -4
  78. package/js/src/hyperliquid.js +249 -12
  79. package/js/src/idex.js +1 -1
  80. package/js/src/krakenfutures.js +2 -6
  81. package/js/src/kucoinfutures.d.ts +2 -2
  82. package/js/src/lbank.js +3 -0
  83. package/js/src/mexc.d.ts +3 -3
  84. package/js/src/oceanex.js +1 -1
  85. package/js/src/okx.d.ts +5 -33
  86. package/js/src/okx.js +24 -10
  87. package/js/src/phemex.d.ts +3 -11
  88. package/js/src/phemex.js +3 -1
  89. package/js/src/pro/kucoin.js +11 -6
  90. package/js/src/wazirx.js +1 -1
  91. package/js/src/zonda.js +3 -0
  92. package/package.json +3 -2
  93. package/skip-tests.json +3 -3
package/js/src/okx.js CHANGED
@@ -6463,26 +6463,40 @@ export default class okx extends Exchange {
6463
6463
  // "msg": ""
6464
6464
  // }
6465
6465
  //
6466
- return this.parseMarginModification(response, market);
6466
+ const data = this.safeList(response, 'data', []);
6467
+ const errorCode = this.safeString(response, 'code');
6468
+ const item = this.safeDict(data, 0, {});
6469
+ return this.extend(this.parseMarginModification(item, market), {
6470
+ 'status': (errorCode === '0') ? 'ok' : 'failed',
6471
+ });
6467
6472
  }
6468
6473
  parseMarginModification(data, market = undefined) {
6469
- const innerData = this.safeValue(data, 'data', []);
6470
- const entry = this.safeValue(innerData, 0, {});
6471
- const errorCode = this.safeString(data, 'code');
6472
- const status = (errorCode === '0') ? 'ok' : 'failed';
6473
- const amountRaw = this.safeNumber(entry, 'amt');
6474
- const typeRaw = this.safeString(entry, 'type');
6474
+ //
6475
+ // addMargin/reduceMargin
6476
+ //
6477
+ // {
6478
+ // "amt": "0.01",
6479
+ // "instId": "ETH-USD-SWAP",
6480
+ // "posSide": "net",
6481
+ // "type": "reduce"
6482
+ // }
6483
+ //
6484
+ const amountRaw = this.safeNumber(data, 'amt');
6485
+ const typeRaw = this.safeString(data, 'type');
6475
6486
  const type = (typeRaw === 'reduce') ? 'reduce' : 'add';
6476
- const marketId = this.safeString(entry, 'instId');
6487
+ const marketId = this.safeString(data, 'instId');
6477
6488
  const responseMarket = this.safeMarket(marketId, market);
6478
6489
  const code = responseMarket['inverse'] ? responseMarket['base'] : responseMarket['quote'];
6479
6490
  return {
6480
6491
  'info': data,
6492
+ 'symbol': responseMarket['symbol'],
6481
6493
  'type': type,
6482
6494
  'amount': amountRaw,
6495
+ 'total': undefined,
6483
6496
  'code': code,
6484
- 'symbol': responseMarket['symbol'],
6485
- 'status': status,
6497
+ 'status': undefined,
6498
+ 'timestamp': undefined,
6499
+ 'datetime': undefined,
6486
6500
  };
6487
6501
  }
6488
6502
  async reduceMargin(symbol, amount, params = {}) {
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/phemex.js';
2
- import type { TransferEntry, Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction } from './base/types.js';
2
+ import type { TransferEntry, Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, MarginModification } from './base/types.js';
3
3
  /**
4
4
  * @class phemex
5
5
  * @augments Exchange
@@ -99,17 +99,9 @@ export default class phemex extends Exchange {
99
99
  previousFundingTimestamp: any;
100
100
  previousFundingDatetime: any;
101
101
  };
102
- setMargin(symbol: string, amount: number, params?: {}): Promise<any>;
102
+ setMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
103
103
  parseMarginStatus(status: any): string;
104
- parseMarginModification(data: any, market?: Market): {
105
- info: any;
106
- type: string;
107
- amount: any;
108
- total: any;
109
- code: string;
110
- symbol: string;
111
- status: string;
112
- };
104
+ parseMarginModification(data: any, market?: Market): MarginModification;
113
105
  setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
114
106
  setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
115
107
  fetchLeverageTiers(symbols?: Strings, params?: {}): Promise<{}>;
package/js/src/phemex.js CHANGED
@@ -4063,12 +4063,14 @@ export default class phemex extends Exchange {
4063
4063
  const codeCurrency = inverse ? 'base' : 'quote';
4064
4064
  return {
4065
4065
  'info': data,
4066
+ 'symbol': this.safeSymbol(undefined, market),
4066
4067
  'type': 'set',
4067
4068
  'amount': undefined,
4068
4069
  'total': undefined,
4069
4070
  'code': market[codeCurrency],
4070
- 'symbol': this.safeSymbol(undefined, market),
4071
4071
  'status': this.parseMarginStatus(this.safeString(data, 'code')),
4072
+ 'timestamp': undefined,
4073
+ 'datetime': undefined,
4072
4074
  };
4073
4075
  }
4074
4076
  async setMarginMode(marginMode, symbol = undefined, params = {}) {
@@ -573,17 +573,22 @@ export default class kucoin extends kucoinRest {
573
573
  const marketId = this.safeString(data, 'symbol', topicSymbol);
574
574
  const symbol = this.safeSymbol(marketId, undefined, '-');
575
575
  const messageHash = 'orderbook:' + symbol;
576
- let orderbook = this.safeDict(this.orderbooks, symbol);
576
+ // let orderbook = this.safeDict (this.orderbooks, symbol);
577
577
  if (subject === 'level2') {
578
- if (orderbook === undefined) {
579
- orderbook = this.orderBook();
578
+ if (!(symbol in this.orderbooks)) {
579
+ this.orderbooks[symbol] = this.orderBook();
580
580
  }
581
581
  else {
582
+ const orderbook = this.orderbooks[symbol];
582
583
  orderbook.reset();
583
584
  }
584
- orderbook['symbol'] = symbol;
585
+ this.orderbooks[symbol]['symbol'] = symbol;
585
586
  }
586
587
  else {
588
+ if (!(symbol in this.orderbooks)) {
589
+ this.orderbooks[symbol] = this.orderBook();
590
+ }
591
+ const orderbook = this.orderbooks[symbol];
587
592
  const nonce = this.safeInteger(orderbook, 'nonce');
588
593
  const deltaEnd = this.safeInteger2(data, 'sequenceEnd', 'timestamp');
589
594
  if (nonce === undefined) {
@@ -609,8 +614,8 @@ export default class kucoin extends kucoinRest {
609
614
  return;
610
615
  }
611
616
  }
612
- this.handleDelta(orderbook, data);
613
- client.resolve(orderbook, messageHash);
617
+ this.handleDelta(this.orderbooks[symbol], data);
618
+ client.resolve(this.orderbooks[symbol], messageHash);
614
619
  }
615
620
  getCacheIndex(orderbook, cache) {
616
621
  const firstDelta = this.safeValue(cache, 0);
package/js/src/wazirx.js CHANGED
@@ -322,7 +322,7 @@ export default class wazirx extends Exchange {
322
322
  'interval': this.safeString(this.timeframes, timeframe, timeframe),
323
323
  };
324
324
  if (limit !== undefined) {
325
- request['limit'] = limit;
325
+ request['limit'] = Math.min(limit, 2000);
326
326
  }
327
327
  const until = this.safeInteger(params, 'until');
328
328
  params = this.omit(params, ['until']);
package/js/src/zonda.js CHANGED
@@ -1204,6 +1204,9 @@ export default class zonda extends Exchange {
1204
1204
  if (limit === undefined) {
1205
1205
  limit = 100;
1206
1206
  }
1207
+ else {
1208
+ limit = Math.min(limit, 11000); // supports up to 11k candles diapason
1209
+ }
1207
1210
  const duration = this.parseTimeframe(timeframe);
1208
1211
  const timerange = limit * duration * 1000;
1209
1212
  if (since === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.2.86",
3
+ "version": "4.2.87",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",
@@ -136,7 +136,8 @@
136
136
  "id-tests-py": "python python/ccxt/test/test_async.py --idTests",
137
137
  "id-tests-php": "php php/test/test_async.php --idTests",
138
138
  "id-tests-cs": "dotnet run --project cs/tests/tests.csproj --idTests",
139
- "id-tests": "npm run id-tests-js && npm run id-tests-py && npm run id-tests-php && npm run id-tests-cs"
139
+ "id-tests": "npm run id-tests-js && npm run id-tests-py && npm run id-tests-php && npm run id-tests-cs",
140
+ "benchmark": "node --loader ts-node/esm examples/ts/benchmark.ts"
140
141
  },
141
142
  "types": "./js/ccxt.d.ts",
142
143
  "devDependencies": {
package/skip-tests.json CHANGED
@@ -290,7 +290,8 @@
290
290
  "high": "same",
291
291
  "previousClose": "same",
292
292
  "vwap": "same",
293
- "baseVolume":"temp"
293
+ "baseVolume":"temp",
294
+ "spread": "https://app.travis-ci.com/github/ccxt/ccxt/builds/269724413#L3725"
294
295
  },
295
296
  "fetchPositions": {
296
297
  "stopLossPrice": "undefined",
@@ -349,8 +350,7 @@
349
350
  }
350
351
  },
351
352
  "onetrading": {
352
- "skip": true,
353
- "until": "2024-03-28",
353
+ "skip": "Api changed, as mentioned https://github.com/ccxt/ccxt/pull/21991",
354
354
  "skipWs": true,
355
355
  "skipMethods": {
356
356
  "fetchCurrencies": {