ccxt 4.2.52 → 4.2.54

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 (49) hide show
  1. package/README.md +3 -3
  2. package/build.sh +1 -1
  3. package/dist/ccxt.browser.js +511 -102
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/ccxt.js +1 -1
  6. package/dist/cjs/src/binance.js +136 -9
  7. package/dist/cjs/src/bingx.js +32 -1
  8. package/dist/cjs/src/bitget.js +1 -0
  9. package/dist/cjs/src/bitvavo.js +1 -1
  10. package/dist/cjs/src/bybit.js +19 -0
  11. package/dist/cjs/src/coinbase.js +186 -12
  12. package/dist/cjs/src/htx.js +10 -4
  13. package/dist/cjs/src/pro/binance.js +92 -38
  14. package/dist/cjs/src/pro/bitvavo.js +1 -1
  15. package/dist/cjs/src/pro/blockchaincom.js +7 -25
  16. package/dist/cjs/src/pro/deribit.js +2 -2
  17. package/dist/cjs/src/pro/gemini.js +1 -1
  18. package/dist/cjs/src/pro/okx.js +18 -4
  19. package/dist/cjs/src/whitebit.js +4 -3
  20. package/js/ccxt.d.ts +1 -1
  21. package/js/ccxt.js +1 -1
  22. package/js/src/abstract/binance.d.ts +9 -3
  23. package/js/src/abstract/binancecoinm.d.ts +9 -3
  24. package/js/src/abstract/binanceus.d.ts +9 -3
  25. package/js/src/abstract/binanceusdm.d.ts +9 -3
  26. package/js/src/abstract/coinbase.d.ts +1 -1
  27. package/js/src/binance.d.ts +4 -0
  28. package/js/src/binance.js +136 -9
  29. package/js/src/bingx.d.ts +4 -0
  30. package/js/src/bingx.js +32 -1
  31. package/js/src/bitget.js +1 -0
  32. package/js/src/bitvavo.js +1 -1
  33. package/js/src/bybit.d.ts +5 -0
  34. package/js/src/bybit.js +19 -0
  35. package/js/src/coinbase.d.ts +2 -0
  36. package/js/src/coinbase.js +186 -12
  37. package/js/src/htx.js +10 -4
  38. package/js/src/pro/binance.d.ts +4 -4
  39. package/js/src/pro/binance.js +92 -38
  40. package/js/src/pro/bitvavo.js +1 -1
  41. package/js/src/pro/blockchaincom.d.ts +0 -1
  42. package/js/src/pro/blockchaincom.js +7 -25
  43. package/js/src/pro/deribit.js +2 -2
  44. package/js/src/pro/gemini.js +1 -1
  45. package/js/src/pro/okx.js +18 -4
  46. package/js/src/whitebit.js +4 -3
  47. package/jsdoc2md.js +3 -2
  48. package/package.json +2 -1
  49. package/skip-tests.json +26 -9
@@ -21,7 +21,6 @@ export default class blockchaincom extends blockchaincomRest {
21
21
  handleOrderBook(client: Client, message: any): void;
22
22
  handleDelta(bookside: any, delta: any): void;
23
23
  handleDeltas(bookside: any, deltas: any): void;
24
- checkSequenceNumber(client: Client, message: any): void;
25
24
  handleMessage(client: Client, message: any): void;
26
25
  handleAuthenticationMessage(client: Client, message: any): void;
27
26
  authenticate(params?: {}): Promise<any>;
@@ -37,7 +37,6 @@ export default class blockchaincom extends blockchaincomRest {
37
37
  },
38
38
  'noOriginHeader': false,
39
39
  },
40
- 'sequenceNumbers': {},
41
40
  },
42
41
  'streaming': {},
43
42
  'exceptions': {},
@@ -681,21 +680,20 @@ export default class blockchaincom extends blockchaincomRest {
681
680
  // }
682
681
  //
683
682
  const event = this.safeString(message, 'event');
683
+ if (event === 'subscribed') {
684
+ return;
685
+ }
684
686
  const type = this.safeString(message, 'channel');
685
687
  const marketId = this.safeString(message, 'symbol');
686
688
  const symbol = this.safeSymbol(marketId);
687
689
  const messageHash = 'orderbook:' + symbol + ':' + type;
688
690
  const datetime = this.safeString(message, 'timestamp');
689
691
  const timestamp = this.parse8601(datetime);
690
- let orderbook = this.safeValue(this.orderbooks, symbol);
691
- if (orderbook === undefined) {
692
- orderbook = this.countedOrderBook({});
693
- this.orderbooks[symbol] = orderbook;
694
- }
695
- if (event === 'subscribed') {
696
- return;
692
+ if (this.safeValue(this.orderbooks, symbol) === undefined) {
693
+ this.orderbooks[symbol] = this.countedOrderBook();
697
694
  }
698
- else if (event === 'snapshot') {
695
+ const orderbook = this.orderbooks[symbol];
696
+ if (event === 'snapshot') {
699
697
  const snapshot = this.parseOrderBook(message, symbol, timestamp, 'bids', 'asks', 'px', 'qty', 'num');
700
698
  orderbook.reset(snapshot);
701
699
  }
@@ -721,23 +719,7 @@ export default class blockchaincom extends blockchaincomRest {
721
719
  this.handleDelta(bookside, deltas[i]);
722
720
  }
723
721
  }
724
- checkSequenceNumber(client, message) {
725
- const seqnum = this.safeInteger(message, 'seqnum', 0);
726
- const channel = this.safeString(message, 'channel', '');
727
- const sequenceNumbersByChannel = this.safeValue(this.options, 'sequenceNumbers', {});
728
- const lastSeqnum = this.safeInteger(sequenceNumbersByChannel, channel);
729
- if (lastSeqnum === undefined) {
730
- this.options['sequenceNumbers'][channel] = seqnum;
731
- }
732
- else {
733
- if (seqnum !== lastSeqnum + 1) {
734
- throw new ExchangeError(this.id + ' ' + channel + ' seqnum ' + seqnum + ' is not the expected ' + (lastSeqnum + 1));
735
- }
736
- this.options['sequenceNumbers'][channel] = seqnum;
737
- }
738
- }
739
722
  handleMessage(client, message) {
740
- this.checkSequenceNumber(client, message);
741
723
  const channel = this.safeString(message, 'channel');
742
724
  const handlers = {
743
725
  'ticker': this.handleTicker,
@@ -180,7 +180,7 @@ export default class deribit extends deribitRest {
180
180
  // "params": {
181
181
  // "channel": "ticker.BTC_USDC-PERPETUAL.raw",
182
182
  // "data": {
183
- // "timestamp": 1655393725041,
183
+ // "timestamp": 1655393725040,
184
184
  // "stats": [Object],
185
185
  // "state": "open",
186
186
  // "settlement_price": 21729.5891,
@@ -663,7 +663,7 @@ export default class deribit extends deribitRest {
663
663
  const symbol = this.safeSymbol(marketId);
664
664
  const ohlcv = this.safeValue(params, 'data', {});
665
665
  const parsed = [
666
- this.safeNumber(ohlcv, 'tick'),
666
+ this.safeInteger(ohlcv, 'tick'),
667
667
  this.safeNumber(ohlcv, 'open'),
668
668
  this.safeNumber(ohlcv, 'high'),
669
669
  this.safeNumber(ohlcv, 'low'),
@@ -206,7 +206,7 @@ export default class gemini extends geminiRest {
206
206
  // "time_ms": 1655323185000,
207
207
  // "result": "failure",
208
208
  // "highest_bid_price": "21661.90",
209
- // "lowest_ask_price": "21663.79",
209
+ // "lowest_ask_price": "21663.78",
210
210
  // "collar_price": "21662.845"
211
211
  // },
212
212
  // ]
package/js/src/pro/okx.js CHANGED
@@ -910,9 +910,6 @@ export default class okx extends okxRest {
910
910
  * @param {object} params extra parameters specific to the exchange API endpoint
911
911
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
912
912
  */
913
- if (this.isEmpty(symbols)) {
914
- throw new ArgumentsRequired(this.id + ' watchPositions requires a list of symbols');
915
- }
916
913
  await this.loadMarkets();
917
914
  await this.authenticate(params);
918
915
  symbols = this.marketSymbols(symbols);
@@ -920,7 +917,23 @@ export default class okx extends okxRest {
920
917
  'instType': 'ANY',
921
918
  };
922
919
  const channel = 'positions';
923
- const newPositions = await this.subscribeMultiple('private', channel, symbols, this.extend(request, params));
920
+ let newPositions = undefined;
921
+ if (symbols === undefined) {
922
+ const arg = {
923
+ 'channel': 'positions',
924
+ 'instType': 'ANY',
925
+ };
926
+ const args = [arg];
927
+ const nonSymbolRequest = {
928
+ 'op': 'subscribe',
929
+ 'args': args,
930
+ };
931
+ const url = this.getUrl(channel, 'private');
932
+ newPositions = await this.watch(url, channel, nonSymbolRequest, channel);
933
+ }
934
+ else {
935
+ newPositions = await this.subscribeMultiple('private', channel, symbols, this.extend(request, params));
936
+ }
924
937
  if (this.newUpdates) {
925
938
  return newPositions;
926
939
  }
@@ -1018,6 +1031,7 @@ export default class okx extends okxRest {
1018
1031
  client.resolve(positions, messageHash);
1019
1032
  }
1020
1033
  }
1034
+ client.resolve(newPositions, channel);
1021
1035
  }
1022
1036
  async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1023
1037
  /**
@@ -230,6 +230,7 @@ export default class whitebit extends Exchange {
230
230
  'account': 'spot',
231
231
  },
232
232
  'accountsByType': {
233
+ 'funding': 'main',
233
234
  'main': 'main',
234
235
  'spot': 'spot',
235
236
  'margin': 'collateral',
@@ -1323,9 +1324,9 @@ export default class whitebit extends Exchange {
1323
1324
  else {
1324
1325
  const options = this.safeValue(this.options, 'fetchBalance', {});
1325
1326
  const defaultAccount = this.safeString(options, 'account');
1326
- const account = this.safeString(params, 'account', defaultAccount);
1327
- params = this.omit(params, 'account');
1328
- if (account === 'main') {
1327
+ const account = this.safeString2(params, 'account', 'type', defaultAccount);
1328
+ params = this.omit(params, ['account', 'type']);
1329
+ if (account === 'main' || account === 'funding') {
1329
1330
  response = await this.v4PrivatePostMainAccountBalance(params);
1330
1331
  }
1331
1332
  else {
package/jsdoc2md.js CHANGED
@@ -108,10 +108,11 @@ const sidebar =
108
108
  - [Supported Exchanges](Exchange-Markets.md)
109
109
  - [Exchanges By Country](Exchange-Markets-By-Country.md)
110
110
  - [API Spec By Method](baseSpec.md)
111
- - API Spec by Exchange
112
- ${exchangeLinks.join('\n')}
111
+ - [FAQ](FAQ.md)
113
112
  - [Changelog](CHANGELOG.md)
114
113
  - [Awesome](Awesome.md)
114
+ - API Spec by Exchange
115
+ ${exchangeLinks.join('\n')}
115
116
  `
116
117
  fs.writeFileSync('./wiki/_sidebar.md', sidebar);
117
118
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.2.52",
3
+ "version": "4.2.54",
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",
@@ -35,6 +35,7 @@
35
35
  "force-build": "npm run pre-transpile && npm run force-transpile-fast && npm run csharp && npm run post-transpile && npm run update-badges",
36
36
  "build-docs": "node jsdoc2md.js && node examples2md.js",
37
37
  "serve-docs": "docsify serve ./wiki",
38
+ "tsBuildFile": "tsc --skipLibCheck --strictNullChecks false --strict --noImplicitAny false --esModuleInterop --isolatedModules false --forceConsistentCasingInFileNames --removeComments false --target ES2020 --declaration --allowJs --checkJs false --moduleResolution Node --module ES2022 --outDir ./js/src --lib ES2020.BigInt --lib dom ",
38
39
  "tsBuild": "tsc || true",
39
40
  "tsBuildExamples": "tsc -p ./examples/tsconfig.json",
40
41
  "emitAPI": "node build/generateImplicitAPI.js",
package/skip-tests.json CHANGED
@@ -48,6 +48,18 @@
48
48
  "fetchTickers": {
49
49
  "bid":"broken bid-ask",
50
50
  "ask":"broken bid-ask"
51
+ },
52
+ "fetchOrderBook": {
53
+ "spread": "https://app.travis-ci.com/github/ccxt/ccxt/builds/269129438#L3841"
54
+ },
55
+ "fetchL2OrderBook": {
56
+ "spread": "same"
57
+ },
58
+ "watchOrderBook": {
59
+ "spread": "same"
60
+ },
61
+ "watchOrderBookForSymbols": {
62
+ "spread": "same"
51
63
  }
52
64
  }
53
65
  },
@@ -207,9 +219,18 @@
207
219
  "withdraw": "not provided",
208
220
  "deposit": "not provided"
209
221
  },
210
- "fetchOrderBook": "multiple bids might have same value",
211
- "fetchL2OrderBook": "same",
212
- "fetchTickers": "negative values"
222
+ "fetchOrderBook": {
223
+ "bid": "multiple bids might have same value"
224
+ },
225
+ "fetchL2OrderBook": {
226
+ "bid": "same"
227
+ },
228
+ "watchOrderBook": {
229
+ "bid": "https://app.travis-ci.com/github/ccxt/ccxt/builds/269129438#L3999"
230
+ },
231
+ "watchOrderBookForSymbols": {
232
+ "bid": "same"
233
+ }
213
234
  }
214
235
  },
215
236
  "bitflyer": {
@@ -358,7 +379,7 @@
358
379
  },
359
380
  "onetrading": {
360
381
  "skip": true,
361
- "until": "2024-02-28",
382
+ "until": "2024-03-28",
362
383
  "skipWs": true,
363
384
  "skipMethods": {
364
385
  "fetchOrderBook": "some bid might be lower than next bid",
@@ -394,6 +415,7 @@
394
415
  "loadMarkets": {
395
416
  "active": "not provided"
396
417
  },
418
+ "fetchOrderBook": "https://app.travis-ci.com/github/ccxt/ccxt/builds/269129438#L4148",
397
419
  "fetchOHLCV": "randomly failing with 404 not found"
398
420
  }
399
421
  },
@@ -451,7 +473,6 @@
451
473
  }
452
474
  },
453
475
  "bitvavo": {
454
- "httpsProxy": "http://51.83.140.52:11230",
455
476
  "skipMethods": {
456
477
  "fetchCurrencies": {
457
478
  "precision": "not provided",
@@ -470,7 +491,6 @@
470
491
  }
471
492
  },
472
493
  "blockchaincom": {
473
- "skipWs": "https://app.travis-ci.com/github/ccxt/ccxt/builds/265225134#L2304",
474
494
  "skipMethods": {
475
495
  "loadMarkets": {
476
496
  "taker":"not provided",
@@ -764,7 +784,6 @@
764
784
  }
765
785
  },
766
786
  "cryptocom": {
767
- "skipWs": "timeout",
768
787
  "skipMethods": {
769
788
  "proxies": "probably they do not permit our proxy",
770
789
  "loadMarkets": {
@@ -848,7 +867,6 @@
848
867
  }
849
868
  },
850
869
  "deribit": {
851
- "skipWs": "timeouts",
852
870
  "skipMethods": {
853
871
  "fetchCurrencies": "deposit/withdraw not provided",
854
872
  "loadMarkets": "strike is set when option is not true",
@@ -895,7 +913,6 @@
895
913
  }
896
914
  },
897
915
  "gemini": {
898
- "skipWs": "temporary",
899
916
  "skipMethods": {
900
917
  "loadMarkets": {
901
918
  "currencyIdAndCode": "messed codes",