ccxt 4.2.79 → 4.2.81

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 (43) hide show
  1. package/README.md +3 -3
  2. package/build.sh +1 -1
  3. package/dist/ccxt.browser.js +752 -73
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/ccxt.js +1 -1
  6. package/dist/cjs/src/base/Exchange.js +35 -3
  7. package/dist/cjs/src/binance.js +91 -1
  8. package/dist/cjs/src/bybit.js +178 -1
  9. package/dist/cjs/src/deribit.js +155 -0
  10. package/dist/cjs/src/gate.js +200 -5
  11. package/dist/cjs/src/hyperliquid.js +54 -10
  12. package/dist/cjs/src/okx.js +19 -42
  13. package/dist/cjs/src/pro/binance.js +5 -5
  14. package/dist/cjs/src/pro/bitopro.js +2 -1
  15. package/dist/cjs/src/pro/gemini.js +3 -2
  16. package/dist/cjs/src/pro/phemex.js +7 -2
  17. package/dist/cjs/src/upbit.js +2 -0
  18. package/js/ccxt.d.ts +3 -3
  19. package/js/ccxt.js +1 -1
  20. package/js/src/abstract/upbit.d.ts +1 -0
  21. package/js/src/base/Exchange.d.ts +14 -5
  22. package/js/src/base/Exchange.js +35 -3
  23. package/js/src/base/types.d.ts +21 -0
  24. package/js/src/binance.d.ts +23 -3
  25. package/js/src/binance.js +91 -1
  26. package/js/src/bybit.d.ts +22 -1
  27. package/js/src/bybit.js +178 -1
  28. package/js/src/deribit.d.ts +22 -1
  29. package/js/src/deribit.js +155 -0
  30. package/js/src/gate.d.ts +22 -1
  31. package/js/src/gate.js +200 -5
  32. package/js/src/hyperliquid.d.ts +1 -0
  33. package/js/src/hyperliquid.js +54 -10
  34. package/js/src/okx.d.ts +0 -1
  35. package/js/src/okx.js +19 -42
  36. package/js/src/pro/binance.js +5 -5
  37. package/js/src/pro/bitopro.js +2 -1
  38. package/js/src/pro/gemini.d.ts +2 -2
  39. package/js/src/pro/gemini.js +3 -2
  40. package/js/src/pro/phemex.js +7 -2
  41. package/js/src/upbit.js +2 -0
  42. package/package.json +1 -1
  43. package/skip-tests.json +7 -2
package/js/src/okx.js CHANGED
@@ -1858,16 +1858,29 @@ export default class okx extends Exchange {
1858
1858
  const first = this.safeValue(data, 0, {});
1859
1859
  return this.parseTicker(first, market);
1860
1860
  }
1861
- async fetchTickersByType(type, symbols = undefined, params = {}) {
1861
+ async fetchTickers(symbols = undefined, params = {}) {
1862
+ /**
1863
+ * @method
1864
+ * @name okx#fetchTickers
1865
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1866
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
1867
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1868
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1869
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1870
+ */
1862
1871
  await this.loadMarkets();
1872
+ symbols = this.marketSymbols(symbols);
1873
+ const market = this.getMarketFromSymbols(symbols);
1874
+ let marketType = undefined;
1875
+ [marketType, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
1863
1876
  const request = {
1864
- 'instType': this.convertToInstrumentType(type),
1877
+ 'instType': this.convertToInstrumentType(marketType),
1865
1878
  };
1866
- if (type === 'option') {
1879
+ if (marketType === 'option') {
1867
1880
  const defaultUnderlying = this.safeValue(this.options, 'defaultUnderlying', 'BTC-USD');
1868
1881
  const currencyId = this.safeString2(params, 'uly', 'marketId', defaultUnderlying);
1869
1882
  if (currencyId === undefined) {
1870
- throw new ArgumentsRequired(this.id + ' fetchTickersByType() requires an underlying uly or marketId parameter for options markets');
1883
+ throw new ArgumentsRequired(this.id + ' fetchTickers() requires an underlying uly or marketId parameter for options markets');
1871
1884
  }
1872
1885
  else {
1873
1886
  request['uly'] = currencyId;
@@ -1900,29 +1913,9 @@ export default class okx extends Exchange {
1900
1913
  // ]
1901
1914
  // }
1902
1915
  //
1903
- const tickers = this.safeValue(response, 'data', []);
1916
+ const tickers = this.safeList(response, 'data', []);
1904
1917
  return this.parseTickers(tickers, symbols);
1905
1918
  }
1906
- async fetchTickers(symbols = undefined, params = {}) {
1907
- /**
1908
- * @method
1909
- * @name okx#fetchTickers
1910
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1911
- * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
1912
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1913
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1914
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1915
- */
1916
- await this.loadMarkets();
1917
- symbols = this.marketSymbols(symbols);
1918
- const first = this.safeString(symbols, 0);
1919
- let market = undefined;
1920
- if (first !== undefined) {
1921
- market = this.market(first);
1922
- }
1923
- const [type, query] = this.handleMarketTypeAndParams('fetchTickers', market, params);
1924
- return await this.fetchTickersByType(type, symbols, query);
1925
- }
1926
1919
  parseTrade(trade, market = undefined) {
1927
1920
  //
1928
1921
  // public fetchTrades
@@ -4740,23 +4733,7 @@ export default class okx extends Exchange {
4740
4733
  }
4741
4734
  }
4742
4735
  request['fee'] = this.numberToString(fee); // withdrawals to OKCoin or OKX are fee-free, please set 0
4743
- if ('password' in params) {
4744
- request['pwd'] = params['password'];
4745
- }
4746
- else if ('pwd' in params) {
4747
- request['pwd'] = params['pwd'];
4748
- }
4749
- else {
4750
- const options = this.safeValue(this.options, 'withdraw', {});
4751
- const password = this.safeString2(options, 'password', 'pwd');
4752
- if (password !== undefined) {
4753
- request['pwd'] = password;
4754
- }
4755
- }
4756
- const query = this.omit(params, ['fee', 'password', 'pwd']);
4757
- if (!('pwd' in request)) {
4758
- throw new ExchangeError(this.id + ' withdraw() requires a password parameter or a pwd parameter, it must be the funding password, not the API passphrase');
4759
- }
4736
+ const query = this.omit(params, ['fee']);
4760
4737
  const response = await this.privatePostAssetWithdrawal(this.extend(request, query));
4761
4738
  //
4762
4739
  // {
@@ -87,7 +87,7 @@ export default class binance extends binanceRest {
87
87
  'future': 200,
88
88
  'delivery': 200,
89
89
  },
90
- 'streamBySubscriptionsHash': {},
90
+ 'streamBySubscriptionsHash': this.createSafeDictionary(),
91
91
  'streamIndex': -1,
92
92
  // get updates every 1000ms or 100ms
93
93
  // or every 0ms in real-time for futures
@@ -95,7 +95,7 @@ export default class binance extends binanceRest {
95
95
  'tradesLimit': 1000,
96
96
  'ordersLimit': 1000,
97
97
  'OHLCVLimit': 1000,
98
- 'requestId': {},
98
+ 'requestId': this.createSafeDictionary(),
99
99
  'watchOrderBookLimit': 1000,
100
100
  'watchTrades': {
101
101
  'name': 'trade', // 'trade' or 'aggTrade'
@@ -129,14 +129,14 @@ export default class binance extends binanceRest {
129
129
  });
130
130
  }
131
131
  requestId(url) {
132
- const options = this.safeValue(this.options, 'requestId', {});
132
+ const options = this.safeDict(this.options, 'requestId', this.createSafeDictionary());
133
133
  const previousValue = this.safeInteger(options, url, 0);
134
134
  const newValue = this.sum(previousValue, 1);
135
135
  this.options['requestId'][url] = newValue;
136
136
  return newValue;
137
137
  }
138
138
  stream(type, subscriptionHash, numSubscriptions = 1) {
139
- const streamBySubscriptionsHash = this.safeValue(this.options, 'streamBySubscriptionsHash', {});
139
+ const streamBySubscriptionsHash = this.safeDict(this.options, 'streamBySubscriptionsHash', this.createSafeDictionary());
140
140
  let stream = this.safeString(streamBySubscriptionsHash, subscriptionHash);
141
141
  if (stream === undefined) {
142
142
  let streamIndex = this.safeInteger(this.options, 'streamIndex', -1);
@@ -149,7 +149,7 @@ export default class binance extends binanceRest {
149
149
  this.options['streamBySubscriptionsHash'][subscriptionHash] = stream;
150
150
  const subscriptionsByStreams = this.safeValue(this.options, 'numSubscriptionsByStream');
151
151
  if (subscriptionsByStreams === undefined) {
152
- this.options['numSubscriptionsByStream'] = {};
152
+ this.options['numSubscriptionsByStream'] = this.createSafeDictionary();
153
153
  }
154
154
  const subscriptionsByStream = this.safeInteger(this.options['numSubscriptionsByStream'], stream, 0);
155
155
  const newNumSubscriptions = subscriptionsByStream + numSubscriptions;
@@ -388,7 +388,8 @@ export default class bitopro extends bitoproRest {
388
388
  },
389
389
  },
390
390
  };
391
- this.options = this.extend(defaultOptions, this.options);
391
+ // this.options = this.extend (defaultOptions, this.options);
392
+ this.extendExchangeOptions(defaultOptions);
392
393
  const originalHeaders = this.options['ws']['options']['headers'];
393
394
  const headers = {
394
395
  'X-BITOPRO-API': 'ccxt',
@@ -1,5 +1,5 @@
1
1
  import geminiRest from '../gemini.js';
2
- import type { Int, Str, OrderBook, Order, Trade, OHLCV, Tickers } from '../base/types.js';
2
+ import type { Int, Str, Strings, OrderBook, Order, Trade, OHLCV, Tickers } from '../base/types.js';
3
3
  import Client from '../base/ws/Client.js';
4
4
  export default class gemini extends geminiRest {
5
5
  describe(): any;
@@ -14,7 +14,7 @@ export default class gemini extends geminiRest {
14
14
  watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
15
15
  handleOrderBook(client: Client, message: any): void;
16
16
  watchOrderBookForSymbols(symbols: string[], limit?: Int, params?: {}): Promise<OrderBook>;
17
- watchBidsAsks(symbols: string[], limit?: Int, params?: {}): Promise<Tickers>;
17
+ watchBidsAsks(symbols?: Strings, params?: {}): Promise<Tickers>;
18
18
  handleBidsAsksForMultidata(client: Client, rawBidAskChanges: any, timestamp: Int, nonce: Int): void;
19
19
  helperForWatchMultipleConstruct(itemHashName: string, symbols: string[], params?: {}): Promise<any>;
20
20
  handleOrderBookForMultidata(client: Client, rawOrderBookChanges: any, timestamp: Int, nonce: Int): void;
@@ -418,7 +418,7 @@ export default class gemini extends geminiRest {
418
418
  const orderbook = await this.helperForWatchMultipleConstruct('orderbook', symbols, params);
419
419
  return orderbook.limit();
420
420
  }
421
- async watchBidsAsks(symbols, limit = undefined, params = {}) {
421
+ async watchBidsAsks(symbols = undefined, params = {}) {
422
422
  /**
423
423
  * @method
424
424
  * @name gemini#watchBidsAsks
@@ -914,7 +914,8 @@ export default class gemini extends geminiRest {
914
914
  },
915
915
  },
916
916
  };
917
- this.options = this.extend(defaultOptions, this.options);
917
+ // this.options = this.extend (defaultOptions, this.options);
918
+ this.extendExchangeOptions(defaultOptions);
918
919
  const originalHeaders = this.options['ws']['options']['headers'];
919
920
  const headers = {
920
921
  'X-GEMINI-APIKEY': this.apiKey,
@@ -23,7 +23,11 @@ export default class phemex extends phemexRest {
23
23
  'watchOrders': true,
24
24
  'watchOrderBook': true,
25
25
  'watchOHLCV': true,
26
- 'watchPositions': undefined, // TODO
26
+ 'watchPositions': undefined,
27
+ // mutli-endpoints are not supported: https://github.com/ccxt/ccxt/pull/21490
28
+ 'watchOrderBookForSymbols': false,
29
+ 'watchTradesForSymbols': false,
30
+ 'watchOHLCVForSymbols': false,
27
31
  },
28
32
  'urls': {
29
33
  'test': {
@@ -563,9 +567,10 @@ export default class phemex extends phemexRest {
563
567
  /**
564
568
  * @method
565
569
  * @name phemex#watchOrderBook
570
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-orderbook
566
571
  * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-orderbook-for-new-model
567
572
  * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-30-levels-orderbook
568
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-orderbook
573
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-full-orderbook
569
574
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
570
575
  * @param {string} symbol unified symbol of the market to fetch the order book for
571
576
  * @param {int} [limit] the maximum amount of order book entries to return
package/js/src/upbit.js CHANGED
@@ -81,6 +81,7 @@ export default class upbit extends Exchange {
81
81
  '1m': 'minutes',
82
82
  '3m': 'minutes',
83
83
  '5m': 'minutes',
84
+ '10m': 'minutes',
84
85
  '15m': 'minutes',
85
86
  '30m': 'minutes',
86
87
  '1h': 'minutes',
@@ -110,6 +111,7 @@ export default class upbit extends Exchange {
110
111
  'candles/minutes/1',
111
112
  'candles/minutes/3',
112
113
  'candles/minutes/5',
114
+ 'candles/minutes/10',
113
115
  'candles/minutes/15',
114
116
  'candles/minutes/30',
115
117
  'candles/minutes/60',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.2.79",
3
+ "version": "4.2.81",
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",
package/skip-tests.json CHANGED
@@ -265,6 +265,9 @@
265
265
  "watchTrades":{
266
266
  "side": "not set https://app.travis-ci.com/github/ccxt/ccxt/builds/267900037#L4312",
267
267
  "timestamp": "messed order coming from exchange"
268
+ },
269
+ "ohlcv": {
270
+ "roundTimestamp": "are not rounded: https://app.travis-ci.com/github/ccxt/ccxt/builds/269583057#L4318"
268
271
  }
269
272
  }
270
273
  },
@@ -625,7 +628,7 @@
625
628
  }
626
629
  },
627
630
  "cex": {
628
- "skipWs": "timeouts",
631
+ "preferredSpotSymbol": "BTC/USD",
629
632
  "skipMethods": {
630
633
  "proxies": "probably they do not permit our proxy location",
631
634
  "loadMarkets": {
@@ -639,6 +642,7 @@
639
642
  "deposit": "not provided",
640
643
  "networks": "missing"
641
644
  },
645
+ "watchOHLCV": "does not work for 1min",
642
646
  "fetchOHLCV": "unexpected issue"
643
647
  }
644
648
  },
@@ -1394,7 +1398,8 @@
1394
1398
  "loadMarkets": {
1395
1399
  "taker": "is undefined",
1396
1400
  "maker": "is undefined",
1397
- "currencyIdAndCode": "not all currencies are available"
1401
+ "currencyIdAndCode": "not all currencies are available",
1402
+ "contractSize": "returns zero for BTC/USDT:USDT https://app.travis-ci.com/github/ccxt/ccxt/builds/269614608#L3778"
1398
1403
  },
1399
1404
  "fetchTrades": {
1400
1405
  "side": "undefined"