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
@@ -132,6 +132,8 @@ class gate extends gate$1 {
132
132
  'fetchOpenInterest': false,
133
133
  'fetchOpenInterestHistory': true,
134
134
  'fetchOpenOrders': true,
135
+ 'fetchOption': true,
136
+ 'fetchOptionChain': true,
135
137
  'fetchOrder': true,
136
138
  'fetchOrderBook': true,
137
139
  'fetchPosition': true,
@@ -4231,8 +4233,17 @@ class gate extends gate$1 {
4231
4233
  'account': account,
4232
4234
  };
4233
4235
  if (amount !== undefined) {
4234
- const amountKey = (market['spot']) ? 'amount' : 'size';
4235
- request[amountKey] = this.amountToPrecision(symbol, amount);
4236
+ if (market['spot']) {
4237
+ request['amount'] = this.amountToPrecision(symbol, amount);
4238
+ }
4239
+ else {
4240
+ if (side === 'sell') {
4241
+ request['size'] = Precise["default"].stringNeg(this.amountToPrecision(symbol, amount));
4242
+ }
4243
+ else {
4244
+ request['size'] = this.amountToPrecision(symbol, amount);
4245
+ }
4246
+ }
4236
4247
  }
4237
4248
  if (price !== undefined) {
4238
4249
  request['price'] = this.priceToPrecision(symbol, price);
@@ -5030,8 +5041,8 @@ class gate extends gate$1 {
5030
5041
  */
5031
5042
  await this.loadMarkets();
5032
5043
  const market = (symbol === undefined) ? undefined : this.market(symbol);
5033
- const stop = this.safeValue(params, 'stop');
5034
- params = this.omit(params, 'stop');
5044
+ const stop = this.safeBool2(params, 'stop', 'trigger');
5045
+ params = this.omit(params, ['stop', 'trigger']);
5035
5046
  const [type, query] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
5036
5047
  const [request, requestParams] = (type === 'spot') ? this.multiOrderSpotPrepareRequest(market, stop, query) : this.prepareRequest(market, type, query);
5037
5048
  let response = undefined;
@@ -5359,7 +5370,7 @@ class gate extends gate$1 {
5359
5370
  'unrealizedPnl': this.parseNumber(unrealisedPnl),
5360
5371
  'realizedPnl': this.safeNumber(position, 'realised_pnl'),
5361
5372
  'contracts': this.parseNumber(Precise["default"].stringAbs(size)),
5362
- 'contractSize': this.safeValue(market, 'contractSize'),
5373
+ 'contractSize': this.safeNumber(market, 'contractSize'),
5363
5374
  // 'realisedPnl': position['realised_pnl'],
5364
5375
  'marginRatio': undefined,
5365
5376
  'liquidationPrice': this.safeNumber(position, 'liq_price'),
@@ -7193,6 +7204,190 @@ class gate extends gate$1 {
7193
7204
  'shortLeverage': leverageValue,
7194
7205
  };
7195
7206
  }
7207
+ async fetchOption(symbol, params = {}) {
7208
+ /**
7209
+ * @method
7210
+ * @name gate#fetchOption
7211
+ * @description fetches option data that is commonly found in an option chain
7212
+ * @see https://www.gate.io/docs/developers/apiv4/en/#query-specified-contract-detail
7213
+ * @param {string} symbol unified market symbol
7214
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
7215
+ * @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
7216
+ */
7217
+ await this.loadMarkets();
7218
+ const market = this.market(symbol);
7219
+ const request = {
7220
+ 'contract': market['id'],
7221
+ };
7222
+ const response = await this.publicOptionsGetContractsContract(this.extend(request, params));
7223
+ //
7224
+ // {
7225
+ // "is_active": true,
7226
+ // "mark_price_round": "0.01",
7227
+ // "settle_fee_rate": "0.00015",
7228
+ // "bid1_size": 30,
7229
+ // "taker_fee_rate": "0.0003",
7230
+ // "price_limit_fee_rate": "0.1",
7231
+ // "order_price_round": "0.1",
7232
+ // "tag": "month",
7233
+ // "ref_rebate_rate": "0",
7234
+ // "name": "ETH_USDT-20240628-4500-C",
7235
+ // "strike_price": "4500",
7236
+ // "ask1_price": "280.5",
7237
+ // "ref_discount_rate": "0",
7238
+ // "order_price_deviate": "0.2",
7239
+ // "ask1_size": -19,
7240
+ // "mark_price_down": "155.45",
7241
+ // "orderbook_id": 11724695,
7242
+ // "is_call": true,
7243
+ // "last_price": "188.7",
7244
+ // "mark_price": "274.26",
7245
+ // "underlying": "ETH_USDT",
7246
+ // "create_time": 1688024882,
7247
+ // "settle_limit_fee_rate": "0.1",
7248
+ // "orders_limit": 10,
7249
+ // "mark_price_up": "403.83",
7250
+ // "position_size": 80,
7251
+ // "order_size_max": 10000,
7252
+ // "position_limit": 100000,
7253
+ // "multiplier": "0.01",
7254
+ // "order_size_min": 1,
7255
+ // "trade_size": 229,
7256
+ // "underlying_price": "3326.6",
7257
+ // "maker_fee_rate": "0.0003",
7258
+ // "expiration_time": 1719561600,
7259
+ // "trade_id": 15,
7260
+ // "bid1_price": "269.3"
7261
+ // }
7262
+ //
7263
+ return this.parseOption(response, undefined, market);
7264
+ }
7265
+ async fetchOptionChain(code, params = {}) {
7266
+ /**
7267
+ * @method
7268
+ * @name gate#fetchOptionChain
7269
+ * @description fetches data for an underlying asset that is commonly found in an option chain
7270
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-the-contracts-with-specified-underlying-and-expiration-time
7271
+ * @param {string} currency base currency to fetch an option chain for
7272
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
7273
+ * @param {string} [params.underlying] the underlying asset, can be obtained from fetchUnderlyingAssets ()
7274
+ * @param {int} [params.expiration] unix timestamp of the expiration time
7275
+ * @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
7276
+ */
7277
+ await this.loadMarkets();
7278
+ const currency = this.currency(code);
7279
+ const request = {
7280
+ 'underlying': currency['code'] + '_USDT',
7281
+ };
7282
+ const response = await this.publicOptionsGetContracts(this.extend(request, params));
7283
+ //
7284
+ // [
7285
+ // {
7286
+ // "is_active": true,
7287
+ // "mark_price_round": "0.1",
7288
+ // "settle_fee_rate": "0.00015",
7289
+ // "bid1_size": 434,
7290
+ // "taker_fee_rate": "0.0003",
7291
+ // "price_limit_fee_rate": "0.1",
7292
+ // "order_price_round": "1",
7293
+ // "tag": "day",
7294
+ // "ref_rebate_rate": "0",
7295
+ // "name": "BTC_USDT-20240324-63500-P",
7296
+ // "strike_price": "63500",
7297
+ // "ask1_price": "387",
7298
+ // "ref_discount_rate": "0",
7299
+ // "order_price_deviate": "0.15",
7300
+ // "ask1_size": -454,
7301
+ // "mark_price_down": "124.3",
7302
+ // "orderbook_id": 29600,
7303
+ // "is_call": false,
7304
+ // "last_price": "0",
7305
+ // "mark_price": "366.6",
7306
+ // "underlying": "BTC_USDT",
7307
+ // "create_time": 1711118829,
7308
+ // "settle_limit_fee_rate": "0.1",
7309
+ // "orders_limit": 10,
7310
+ // "mark_price_up": "630",
7311
+ // "position_size": 0,
7312
+ // "order_size_max": 10000,
7313
+ // "position_limit": 10000,
7314
+ // "multiplier": "0.01",
7315
+ // "order_size_min": 1,
7316
+ // "trade_size": 0,
7317
+ // "underlying_price": "64084.65",
7318
+ // "maker_fee_rate": "0.0003",
7319
+ // "expiration_time": 1711267200,
7320
+ // "trade_id": 0,
7321
+ // "bid1_price": "307"
7322
+ // },
7323
+ // ]
7324
+ //
7325
+ return this.parseOptionChain(response, undefined, 'name');
7326
+ }
7327
+ parseOption(chain, currency = undefined, market = undefined) {
7328
+ //
7329
+ // {
7330
+ // "is_active": true,
7331
+ // "mark_price_round": "0.1",
7332
+ // "settle_fee_rate": "0.00015",
7333
+ // "bid1_size": 434,
7334
+ // "taker_fee_rate": "0.0003",
7335
+ // "price_limit_fee_rate": "0.1",
7336
+ // "order_price_round": "1",
7337
+ // "tag": "day",
7338
+ // "ref_rebate_rate": "0",
7339
+ // "name": "BTC_USDT-20240324-63500-P",
7340
+ // "strike_price": "63500",
7341
+ // "ask1_price": "387",
7342
+ // "ref_discount_rate": "0",
7343
+ // "order_price_deviate": "0.15",
7344
+ // "ask1_size": -454,
7345
+ // "mark_price_down": "124.3",
7346
+ // "orderbook_id": 29600,
7347
+ // "is_call": false,
7348
+ // "last_price": "0",
7349
+ // "mark_price": "366.6",
7350
+ // "underlying": "BTC_USDT",
7351
+ // "create_time": 1711118829,
7352
+ // "settle_limit_fee_rate": "0.1",
7353
+ // "orders_limit": 10,
7354
+ // "mark_price_up": "630",
7355
+ // "position_size": 0,
7356
+ // "order_size_max": 10000,
7357
+ // "position_limit": 10000,
7358
+ // "multiplier": "0.01",
7359
+ // "order_size_min": 1,
7360
+ // "trade_size": 0,
7361
+ // "underlying_price": "64084.65",
7362
+ // "maker_fee_rate": "0.0003",
7363
+ // "expiration_time": 1711267200,
7364
+ // "trade_id": 0,
7365
+ // "bid1_price": "307"
7366
+ // }
7367
+ //
7368
+ const marketId = this.safeString(chain, 'name');
7369
+ market = this.safeMarket(marketId, market);
7370
+ const timestamp = this.safeTimestamp(chain, 'create_time');
7371
+ return {
7372
+ 'info': chain,
7373
+ 'currency': undefined,
7374
+ 'symbol': market['symbol'],
7375
+ 'timestamp': timestamp,
7376
+ 'datetime': this.iso8601(timestamp),
7377
+ 'impliedVolatility': undefined,
7378
+ 'openInterest': undefined,
7379
+ 'bidPrice': this.safeNumber(chain, 'bid1_price'),
7380
+ 'askPrice': this.safeNumber(chain, 'ask1_price'),
7381
+ 'midPrice': undefined,
7382
+ 'markPrice': this.safeNumber(chain, 'mark_price'),
7383
+ 'lastPrice': this.safeNumber(chain, 'last_price'),
7384
+ 'underlyingPrice': this.safeNumber(chain, 'underlying_price'),
7385
+ 'change': undefined,
7386
+ 'percentage': undefined,
7387
+ 'baseVolume': undefined,
7388
+ 'quoteVolume': undefined,
7389
+ };
7390
+ }
7196
7391
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
7197
7392
  if (response === undefined) {
7198
7393
  return undefined;
@@ -768,6 +768,8 @@ class hyperliquid extends hyperliquid$1 {
768
768
  */
769
769
  await this.loadMarkets();
770
770
  const market = this.market(symbol);
771
+ const vaultAddress = this.safeString(params, 'vaultAddress');
772
+ params = this.omit(params, 'vaultAddress');
771
773
  symbol = market['symbol'];
772
774
  const order = {
773
775
  'symbol': symbol,
@@ -777,7 +779,11 @@ class hyperliquid extends hyperliquid$1 {
777
779
  'price': price,
778
780
  'params': params,
779
781
  };
780
- const response = await this.createOrders([order], params);
782
+ const globalParams = {};
783
+ if (vaultAddress !== undefined) {
784
+ globalParams['vaultAddress'] = vaultAddress;
785
+ }
786
+ const response = await this.createOrders([order], globalParams);
781
787
  const first = this.safeDict(response, 0);
782
788
  return first;
783
789
  }
@@ -828,7 +834,6 @@ class hyperliquid extends hyperliquid$1 {
828
834
  const amount = this.safeString(rawOrder, 'amount');
829
835
  const price = this.safeString(rawOrder, 'price');
830
836
  let orderParams = this.safeDict(rawOrder, 'params', {});
831
- orderParams = this.extend(params, orderParams);
832
837
  const clientOrderId = this.safeString2(orderParams, 'clientOrderId', 'client_id');
833
838
  const slippage = this.safeString(orderParams, 'slippage', defaultSlippage);
834
839
  let defaultTimeInForce = (isMarket) ? 'ioc' : 'gtc';
@@ -876,6 +881,7 @@ class hyperliquid extends hyperliquid$1 {
876
881
  'tif': timeInForce,
877
882
  };
878
883
  }
884
+ orderParams = this.omit(orderParams, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id']);
879
885
  const orderObj = {
880
886
  'a': this.parseToInt(market['baseId']),
881
887
  'b': isBuy,
@@ -888,9 +894,9 @@ class hyperliquid extends hyperliquid$1 {
888
894
  if (clientOrderId !== undefined) {
889
895
  orderObj['c'] = clientOrderId;
890
896
  }
891
- orderReq.push(orderObj);
897
+ orderReq.push(this.extend(orderObj, orderParams));
892
898
  }
893
- const vaultAddress = this.safeString(params, 'vaultAddress');
899
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
894
900
  const orderAction = {
895
901
  'type': 'order',
896
902
  'orders': orderReq,
@@ -907,6 +913,10 @@ class hyperliquid extends hyperliquid$1 {
907
913
  'signature': signature,
908
914
  // 'vaultAddress': vaultAddress,
909
915
  };
916
+ if (vaultAddress !== undefined) {
917
+ params = this.omit(params, 'vaultAddress');
918
+ request['vaultAddress'] = vaultAddress;
919
+ }
910
920
  const response = await this.privatePostExchange(this.extend(request, params));
911
921
  //
912
922
  // {
@@ -999,10 +1009,14 @@ class hyperliquid extends hyperliquid$1 {
999
1009
  }
1000
1010
  }
1001
1011
  cancelAction['cancels'] = cancelReq;
1002
- const vaultAddress = this.safeString(params, 'vaultAddress');
1012
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
1003
1013
  const signature = this.signL1Action(cancelAction, nonce, vaultAddress);
1004
1014
  request['action'] = cancelAction;
1005
1015
  request['signature'] = signature;
1016
+ if (vaultAddress !== undefined) {
1017
+ params = this.omit(params, 'vaultAddress');
1018
+ request['vaultAddress'] = vaultAddress;
1019
+ }
1006
1020
  const response = await this.privatePostExchange(this.extend(request, params));
1007
1021
  //
1008
1022
  // {
@@ -1120,7 +1134,7 @@ class hyperliquid extends hyperliquid$1 {
1120
1134
  'type': 'batchModify',
1121
1135
  'modifies': [modifyReq],
1122
1136
  };
1123
- const vaultAddress = this.safeString(params, 'vaultAddress');
1137
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
1124
1138
  const signature = this.signL1Action(modifyAction, nonce, vaultAddress);
1125
1139
  const request = {
1126
1140
  'action': modifyAction,
@@ -1128,6 +1142,10 @@ class hyperliquid extends hyperliquid$1 {
1128
1142
  'signature': signature,
1129
1143
  // 'vaultAddress': vaultAddress,
1130
1144
  };
1145
+ if (vaultAddress !== undefined) {
1146
+ params = this.omit(params, 'vaultAddress');
1147
+ request['vaultAddress'] = vaultAddress;
1148
+ }
1131
1149
  const response = await this.privatePostExchange(this.extend(request, params));
1132
1150
  //
1133
1151
  // {
@@ -1726,7 +1744,7 @@ class hyperliquid extends hyperliquid$1 {
1726
1744
  'isolated': isIsolated,
1727
1745
  'hedged': undefined,
1728
1746
  'side': side,
1729
- 'contracts': this.parseNumber(quantity),
1747
+ 'contracts': this.safeNumber(entry, 'szi'),
1730
1748
  'contractSize': undefined,
1731
1749
  'entryPrice': this.safeNumber(entry, 'entryPx'),
1732
1750
  'markPrice': undefined,
@@ -1773,7 +1791,13 @@ class hyperliquid extends hyperliquid$1 {
1773
1791
  'isCross': isCross,
1774
1792
  'leverage': leverage,
1775
1793
  };
1776
- const vaultAddress = this.safeString(params, 'vaultAddress');
1794
+ let vaultAddress = this.safeString(params, 'vaultAddress');
1795
+ if (vaultAddress !== undefined) {
1796
+ params = this.omit(params, 'vaultAddress');
1797
+ if (vaultAddress.startsWith('0x')) {
1798
+ vaultAddress = vaultAddress.replace('0x', '');
1799
+ }
1800
+ }
1777
1801
  const signature = this.signL1Action(updateAction, nonce, vaultAddress);
1778
1802
  const request = {
1779
1803
  'action': updateAction,
@@ -1781,6 +1805,9 @@ class hyperliquid extends hyperliquid$1 {
1781
1805
  'signature': signature,
1782
1806
  // 'vaultAddress': vaultAddress,
1783
1807
  };
1808
+ if (vaultAddress !== undefined) {
1809
+ request['vaultAddress'] = vaultAddress;
1810
+ }
1784
1811
  const response = await this.privatePostExchange(this.extend(request, params));
1785
1812
  //
1786
1813
  // {
@@ -1819,7 +1846,7 @@ class hyperliquid extends hyperliquid$1 {
1819
1846
  'isCross': isCross,
1820
1847
  'leverage': leverage,
1821
1848
  };
1822
- const vaultAddress = this.safeString(params, 'vaultAddress');
1849
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
1823
1850
  const signature = this.signL1Action(updateAction, nonce, vaultAddress);
1824
1851
  const request = {
1825
1852
  'action': updateAction,
@@ -1827,6 +1854,10 @@ class hyperliquid extends hyperliquid$1 {
1827
1854
  'signature': signature,
1828
1855
  // 'vaultAddress': vaultAddress,
1829
1856
  };
1857
+ if (vaultAddress !== undefined) {
1858
+ params = this.omit(params, 'vaultAddress');
1859
+ request['vaultAddress'] = vaultAddress;
1860
+ }
1830
1861
  const response = await this.privatePostExchange(this.extend(request, params));
1831
1862
  //
1832
1863
  // {
@@ -1879,7 +1910,7 @@ class hyperliquid extends hyperliquid$1 {
1879
1910
  'isBuy': true,
1880
1911
  'ntli': sz,
1881
1912
  };
1882
- const vaultAddress = this.safeString(params, 'vaultAddress');
1913
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
1883
1914
  const signature = this.signL1Action(updateAction, nonce, vaultAddress);
1884
1915
  const request = {
1885
1916
  'action': updateAction,
@@ -1887,6 +1918,10 @@ class hyperliquid extends hyperliquid$1 {
1887
1918
  'signature': signature,
1888
1919
  // 'vaultAddress': vaultAddress,
1889
1920
  };
1921
+ if (vaultAddress !== undefined) {
1922
+ params = this.omit(params, 'vaultAddress');
1923
+ request['vaultAddress'] = vaultAddress;
1924
+ }
1890
1925
  const response = await this.privatePostExchange(this.extend(request, params));
1891
1926
  //
1892
1927
  // {
@@ -1985,6 +2020,15 @@ class hyperliquid extends hyperliquid$1 {
1985
2020
  const response = await this.privatePostExchange(this.extend(request, params));
1986
2021
  return response;
1987
2022
  }
2023
+ formatVaultAddress(address = undefined) {
2024
+ if (address === undefined) {
2025
+ return undefined;
2026
+ }
2027
+ if (address.startsWith('0x')) {
2028
+ return address.replace('0x', '');
2029
+ }
2030
+ return address;
2031
+ }
1988
2032
  handlePublicAddress(methodName, params) {
1989
2033
  let userAux = undefined;
1990
2034
  [userAux, params] = this.handleOptionAndParams(params, methodName, 'user');
@@ -1855,16 +1855,29 @@ class okx extends okx$1 {
1855
1855
  const first = this.safeValue(data, 0, {});
1856
1856
  return this.parseTicker(first, market);
1857
1857
  }
1858
- async fetchTickersByType(type, symbols = undefined, params = {}) {
1858
+ async fetchTickers(symbols = undefined, params = {}) {
1859
+ /**
1860
+ * @method
1861
+ * @name okx#fetchTickers
1862
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1863
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
1864
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1865
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1866
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1867
+ */
1859
1868
  await this.loadMarkets();
1869
+ symbols = this.marketSymbols(symbols);
1870
+ const market = this.getMarketFromSymbols(symbols);
1871
+ let marketType = undefined;
1872
+ [marketType, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
1860
1873
  const request = {
1861
- 'instType': this.convertToInstrumentType(type),
1874
+ 'instType': this.convertToInstrumentType(marketType),
1862
1875
  };
1863
- if (type === 'option') {
1876
+ if (marketType === 'option') {
1864
1877
  const defaultUnderlying = this.safeValue(this.options, 'defaultUnderlying', 'BTC-USD');
1865
1878
  const currencyId = this.safeString2(params, 'uly', 'marketId', defaultUnderlying);
1866
1879
  if (currencyId === undefined) {
1867
- throw new errors.ArgumentsRequired(this.id + ' fetchTickersByType() requires an underlying uly or marketId parameter for options markets');
1880
+ throw new errors.ArgumentsRequired(this.id + ' fetchTickers() requires an underlying uly or marketId parameter for options markets');
1868
1881
  }
1869
1882
  else {
1870
1883
  request['uly'] = currencyId;
@@ -1897,29 +1910,9 @@ class okx extends okx$1 {
1897
1910
  // ]
1898
1911
  // }
1899
1912
  //
1900
- const tickers = this.safeValue(response, 'data', []);
1913
+ const tickers = this.safeList(response, 'data', []);
1901
1914
  return this.parseTickers(tickers, symbols);
1902
1915
  }
1903
- async fetchTickers(symbols = undefined, params = {}) {
1904
- /**
1905
- * @method
1906
- * @name okx#fetchTickers
1907
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1908
- * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
1909
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1910
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1911
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1912
- */
1913
- await this.loadMarkets();
1914
- symbols = this.marketSymbols(symbols);
1915
- const first = this.safeString(symbols, 0);
1916
- let market = undefined;
1917
- if (first !== undefined) {
1918
- market = this.market(first);
1919
- }
1920
- const [type, query] = this.handleMarketTypeAndParams('fetchTickers', market, params);
1921
- return await this.fetchTickersByType(type, symbols, query);
1922
- }
1923
1916
  parseTrade(trade, market = undefined) {
1924
1917
  //
1925
1918
  // public fetchTrades
@@ -4737,23 +4730,7 @@ class okx extends okx$1 {
4737
4730
  }
4738
4731
  }
4739
4732
  request['fee'] = this.numberToString(fee); // withdrawals to OKCoin or OKX are fee-free, please set 0
4740
- if ('password' in params) {
4741
- request['pwd'] = params['password'];
4742
- }
4743
- else if ('pwd' in params) {
4744
- request['pwd'] = params['pwd'];
4745
- }
4746
- else {
4747
- const options = this.safeValue(this.options, 'withdraw', {});
4748
- const password = this.safeString2(options, 'password', 'pwd');
4749
- if (password !== undefined) {
4750
- request['pwd'] = password;
4751
- }
4752
- }
4753
- const query = this.omit(params, ['fee', 'password', 'pwd']);
4754
- if (!('pwd' in request)) {
4755
- throw new errors.ExchangeError(this.id + ' withdraw() requires a password parameter or a pwd parameter, it must be the funding password, not the API passphrase');
4756
- }
4733
+ const query = this.omit(params, ['fee']);
4757
4734
  const response = await this.privatePostAssetWithdrawal(this.extend(request, query));
4758
4735
  //
4759
4736
  // {
@@ -84,7 +84,7 @@ class binance extends binance$1 {
84
84
  'future': 200,
85
85
  'delivery': 200,
86
86
  },
87
- 'streamBySubscriptionsHash': {},
87
+ 'streamBySubscriptionsHash': this.createSafeDictionary(),
88
88
  'streamIndex': -1,
89
89
  // get updates every 1000ms or 100ms
90
90
  // or every 0ms in real-time for futures
@@ -92,7 +92,7 @@ class binance extends binance$1 {
92
92
  'tradesLimit': 1000,
93
93
  'ordersLimit': 1000,
94
94
  'OHLCVLimit': 1000,
95
- 'requestId': {},
95
+ 'requestId': this.createSafeDictionary(),
96
96
  'watchOrderBookLimit': 1000,
97
97
  'watchTrades': {
98
98
  'name': 'trade', // 'trade' or 'aggTrade'
@@ -126,14 +126,14 @@ class binance extends binance$1 {
126
126
  });
127
127
  }
128
128
  requestId(url) {
129
- const options = this.safeValue(this.options, 'requestId', {});
129
+ const options = this.safeDict(this.options, 'requestId', this.createSafeDictionary());
130
130
  const previousValue = this.safeInteger(options, url, 0);
131
131
  const newValue = this.sum(previousValue, 1);
132
132
  this.options['requestId'][url] = newValue;
133
133
  return newValue;
134
134
  }
135
135
  stream(type, subscriptionHash, numSubscriptions = 1) {
136
- const streamBySubscriptionsHash = this.safeValue(this.options, 'streamBySubscriptionsHash', {});
136
+ const streamBySubscriptionsHash = this.safeDict(this.options, 'streamBySubscriptionsHash', this.createSafeDictionary());
137
137
  let stream = this.safeString(streamBySubscriptionsHash, subscriptionHash);
138
138
  if (stream === undefined) {
139
139
  let streamIndex = this.safeInteger(this.options, 'streamIndex', -1);
@@ -146,7 +146,7 @@ class binance extends binance$1 {
146
146
  this.options['streamBySubscriptionsHash'][subscriptionHash] = stream;
147
147
  const subscriptionsByStreams = this.safeValue(this.options, 'numSubscriptionsByStream');
148
148
  if (subscriptionsByStreams === undefined) {
149
- this.options['numSubscriptionsByStream'] = {};
149
+ this.options['numSubscriptionsByStream'] = this.createSafeDictionary();
150
150
  }
151
151
  const subscriptionsByStream = this.safeInteger(this.options['numSubscriptionsByStream'], stream, 0);
152
152
  const newNumSubscriptions = subscriptionsByStream + numSubscriptions;
@@ -385,7 +385,8 @@ class bitopro extends bitopro$1 {
385
385
  },
386
386
  },
387
387
  };
388
- this.options = this.extend(defaultOptions, this.options);
388
+ // this.options = this.extend (defaultOptions, this.options);
389
+ this.extendExchangeOptions(defaultOptions);
389
390
  const originalHeaders = this.options['ws']['options']['headers'];
390
391
  const headers = {
391
392
  'X-BITOPRO-API': 'ccxt',
@@ -415,7 +415,7 @@ class gemini extends gemini$1 {
415
415
  const orderbook = await this.helperForWatchMultipleConstruct('orderbook', symbols, params);
416
416
  return orderbook.limit();
417
417
  }
418
- async watchBidsAsks(symbols, limit = undefined, params = {}) {
418
+ async watchBidsAsks(symbols = undefined, params = {}) {
419
419
  /**
420
420
  * @method
421
421
  * @name gemini#watchBidsAsks
@@ -911,7 +911,8 @@ class gemini extends gemini$1 {
911
911
  },
912
912
  },
913
913
  };
914
- this.options = this.extend(defaultOptions, this.options);
914
+ // this.options = this.extend (defaultOptions, this.options);
915
+ this.extendExchangeOptions(defaultOptions);
915
916
  const originalHeaders = this.options['ws']['options']['headers'];
916
917
  const headers = {
917
918
  'X-GEMINI-APIKEY': this.apiKey,
@@ -20,7 +20,11 @@ class phemex extends phemex$1 {
20
20
  'watchOrders': true,
21
21
  'watchOrderBook': true,
22
22
  'watchOHLCV': true,
23
- 'watchPositions': undefined, // TODO
23
+ 'watchPositions': undefined,
24
+ // mutli-endpoints are not supported: https://github.com/ccxt/ccxt/pull/21490
25
+ 'watchOrderBookForSymbols': false,
26
+ 'watchTradesForSymbols': false,
27
+ 'watchOHLCVForSymbols': false,
24
28
  },
25
29
  'urls': {
26
30
  'test': {
@@ -560,9 +564,10 @@ class phemex extends phemex$1 {
560
564
  /**
561
565
  * @method
562
566
  * @name phemex#watchOrderBook
567
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-orderbook
563
568
  * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-orderbook-for-new-model
564
569
  * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-30-levels-orderbook
565
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-orderbook
570
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-full-orderbook
566
571
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
567
572
  * @param {string} symbol unified symbol of the market to fetch the order book for
568
573
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -78,6 +78,7 @@ class upbit extends upbit$1 {
78
78
  '1m': 'minutes',
79
79
  '3m': 'minutes',
80
80
  '5m': 'minutes',
81
+ '10m': 'minutes',
81
82
  '15m': 'minutes',
82
83
  '30m': 'minutes',
83
84
  '1h': 'minutes',
@@ -107,6 +108,7 @@ class upbit extends upbit$1 {
107
108
  'candles/minutes/1',
108
109
  'candles/minutes/3',
109
110
  'candles/minutes/5',
111
+ 'candles/minutes/10',
110
112
  'candles/minutes/15',
111
113
  'candles/minutes/30',
112
114
  'candles/minutes/60',
package/js/ccxt.d.ts CHANGED
@@ -2,9 +2,9 @@ import { Exchange } from './src/base/Exchange.js';
2
2
  import { Precise } from './src/base/Precise.js';
3
3
  import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
- import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages } from './src/base/types.js';
5
+ import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.2.78";
7
+ declare const version = "4.2.80";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
@@ -516,5 +516,5 @@ declare const ccxt: {
516
516
  zaif: typeof zaif;
517
517
  zonda: typeof zonda;
518
518
  } & typeof functions & typeof errors;
519
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
519
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
520
520
  export default ccxt;