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
@@ -7672,6 +7672,8 @@ class Exchange {
7672
7672
  'fetchOpenOrder': undefined,
7673
7673
  'fetchOpenOrders': undefined,
7674
7674
  'fetchOpenOrdersWs': undefined,
7675
+ 'fetchOption': undefined,
7676
+ 'fetchOptionChain': undefined,
7675
7677
  'fetchOrder': undefined,
7676
7678
  'fetchOrderBook': true,
7677
7679
  'fetchOrderBooks': undefined,
@@ -8643,6 +8645,12 @@ class Exchange {
8643
8645
  intToBase16(elem) {
8644
8646
  return elem.toString(16);
8645
8647
  }
8648
+ extendExchangeOptions(newOptions) {
8649
+ this.options = this.extend(this.options, newOptions);
8650
+ }
8651
+ createSafeDictionary() {
8652
+ return {};
8653
+ }
8646
8654
  /* eslint-enable */
8647
8655
  // ------------------------------------------------------------------------
8648
8656
  // ########################################################################
@@ -10343,7 +10351,7 @@ class Exchange {
10343
10351
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.BadResponse(errorMessage);
10344
10352
  }
10345
10353
  }
10346
- marketIds(symbols) {
10354
+ marketIds(symbols = undefined) {
10347
10355
  if (symbols === undefined) {
10348
10356
  return symbols;
10349
10357
  }
@@ -10353,7 +10361,7 @@ class Exchange {
10353
10361
  }
10354
10362
  return result;
10355
10363
  }
10356
- marketSymbols(symbols, type = undefined, allowEmpty = true, sameTypeOnly = false, sameSubTypeOnly = false) {
10364
+ marketSymbols(symbols = undefined, type = undefined, allowEmpty = true, sameTypeOnly = false, sameSubTypeOnly = false) {
10357
10365
  if (symbols === undefined) {
10358
10366
  if (!allowEmpty) {
10359
10367
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' empty list of symbols is not supported');
@@ -10394,7 +10402,7 @@ class Exchange {
10394
10402
  }
10395
10403
  return result;
10396
10404
  }
10397
- marketCodes(codes) {
10405
+ marketCodes(codes = undefined) {
10398
10406
  if (codes === undefined) {
10399
10407
  return codes;
10400
10408
  }
@@ -11334,6 +11342,9 @@ class Exchange {
11334
11342
  async fetchOrderBooks(symbols = undefined, limit = undefined, params = {}) {
11335
11343
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOrderBooks() is not supported yet');
11336
11344
  }
11345
+ async watchBidsAsks(symbols = undefined, params = {}) {
11346
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchBidsAsks() is not supported yet');
11347
+ }
11337
11348
  async watchTickers(symbols = undefined, params = {}) {
11338
11349
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchTickers() is not supported yet');
11339
11350
  }
@@ -11686,6 +11697,12 @@ class Exchange {
11686
11697
  async fetchGreeks(symbol, params = {}) {
11687
11698
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchGreeks() is not supported yet');
11688
11699
  }
11700
+ async fetchOptionChain(code, params = {}) {
11701
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOptionChain() is not supported yet');
11702
+ }
11703
+ async fetchOption(symbol, params = {}) {
11704
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOption() is not supported yet');
11705
+ }
11689
11706
  async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
11690
11707
  /**
11691
11708
  * @method
@@ -12864,6 +12881,21 @@ class Exchange {
12864
12881
  parseGreeks(greeks, market = undefined) {
12865
12882
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseGreeks () is not supported yet');
12866
12883
  }
12884
+ parseOption(chain, currency = undefined, market = undefined) {
12885
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseOption () is not supported yet');
12886
+ }
12887
+ parseOptionChain(response, currencyKey = undefined, symbolKey = undefined) {
12888
+ const optionStructures = {};
12889
+ for (let i = 0; i < response.length; i++) {
12890
+ const info = response[i];
12891
+ const currencyId = this.safeString(info, currencyKey);
12892
+ const currency = this.safeCurrency(currencyId);
12893
+ const marketId = this.safeString(info, symbolKey);
12894
+ const market = this.safeMarket(marketId, undefined, undefined, 'option');
12895
+ optionStructures[market['symbol']] = this.parseOption(info, currency, market);
12896
+ }
12897
+ return optionStructures;
12898
+ }
12867
12899
  parseMarginModes(response, symbols = undefined, symbolKey = undefined, marketType = undefined) {
12868
12900
  const marginModeStructures = {};
12869
12901
  for (let i = 0; i < response.length; i++) {
@@ -18527,6 +18559,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
18527
18559
  'fetchOpenInterestHistory': true,
18528
18560
  'fetchOpenOrder': true,
18529
18561
  'fetchOpenOrders': true,
18562
+ 'fetchOption': true,
18563
+ 'fetchOptionChain': false,
18530
18564
  'fetchOrder': true,
18531
18565
  'fetchOrderBook': true,
18532
18566
  'fetchOrderBooks': false,
@@ -20818,7 +20852,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
20818
20852
  }
20819
20853
  isInverse(type, subType = undefined) {
20820
20854
  if (subType === undefined) {
20821
- return type === 'delivery';
20855
+ return (type === 'delivery');
20822
20856
  }
20823
20857
  else {
20824
20858
  return subType === 'inverse';
@@ -30824,6 +30858,94 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
30824
30858
  'marginMode': isIsolated ? 'isolated' : 'cross',
30825
30859
  };
30826
30860
  }
30861
+ async fetchOption(symbol, params = {}) {
30862
+ /**
30863
+ * @method
30864
+ * @name binance#fetchOption
30865
+ * @description fetches option data that is commonly found in an option chain
30866
+ * @see https://binance-docs.github.io/apidocs/voptions/en/#24hr-ticker-price-change-statistics
30867
+ * @param {string} symbol unified market symbol
30868
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
30869
+ * @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
30870
+ */
30871
+ await this.loadMarkets();
30872
+ const market = this.market(symbol);
30873
+ const request = {
30874
+ 'symbol': market['id'],
30875
+ };
30876
+ const response = await this.eapiPublicGetTicker(this.extend(request, params));
30877
+ //
30878
+ // [
30879
+ // {
30880
+ // "symbol": "BTC-241227-80000-C",
30881
+ // "priceChange": "0",
30882
+ // "priceChangePercent": "0",
30883
+ // "lastPrice": "2750",
30884
+ // "lastQty": "0",
30885
+ // "open": "2750",
30886
+ // "high": "2750",
30887
+ // "low": "2750",
30888
+ // "volume": "0",
30889
+ // "amount": "0",
30890
+ // "bidPrice": "4880",
30891
+ // "askPrice": "0",
30892
+ // "openTime": 0,
30893
+ // "closeTime": 0,
30894
+ // "firstTradeId": 0,
30895
+ // "tradeCount": 0,
30896
+ // "strikePrice": "80000",
30897
+ // "exercisePrice": "63944.09893617"
30898
+ // }
30899
+ // ]
30900
+ //
30901
+ const chain = this.safeDict(response, 0, {});
30902
+ return this.parseOption(chain, undefined, market);
30903
+ }
30904
+ parseOption(chain, currency = undefined, market = undefined) {
30905
+ //
30906
+ // {
30907
+ // "symbol": "BTC-241227-80000-C",
30908
+ // "priceChange": "0",
30909
+ // "priceChangePercent": "0",
30910
+ // "lastPrice": "2750",
30911
+ // "lastQty": "0",
30912
+ // "open": "2750",
30913
+ // "high": "2750",
30914
+ // "low": "2750",
30915
+ // "volume": "0",
30916
+ // "amount": "0",
30917
+ // "bidPrice": "4880",
30918
+ // "askPrice": "0",
30919
+ // "openTime": 0,
30920
+ // "closeTime": 0,
30921
+ // "firstTradeId": 0,
30922
+ // "tradeCount": 0,
30923
+ // "strikePrice": "80000",
30924
+ // "exercisePrice": "63944.09893617"
30925
+ // }
30926
+ //
30927
+ const marketId = this.safeString(chain, 'symbol');
30928
+ market = this.safeMarket(marketId, market);
30929
+ return {
30930
+ 'info': chain,
30931
+ 'currency': undefined,
30932
+ 'symbol': market['symbol'],
30933
+ 'timestamp': undefined,
30934
+ 'datetime': undefined,
30935
+ 'impliedVolatility': undefined,
30936
+ 'openInterest': undefined,
30937
+ 'bidPrice': this.safeNumber(chain, 'bidPrice'),
30938
+ 'askPrice': this.safeNumber(chain, 'askPrice'),
30939
+ 'midPrice': undefined,
30940
+ 'markPrice': undefined,
30941
+ 'lastPrice': this.safeNumber(chain, 'lastPrice'),
30942
+ 'underlyingPrice': this.safeNumber(chain, 'exercisePrice'),
30943
+ 'change': this.safeNumber(chain, 'priceChange'),
30944
+ 'percentage': this.safeNumber(chain, 'priceChangePercent'),
30945
+ 'baseVolume': this.safeNumber(chain, 'volume'),
30946
+ 'quoteVolume': undefined,
30947
+ };
30948
+ }
30827
30949
  }
30828
30950
 
30829
30951
 
@@ -83575,6 +83697,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
83575
83697
  'fetchDeposits': true,
83576
83698
  'fetchDepositWithdrawFee': 'emulated',
83577
83699
  'fetchDepositWithdrawFees': true,
83700
+ 'fetchFundingHistory': true,
83578
83701
  'fetchFundingRate': true,
83579
83702
  'fetchFundingRateHistory': true,
83580
83703
  'fetchFundingRates': true,
@@ -83596,6 +83719,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
83596
83719
  'fetchOpenInterestHistory': true,
83597
83720
  'fetchOpenOrder': true,
83598
83721
  'fetchOpenOrders': true,
83722
+ 'fetchOption': true,
83723
+ 'fetchOptionChain': true,
83599
83724
  'fetchOrder': false,
83600
83725
  'fetchOrderBook': true,
83601
83726
  'fetchOrders': false,
@@ -83615,7 +83740,6 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
83615
83740
  'fetchUnderlyingAssets': false,
83616
83741
  'fetchVolatilityHistory': true,
83617
83742
  'fetchWithdrawals': true,
83618
- 'fetchFundingHistory': true,
83619
83743
  'repayCrossMargin': true,
83620
83744
  'setLeverage': true,
83621
83745
  'setMarginMode': true,
@@ -91716,6 +91840,181 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
91716
91840
  'rate': this.safeNumber(income, 'feeRate'),
91717
91841
  };
91718
91842
  }
91843
+ async fetchOption(symbol, params = {}) {
91844
+ /**
91845
+ * @method
91846
+ * @name bybit#fetchOption
91847
+ * @description fetches option data that is commonly found in an option chain
91848
+ * @see https://bybit-exchange.github.io/docs/v5/market/tickers
91849
+ * @param {string} symbol unified market symbol
91850
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
91851
+ * @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
91852
+ */
91853
+ await this.loadMarkets();
91854
+ const market = this.market(symbol);
91855
+ const request = {
91856
+ 'category': 'option',
91857
+ 'symbol': market['id'],
91858
+ };
91859
+ const response = await this.publicGetV5MarketTickers(this.extend(request, params));
91860
+ //
91861
+ // {
91862
+ // "retCode": 0,
91863
+ // "retMsg": "SUCCESS",
91864
+ // "result": {
91865
+ // "category": "option",
91866
+ // "list": [
91867
+ // {
91868
+ // "symbol": "BTC-27DEC24-55000-P",
91869
+ // "bid1Price": "0",
91870
+ // "bid1Size": "0",
91871
+ // "bid1Iv": "0",
91872
+ // "ask1Price": "0",
91873
+ // "ask1Size": "0",
91874
+ // "ask1Iv": "0",
91875
+ // "lastPrice": "10980",
91876
+ // "highPrice24h": "0",
91877
+ // "lowPrice24h": "0",
91878
+ // "markPrice": "11814.66756236",
91879
+ // "indexPrice": "63838.92",
91880
+ // "markIv": "0.8866",
91881
+ // "underlyingPrice": "71690.55303594",
91882
+ // "openInterest": "0.01",
91883
+ // "turnover24h": "0",
91884
+ // "volume24h": "0",
91885
+ // "totalVolume": "2",
91886
+ // "totalTurnover": "78719",
91887
+ // "delta": "-0.23284954",
91888
+ // "gamma": "0.0000055",
91889
+ // "vega": "191.70757975",
91890
+ // "theta": "-30.43617927",
91891
+ // "predictedDeliveryPrice": "0",
91892
+ // "change24h": "0"
91893
+ // }
91894
+ // ]
91895
+ // },
91896
+ // "retExtInfo": {},
91897
+ // "time": 1711162003672
91898
+ // }
91899
+ //
91900
+ const result = this.safeDict(response, 'result', {});
91901
+ const resultList = this.safeList(result, 'list', []);
91902
+ const chain = this.safeDict(resultList, 0, {});
91903
+ return this.parseOption(chain, undefined, market);
91904
+ }
91905
+ async fetchOptionChain(code, params = {}) {
91906
+ /**
91907
+ * @method
91908
+ * @name bybit#fetchOptionChain
91909
+ * @description fetches data for an underlying asset that is commonly found in an option chain
91910
+ * @see https://bybit-exchange.github.io/docs/v5/market/tickers
91911
+ * @param {string} currency base currency to fetch an option chain for
91912
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
91913
+ * @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
91914
+ */
91915
+ await this.loadMarkets();
91916
+ const currency = this.currency(code);
91917
+ const request = {
91918
+ 'category': 'option',
91919
+ 'baseCoin': currency['id'],
91920
+ };
91921
+ const response = await this.publicGetV5MarketTickers(this.extend(request, params));
91922
+ //
91923
+ // {
91924
+ // "retCode": 0,
91925
+ // "retMsg": "SUCCESS",
91926
+ // "result": {
91927
+ // "category": "option",
91928
+ // "list": [
91929
+ // {
91930
+ // "symbol": "BTC-27DEC24-55000-P",
91931
+ // "bid1Price": "0",
91932
+ // "bid1Size": "0",
91933
+ // "bid1Iv": "0",
91934
+ // "ask1Price": "0",
91935
+ // "ask1Size": "0",
91936
+ // "ask1Iv": "0",
91937
+ // "lastPrice": "10980",
91938
+ // "highPrice24h": "0",
91939
+ // "lowPrice24h": "0",
91940
+ // "markPrice": "11814.66756236",
91941
+ // "indexPrice": "63838.92",
91942
+ // "markIv": "0.8866",
91943
+ // "underlyingPrice": "71690.55303594",
91944
+ // "openInterest": "0.01",
91945
+ // "turnover24h": "0",
91946
+ // "volume24h": "0",
91947
+ // "totalVolume": "2",
91948
+ // "totalTurnover": "78719",
91949
+ // "delta": "-0.23284954",
91950
+ // "gamma": "0.0000055",
91951
+ // "vega": "191.70757975",
91952
+ // "theta": "-30.43617927",
91953
+ // "predictedDeliveryPrice": "0",
91954
+ // "change24h": "0"
91955
+ // },
91956
+ // ]
91957
+ // },
91958
+ // "retExtInfo": {},
91959
+ // "time": 1711162003672
91960
+ // }
91961
+ //
91962
+ const result = this.safeDict(response, 'result', {});
91963
+ const resultList = this.safeList(result, 'list', []);
91964
+ return this.parseOptionChain(resultList, undefined, 'symbol');
91965
+ }
91966
+ parseOption(chain, currency = undefined, market = undefined) {
91967
+ //
91968
+ // {
91969
+ // "symbol": "BTC-27DEC24-55000-P",
91970
+ // "bid1Price": "0",
91971
+ // "bid1Size": "0",
91972
+ // "bid1Iv": "0",
91973
+ // "ask1Price": "0",
91974
+ // "ask1Size": "0",
91975
+ // "ask1Iv": "0",
91976
+ // "lastPrice": "10980",
91977
+ // "highPrice24h": "0",
91978
+ // "lowPrice24h": "0",
91979
+ // "markPrice": "11814.66756236",
91980
+ // "indexPrice": "63838.92",
91981
+ // "markIv": "0.8866",
91982
+ // "underlyingPrice": "71690.55303594",
91983
+ // "openInterest": "0.01",
91984
+ // "turnover24h": "0",
91985
+ // "volume24h": "0",
91986
+ // "totalVolume": "2",
91987
+ // "totalTurnover": "78719",
91988
+ // "delta": "-0.23284954",
91989
+ // "gamma": "0.0000055",
91990
+ // "vega": "191.70757975",
91991
+ // "theta": "-30.43617927",
91992
+ // "predictedDeliveryPrice": "0",
91993
+ // "change24h": "0"
91994
+ // }
91995
+ //
91996
+ const marketId = this.safeString(chain, 'symbol');
91997
+ market = this.safeMarket(marketId, market);
91998
+ return {
91999
+ 'info': chain,
92000
+ 'currency': undefined,
92001
+ 'symbol': market['symbol'],
92002
+ 'timestamp': undefined,
92003
+ 'datetime': undefined,
92004
+ 'impliedVolatility': this.safeNumber(chain, 'markIv'),
92005
+ 'openInterest': this.safeNumber(chain, 'openInterest'),
92006
+ 'bidPrice': this.safeNumber(chain, 'bid1Price'),
92007
+ 'askPrice': this.safeNumber(chain, 'ask1Price'),
92008
+ 'midPrice': undefined,
92009
+ 'markPrice': this.safeNumber(chain, 'markPrice'),
92010
+ 'lastPrice': this.safeNumber(chain, 'lastPrice'),
92011
+ 'underlyingPrice': this.safeNumber(chain, 'underlyingPrice'),
92012
+ 'change': this.safeNumber(chain, 'change24h'),
92013
+ 'percentage': undefined,
92014
+ 'baseVolume': this.safeNumber(chain, 'totalVolume'),
92015
+ 'quoteVolume': undefined,
92016
+ };
92017
+ }
91719
92018
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
91720
92019
  let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
91721
92020
  if (api === 'public') {
@@ -125438,6 +125737,8 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
125438
125737
  'fetchMyTrades': true,
125439
125738
  'fetchOHLCV': true,
125440
125739
  'fetchOpenOrders': true,
125740
+ 'fetchOption': true,
125741
+ 'fetchOptionChain': true,
125441
125742
  'fetchOrder': true,
125442
125743
  'fetchOrderBook': true,
125443
125744
  'fetchOrders': false,
@@ -128824,6 +129125,159 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
128824
129125
  'info': greeks,
128825
129126
  };
128826
129127
  }
129128
+ async fetchOption(symbol, params = {}) {
129129
+ /**
129130
+ * @method
129131
+ * @name deribit#fetchOption
129132
+ * @description fetches option data that is commonly found in an option chain
129133
+ * @see https://docs.deribit.com/#public-get_book_summary_by_instrument
129134
+ * @param {string} symbol unified market symbol
129135
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
129136
+ * @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
129137
+ */
129138
+ await this.loadMarkets();
129139
+ const market = this.market(symbol);
129140
+ const request = {
129141
+ 'instrument_name': market['id'],
129142
+ };
129143
+ const response = await this.publicGetGetBookSummaryByInstrument(this.extend(request, params));
129144
+ //
129145
+ // {
129146
+ // "jsonrpc": "2.0",
129147
+ // "result": [
129148
+ // {
129149
+ // "mid_price": 0.04025,
129150
+ // "volume_usd": 11045.12,
129151
+ // "quote_currency": "BTC",
129152
+ // "estimated_delivery_price": 65444.72,
129153
+ // "creation_timestamp": 1711100949273,
129154
+ // "base_currency": "BTC",
129155
+ // "underlying_index": "BTC-27DEC24",
129156
+ // "underlying_price": 73742.14,
129157
+ // "volume": 4.0,
129158
+ // "interest_rate": 0.0,
129159
+ // "price_change": -6.9767,
129160
+ // "open_interest": 274.2,
129161
+ // "ask_price": 0.042,
129162
+ // "bid_price": 0.0385,
129163
+ // "instrument_name": "BTC-27DEC24-240000-C",
129164
+ // "mark_price": 0.04007735,
129165
+ // "last": 0.04,
129166
+ // "low": 0.04,
129167
+ // "high": 0.043
129168
+ // }
129169
+ // ],
129170
+ // "usIn": 1711100949273223,
129171
+ // "usOut": 1711100949273580,
129172
+ // "usDiff": 357,
129173
+ // "testnet": false
129174
+ // }
129175
+ //
129176
+ const result = this.safeList(response, 'result', []);
129177
+ const chain = this.safeDict(result, 0, {});
129178
+ return this.parseOption(chain, undefined, market);
129179
+ }
129180
+ async fetchOptionChain(code, params = {}) {
129181
+ /**
129182
+ * @method
129183
+ * @name deribit#fetchOptionChain
129184
+ * @description fetches data for an underlying asset that is commonly found in an option chain
129185
+ * @see https://docs.deribit.com/#public-get_book_summary_by_currency
129186
+ * @param {string} currency base currency to fetch an option chain for
129187
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
129188
+ * @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
129189
+ */
129190
+ await this.loadMarkets();
129191
+ const currency = this.currency(code);
129192
+ const request = {
129193
+ 'currency': currency['id'],
129194
+ 'kind': 'option',
129195
+ };
129196
+ const response = await this.publicGetGetBookSummaryByCurrency(this.extend(request, params));
129197
+ //
129198
+ // {
129199
+ // "jsonrpc": "2.0",
129200
+ // "result": [
129201
+ // {
129202
+ // "mid_price": 0.4075,
129203
+ // "volume_usd": 2836.83,
129204
+ // "quote_currency": "BTC",
129205
+ // "estimated_delivery_price": 65479.26,
129206
+ // "creation_timestamp": 1711101594477,
129207
+ // "base_currency": "BTC",
129208
+ // "underlying_index": "BTC-28JUN24",
129209
+ // "underlying_price": 68827.27,
129210
+ // "volume": 0.1,
129211
+ // "interest_rate": 0.0,
129212
+ // "price_change": 0.0,
129213
+ // "open_interest": 364.1,
129214
+ // "ask_price": 0.411,
129215
+ // "bid_price": 0.404,
129216
+ // "instrument_name": "BTC-28JUN24-42000-C",
129217
+ // "mark_price": 0.40752052,
129218
+ // "last": 0.423,
129219
+ // "low": 0.423,
129220
+ // "high": 0.423
129221
+ // }
129222
+ // ],
129223
+ // "usIn": 1711101594456388,
129224
+ // "usOut": 1711101594484065,
129225
+ // "usDiff": 27677,
129226
+ // "testnet": false
129227
+ // }
129228
+ //
129229
+ const result = this.safeList(response, 'result', []);
129230
+ return this.parseOptionChain(result, 'base_currency', 'instrument_name');
129231
+ }
129232
+ parseOption(chain, currency = undefined, market = undefined) {
129233
+ //
129234
+ // {
129235
+ // "mid_price": 0.04025,
129236
+ // "volume_usd": 11045.12,
129237
+ // "quote_currency": "BTC",
129238
+ // "estimated_delivery_price": 65444.72,
129239
+ // "creation_timestamp": 1711100949273,
129240
+ // "base_currency": "BTC",
129241
+ // "underlying_index": "BTC-27DEC24",
129242
+ // "underlying_price": 73742.14,
129243
+ // "volume": 4.0,
129244
+ // "interest_rate": 0.0,
129245
+ // "price_change": -6.9767,
129246
+ // "open_interest": 274.2,
129247
+ // "ask_price": 0.042,
129248
+ // "bid_price": 0.0385,
129249
+ // "instrument_name": "BTC-27DEC24-240000-C",
129250
+ // "mark_price": 0.04007735,
129251
+ // "last": 0.04,
129252
+ // "low": 0.04,
129253
+ // "high": 0.043
129254
+ // }
129255
+ //
129256
+ const marketId = this.safeString(chain, 'instrument_name');
129257
+ market = this.safeMarket(marketId, market);
129258
+ const currencyId = this.safeString(chain, 'base_currency');
129259
+ const code = this.safeCurrencyCode(currencyId, currency);
129260
+ const timestamp = this.safeInteger(chain, 'timestamp');
129261
+ return {
129262
+ 'info': chain,
129263
+ 'currency': code['code'],
129264
+ 'symbol': market['symbol'],
129265
+ 'timestamp': timestamp,
129266
+ 'datetime': this.iso8601(timestamp),
129267
+ 'impliedVolatility': undefined,
129268
+ 'openInterest': this.safeNumber(chain, 'open_interest'),
129269
+ 'bidPrice': this.safeNumber(chain, 'bid_price'),
129270
+ 'askPrice': this.safeNumber(chain, 'ask_price'),
129271
+ 'midPrice': this.safeNumber(chain, 'mid_price'),
129272
+ 'markPrice': this.safeNumber(chain, 'mark_price'),
129273
+ 'lastPrice': this.safeNumber(chain, 'last'),
129274
+ 'underlyingPrice': this.safeNumber(chain, 'underlying_price'),
129275
+ 'change': undefined,
129276
+ 'percentage': this.safeNumber(chain, 'price_change'),
129277
+ 'baseVolume': this.safeNumber(chain, 'volume'),
129278
+ 'quoteVolume': this.safeNumber(chain, 'volume_usd'),
129279
+ };
129280
+ }
128827
129281
  nonce() {
128828
129282
  return this.milliseconds();
128829
129283
  }
@@ -136093,6 +136547,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
136093
136547
  'fetchOpenInterest': false,
136094
136548
  'fetchOpenInterestHistory': true,
136095
136549
  'fetchOpenOrders': true,
136550
+ 'fetchOption': true,
136551
+ 'fetchOptionChain': true,
136096
136552
  'fetchOrder': true,
136097
136553
  'fetchOrderBook': true,
136098
136554
  'fetchPosition': true,
@@ -140192,8 +140648,17 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
140192
140648
  'account': account,
140193
140649
  };
140194
140650
  if (amount !== undefined) {
140195
- const amountKey = (market['spot']) ? 'amount' : 'size';
140196
- request[amountKey] = this.amountToPrecision(symbol, amount);
140651
+ if (market['spot']) {
140652
+ request['amount'] = this.amountToPrecision(symbol, amount);
140653
+ }
140654
+ else {
140655
+ if (side === 'sell') {
140656
+ request['size'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringNeg(this.amountToPrecision(symbol, amount));
140657
+ }
140658
+ else {
140659
+ request['size'] = this.amountToPrecision(symbol, amount);
140660
+ }
140661
+ }
140197
140662
  }
140198
140663
  if (price !== undefined) {
140199
140664
  request['price'] = this.priceToPrecision(symbol, price);
@@ -140991,8 +141456,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
140991
141456
  */
140992
141457
  await this.loadMarkets();
140993
141458
  const market = (symbol === undefined) ? undefined : this.market(symbol);
140994
- const stop = this.safeValue(params, 'stop');
140995
- params = this.omit(params, 'stop');
141459
+ const stop = this.safeBool2(params, 'stop', 'trigger');
141460
+ params = this.omit(params, ['stop', 'trigger']);
140996
141461
  const [type, query] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
140997
141462
  const [request, requestParams] = (type === 'spot') ? this.multiOrderSpotPrepareRequest(market, stop, query) : this.prepareRequest(market, type, query);
140998
141463
  let response = undefined;
@@ -141320,7 +141785,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
141320
141785
  'unrealizedPnl': this.parseNumber(unrealisedPnl),
141321
141786
  'realizedPnl': this.safeNumber(position, 'realised_pnl'),
141322
141787
  'contracts': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(size)),
141323
- 'contractSize': this.safeValue(market, 'contractSize'),
141788
+ 'contractSize': this.safeNumber(market, 'contractSize'),
141324
141789
  // 'realisedPnl': position['realised_pnl'],
141325
141790
  'marginRatio': undefined,
141326
141791
  'liquidationPrice': this.safeNumber(position, 'liq_price'),
@@ -143154,6 +143619,190 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
143154
143619
  'shortLeverage': leverageValue,
143155
143620
  };
143156
143621
  }
143622
+ async fetchOption(symbol, params = {}) {
143623
+ /**
143624
+ * @method
143625
+ * @name gate#fetchOption
143626
+ * @description fetches option data that is commonly found in an option chain
143627
+ * @see https://www.gate.io/docs/developers/apiv4/en/#query-specified-contract-detail
143628
+ * @param {string} symbol unified market symbol
143629
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
143630
+ * @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
143631
+ */
143632
+ await this.loadMarkets();
143633
+ const market = this.market(symbol);
143634
+ const request = {
143635
+ 'contract': market['id'],
143636
+ };
143637
+ const response = await this.publicOptionsGetContractsContract(this.extend(request, params));
143638
+ //
143639
+ // {
143640
+ // "is_active": true,
143641
+ // "mark_price_round": "0.01",
143642
+ // "settle_fee_rate": "0.00015",
143643
+ // "bid1_size": 30,
143644
+ // "taker_fee_rate": "0.0003",
143645
+ // "price_limit_fee_rate": "0.1",
143646
+ // "order_price_round": "0.1",
143647
+ // "tag": "month",
143648
+ // "ref_rebate_rate": "0",
143649
+ // "name": "ETH_USDT-20240628-4500-C",
143650
+ // "strike_price": "4500",
143651
+ // "ask1_price": "280.5",
143652
+ // "ref_discount_rate": "0",
143653
+ // "order_price_deviate": "0.2",
143654
+ // "ask1_size": -19,
143655
+ // "mark_price_down": "155.45",
143656
+ // "orderbook_id": 11724695,
143657
+ // "is_call": true,
143658
+ // "last_price": "188.7",
143659
+ // "mark_price": "274.26",
143660
+ // "underlying": "ETH_USDT",
143661
+ // "create_time": 1688024882,
143662
+ // "settle_limit_fee_rate": "0.1",
143663
+ // "orders_limit": 10,
143664
+ // "mark_price_up": "403.83",
143665
+ // "position_size": 80,
143666
+ // "order_size_max": 10000,
143667
+ // "position_limit": 100000,
143668
+ // "multiplier": "0.01",
143669
+ // "order_size_min": 1,
143670
+ // "trade_size": 229,
143671
+ // "underlying_price": "3326.6",
143672
+ // "maker_fee_rate": "0.0003",
143673
+ // "expiration_time": 1719561600,
143674
+ // "trade_id": 15,
143675
+ // "bid1_price": "269.3"
143676
+ // }
143677
+ //
143678
+ return this.parseOption(response, undefined, market);
143679
+ }
143680
+ async fetchOptionChain(code, params = {}) {
143681
+ /**
143682
+ * @method
143683
+ * @name gate#fetchOptionChain
143684
+ * @description fetches data for an underlying asset that is commonly found in an option chain
143685
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-the-contracts-with-specified-underlying-and-expiration-time
143686
+ * @param {string} currency base currency to fetch an option chain for
143687
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
143688
+ * @param {string} [params.underlying] the underlying asset, can be obtained from fetchUnderlyingAssets ()
143689
+ * @param {int} [params.expiration] unix timestamp of the expiration time
143690
+ * @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
143691
+ */
143692
+ await this.loadMarkets();
143693
+ const currency = this.currency(code);
143694
+ const request = {
143695
+ 'underlying': currency['code'] + '_USDT',
143696
+ };
143697
+ const response = await this.publicOptionsGetContracts(this.extend(request, params));
143698
+ //
143699
+ // [
143700
+ // {
143701
+ // "is_active": true,
143702
+ // "mark_price_round": "0.1",
143703
+ // "settle_fee_rate": "0.00015",
143704
+ // "bid1_size": 434,
143705
+ // "taker_fee_rate": "0.0003",
143706
+ // "price_limit_fee_rate": "0.1",
143707
+ // "order_price_round": "1",
143708
+ // "tag": "day",
143709
+ // "ref_rebate_rate": "0",
143710
+ // "name": "BTC_USDT-20240324-63500-P",
143711
+ // "strike_price": "63500",
143712
+ // "ask1_price": "387",
143713
+ // "ref_discount_rate": "0",
143714
+ // "order_price_deviate": "0.15",
143715
+ // "ask1_size": -454,
143716
+ // "mark_price_down": "124.3",
143717
+ // "orderbook_id": 29600,
143718
+ // "is_call": false,
143719
+ // "last_price": "0",
143720
+ // "mark_price": "366.6",
143721
+ // "underlying": "BTC_USDT",
143722
+ // "create_time": 1711118829,
143723
+ // "settle_limit_fee_rate": "0.1",
143724
+ // "orders_limit": 10,
143725
+ // "mark_price_up": "630",
143726
+ // "position_size": 0,
143727
+ // "order_size_max": 10000,
143728
+ // "position_limit": 10000,
143729
+ // "multiplier": "0.01",
143730
+ // "order_size_min": 1,
143731
+ // "trade_size": 0,
143732
+ // "underlying_price": "64084.65",
143733
+ // "maker_fee_rate": "0.0003",
143734
+ // "expiration_time": 1711267200,
143735
+ // "trade_id": 0,
143736
+ // "bid1_price": "307"
143737
+ // },
143738
+ // ]
143739
+ //
143740
+ return this.parseOptionChain(response, undefined, 'name');
143741
+ }
143742
+ parseOption(chain, currency = undefined, market = undefined) {
143743
+ //
143744
+ // {
143745
+ // "is_active": true,
143746
+ // "mark_price_round": "0.1",
143747
+ // "settle_fee_rate": "0.00015",
143748
+ // "bid1_size": 434,
143749
+ // "taker_fee_rate": "0.0003",
143750
+ // "price_limit_fee_rate": "0.1",
143751
+ // "order_price_round": "1",
143752
+ // "tag": "day",
143753
+ // "ref_rebate_rate": "0",
143754
+ // "name": "BTC_USDT-20240324-63500-P",
143755
+ // "strike_price": "63500",
143756
+ // "ask1_price": "387",
143757
+ // "ref_discount_rate": "0",
143758
+ // "order_price_deviate": "0.15",
143759
+ // "ask1_size": -454,
143760
+ // "mark_price_down": "124.3",
143761
+ // "orderbook_id": 29600,
143762
+ // "is_call": false,
143763
+ // "last_price": "0",
143764
+ // "mark_price": "366.6",
143765
+ // "underlying": "BTC_USDT",
143766
+ // "create_time": 1711118829,
143767
+ // "settle_limit_fee_rate": "0.1",
143768
+ // "orders_limit": 10,
143769
+ // "mark_price_up": "630",
143770
+ // "position_size": 0,
143771
+ // "order_size_max": 10000,
143772
+ // "position_limit": 10000,
143773
+ // "multiplier": "0.01",
143774
+ // "order_size_min": 1,
143775
+ // "trade_size": 0,
143776
+ // "underlying_price": "64084.65",
143777
+ // "maker_fee_rate": "0.0003",
143778
+ // "expiration_time": 1711267200,
143779
+ // "trade_id": 0,
143780
+ // "bid1_price": "307"
143781
+ // }
143782
+ //
143783
+ const marketId = this.safeString(chain, 'name');
143784
+ market = this.safeMarket(marketId, market);
143785
+ const timestamp = this.safeTimestamp(chain, 'create_time');
143786
+ return {
143787
+ 'info': chain,
143788
+ 'currency': undefined,
143789
+ 'symbol': market['symbol'],
143790
+ 'timestamp': timestamp,
143791
+ 'datetime': this.iso8601(timestamp),
143792
+ 'impliedVolatility': undefined,
143793
+ 'openInterest': undefined,
143794
+ 'bidPrice': this.safeNumber(chain, 'bid1_price'),
143795
+ 'askPrice': this.safeNumber(chain, 'ask1_price'),
143796
+ 'midPrice': undefined,
143797
+ 'markPrice': this.safeNumber(chain, 'mark_price'),
143798
+ 'lastPrice': this.safeNumber(chain, 'last_price'),
143799
+ 'underlyingPrice': this.safeNumber(chain, 'underlying_price'),
143800
+ 'change': undefined,
143801
+ 'percentage': undefined,
143802
+ 'baseVolume': undefined,
143803
+ 'quoteVolume': undefined,
143804
+ };
143805
+ }
143157
143806
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
143158
143807
  if (response === undefined) {
143159
143808
  return undefined;
@@ -162692,6 +163341,8 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162692
163341
  */
162693
163342
  await this.loadMarkets();
162694
163343
  const market = this.market(symbol);
163344
+ const vaultAddress = this.safeString(params, 'vaultAddress');
163345
+ params = this.omit(params, 'vaultAddress');
162695
163346
  symbol = market['symbol'];
162696
163347
  const order = {
162697
163348
  'symbol': symbol,
@@ -162701,7 +163352,11 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162701
163352
  'price': price,
162702
163353
  'params': params,
162703
163354
  };
162704
- const response = await this.createOrders([order], params);
163355
+ const globalParams = {};
163356
+ if (vaultAddress !== undefined) {
163357
+ globalParams['vaultAddress'] = vaultAddress;
163358
+ }
163359
+ const response = await this.createOrders([order], globalParams);
162705
163360
  const first = this.safeDict(response, 0);
162706
163361
  return first;
162707
163362
  }
@@ -162752,7 +163407,6 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162752
163407
  const amount = this.safeString(rawOrder, 'amount');
162753
163408
  const price = this.safeString(rawOrder, 'price');
162754
163409
  let orderParams = this.safeDict(rawOrder, 'params', {});
162755
- orderParams = this.extend(params, orderParams);
162756
163410
  const clientOrderId = this.safeString2(orderParams, 'clientOrderId', 'client_id');
162757
163411
  const slippage = this.safeString(orderParams, 'slippage', defaultSlippage);
162758
163412
  let defaultTimeInForce = (isMarket) ? 'ioc' : 'gtc';
@@ -162800,6 +163454,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162800
163454
  'tif': timeInForce,
162801
163455
  };
162802
163456
  }
163457
+ orderParams = this.omit(orderParams, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id']);
162803
163458
  const orderObj = {
162804
163459
  'a': this.parseToInt(market['baseId']),
162805
163460
  'b': isBuy,
@@ -162812,9 +163467,9 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162812
163467
  if (clientOrderId !== undefined) {
162813
163468
  orderObj['c'] = clientOrderId;
162814
163469
  }
162815
- orderReq.push(orderObj);
163470
+ orderReq.push(this.extend(orderObj, orderParams));
162816
163471
  }
162817
- const vaultAddress = this.safeString(params, 'vaultAddress');
163472
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
162818
163473
  const orderAction = {
162819
163474
  'type': 'order',
162820
163475
  'orders': orderReq,
@@ -162831,6 +163486,10 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162831
163486
  'signature': signature,
162832
163487
  // 'vaultAddress': vaultAddress,
162833
163488
  };
163489
+ if (vaultAddress !== undefined) {
163490
+ params = this.omit(params, 'vaultAddress');
163491
+ request['vaultAddress'] = vaultAddress;
163492
+ }
162834
163493
  const response = await this.privatePostExchange(this.extend(request, params));
162835
163494
  //
162836
163495
  // {
@@ -162923,10 +163582,14 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162923
163582
  }
162924
163583
  }
162925
163584
  cancelAction['cancels'] = cancelReq;
162926
- const vaultAddress = this.safeString(params, 'vaultAddress');
163585
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
162927
163586
  const signature = this.signL1Action(cancelAction, nonce, vaultAddress);
162928
163587
  request['action'] = cancelAction;
162929
163588
  request['signature'] = signature;
163589
+ if (vaultAddress !== undefined) {
163590
+ params = this.omit(params, 'vaultAddress');
163591
+ request['vaultAddress'] = vaultAddress;
163592
+ }
162930
163593
  const response = await this.privatePostExchange(this.extend(request, params));
162931
163594
  //
162932
163595
  // {
@@ -163044,7 +163707,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163044
163707
  'type': 'batchModify',
163045
163708
  'modifies': [modifyReq],
163046
163709
  };
163047
- const vaultAddress = this.safeString(params, 'vaultAddress');
163710
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
163048
163711
  const signature = this.signL1Action(modifyAction, nonce, vaultAddress);
163049
163712
  const request = {
163050
163713
  'action': modifyAction,
@@ -163052,6 +163715,10 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163052
163715
  'signature': signature,
163053
163716
  // 'vaultAddress': vaultAddress,
163054
163717
  };
163718
+ if (vaultAddress !== undefined) {
163719
+ params = this.omit(params, 'vaultAddress');
163720
+ request['vaultAddress'] = vaultAddress;
163721
+ }
163055
163722
  const response = await this.privatePostExchange(this.extend(request, params));
163056
163723
  //
163057
163724
  // {
@@ -163650,7 +164317,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163650
164317
  'isolated': isIsolated,
163651
164318
  'hedged': undefined,
163652
164319
  'side': side,
163653
- 'contracts': this.parseNumber(quantity),
164320
+ 'contracts': this.safeNumber(entry, 'szi'),
163654
164321
  'contractSize': undefined,
163655
164322
  'entryPrice': this.safeNumber(entry, 'entryPx'),
163656
164323
  'markPrice': undefined,
@@ -163697,7 +164364,13 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163697
164364
  'isCross': isCross,
163698
164365
  'leverage': leverage,
163699
164366
  };
163700
- const vaultAddress = this.safeString(params, 'vaultAddress');
164367
+ let vaultAddress = this.safeString(params, 'vaultAddress');
164368
+ if (vaultAddress !== undefined) {
164369
+ params = this.omit(params, 'vaultAddress');
164370
+ if (vaultAddress.startsWith('0x')) {
164371
+ vaultAddress = vaultAddress.replace('0x', '');
164372
+ }
164373
+ }
163701
164374
  const signature = this.signL1Action(updateAction, nonce, vaultAddress);
163702
164375
  const request = {
163703
164376
  'action': updateAction,
@@ -163705,6 +164378,9 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163705
164378
  'signature': signature,
163706
164379
  // 'vaultAddress': vaultAddress,
163707
164380
  };
164381
+ if (vaultAddress !== undefined) {
164382
+ request['vaultAddress'] = vaultAddress;
164383
+ }
163708
164384
  const response = await this.privatePostExchange(this.extend(request, params));
163709
164385
  //
163710
164386
  // {
@@ -163743,7 +164419,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163743
164419
  'isCross': isCross,
163744
164420
  'leverage': leverage,
163745
164421
  };
163746
- const vaultAddress = this.safeString(params, 'vaultAddress');
164422
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
163747
164423
  const signature = this.signL1Action(updateAction, nonce, vaultAddress);
163748
164424
  const request = {
163749
164425
  'action': updateAction,
@@ -163751,6 +164427,10 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163751
164427
  'signature': signature,
163752
164428
  // 'vaultAddress': vaultAddress,
163753
164429
  };
164430
+ if (vaultAddress !== undefined) {
164431
+ params = this.omit(params, 'vaultAddress');
164432
+ request['vaultAddress'] = vaultAddress;
164433
+ }
163754
164434
  const response = await this.privatePostExchange(this.extend(request, params));
163755
164435
  //
163756
164436
  // {
@@ -163803,7 +164483,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163803
164483
  'isBuy': true,
163804
164484
  'ntli': sz,
163805
164485
  };
163806
- const vaultAddress = this.safeString(params, 'vaultAddress');
164486
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
163807
164487
  const signature = this.signL1Action(updateAction, nonce, vaultAddress);
163808
164488
  const request = {
163809
164489
  'action': updateAction,
@@ -163811,6 +164491,10 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163811
164491
  'signature': signature,
163812
164492
  // 'vaultAddress': vaultAddress,
163813
164493
  };
164494
+ if (vaultAddress !== undefined) {
164495
+ params = this.omit(params, 'vaultAddress');
164496
+ request['vaultAddress'] = vaultAddress;
164497
+ }
163814
164498
  const response = await this.privatePostExchange(this.extend(request, params));
163815
164499
  //
163816
164500
  // {
@@ -163909,6 +164593,15 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163909
164593
  const response = await this.privatePostExchange(this.extend(request, params));
163910
164594
  return response;
163911
164595
  }
164596
+ formatVaultAddress(address = undefined) {
164597
+ if (address === undefined) {
164598
+ return undefined;
164599
+ }
164600
+ if (address.startsWith('0x')) {
164601
+ return address.replace('0x', '');
164602
+ }
164603
+ return address;
164604
+ }
163912
164605
  handlePublicAddress(methodName, params) {
163913
164606
  let userAux = undefined;
163914
164607
  [userAux, params] = this.handleOptionAndParams(params, methodName, 'user');
@@ -206518,16 +207211,29 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
206518
207211
  const first = this.safeValue(data, 0, {});
206519
207212
  return this.parseTicker(first, market);
206520
207213
  }
206521
- async fetchTickersByType(type, symbols = undefined, params = {}) {
207214
+ async fetchTickers(symbols = undefined, params = {}) {
207215
+ /**
207216
+ * @method
207217
+ * @name okx#fetchTickers
207218
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
207219
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
207220
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
207221
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
207222
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
207223
+ */
206522
207224
  await this.loadMarkets();
207225
+ symbols = this.marketSymbols(symbols);
207226
+ const market = this.getMarketFromSymbols(symbols);
207227
+ let marketType = undefined;
207228
+ [marketType, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
206523
207229
  const request = {
206524
- 'instType': this.convertToInstrumentType(type),
207230
+ 'instType': this.convertToInstrumentType(marketType),
206525
207231
  };
206526
- if (type === 'option') {
207232
+ if (marketType === 'option') {
206527
207233
  const defaultUnderlying = this.safeValue(this.options, 'defaultUnderlying', 'BTC-USD');
206528
207234
  const currencyId = this.safeString2(params, 'uly', 'marketId', defaultUnderlying);
206529
207235
  if (currencyId === undefined) {
206530
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchTickersByType() requires an underlying uly or marketId parameter for options markets');
207236
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchTickers() requires an underlying uly or marketId parameter for options markets');
206531
207237
  }
206532
207238
  else {
206533
207239
  request['uly'] = currencyId;
@@ -206560,29 +207266,9 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
206560
207266
  // ]
206561
207267
  // }
206562
207268
  //
206563
- const tickers = this.safeValue(response, 'data', []);
207269
+ const tickers = this.safeList(response, 'data', []);
206564
207270
  return this.parseTickers(tickers, symbols);
206565
207271
  }
206566
- async fetchTickers(symbols = undefined, params = {}) {
206567
- /**
206568
- * @method
206569
- * @name okx#fetchTickers
206570
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
206571
- * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
206572
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
206573
- * @param {object} [params] extra parameters specific to the exchange API endpoint
206574
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
206575
- */
206576
- await this.loadMarkets();
206577
- symbols = this.marketSymbols(symbols);
206578
- const first = this.safeString(symbols, 0);
206579
- let market = undefined;
206580
- if (first !== undefined) {
206581
- market = this.market(first);
206582
- }
206583
- const [type, query] = this.handleMarketTypeAndParams('fetchTickers', market, params);
206584
- return await this.fetchTickersByType(type, symbols, query);
206585
- }
206586
207272
  parseTrade(trade, market = undefined) {
206587
207273
  //
206588
207274
  // public fetchTrades
@@ -209400,23 +210086,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
209400
210086
  }
209401
210087
  }
209402
210088
  request['fee'] = this.numberToString(fee); // withdrawals to OKCoin or OKX are fee-free, please set 0
209403
- if ('password' in params) {
209404
- request['pwd'] = params['password'];
209405
- }
209406
- else if ('pwd' in params) {
209407
- request['pwd'] = params['pwd'];
209408
- }
209409
- else {
209410
- const options = this.safeValue(this.options, 'withdraw', {});
209411
- const password = this.safeString2(options, 'password', 'pwd');
209412
- if (password !== undefined) {
209413
- request['pwd'] = password;
209414
- }
209415
- }
209416
- const query = this.omit(params, ['fee', 'password', 'pwd']);
209417
- if (!('pwd' in request)) {
209418
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' withdraw() requires a password parameter or a pwd parameter, it must be the funding password, not the API passphrase');
209419
- }
210089
+ const query = this.omit(params, ['fee']);
209420
210090
  const response = await this.privatePostAssetWithdrawal(this.extend(request, query));
209421
210091
  //
209422
210092
  // {
@@ -226796,7 +227466,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
226796
227466
  'future': 200,
226797
227467
  'delivery': 200,
226798
227468
  },
226799
- 'streamBySubscriptionsHash': {},
227469
+ 'streamBySubscriptionsHash': this.createSafeDictionary(),
226800
227470
  'streamIndex': -1,
226801
227471
  // get updates every 1000ms or 100ms
226802
227472
  // or every 0ms in real-time for futures
@@ -226804,7 +227474,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
226804
227474
  'tradesLimit': 1000,
226805
227475
  'ordersLimit': 1000,
226806
227476
  'OHLCVLimit': 1000,
226807
- 'requestId': {},
227477
+ 'requestId': this.createSafeDictionary(),
226808
227478
  'watchOrderBookLimit': 1000,
226809
227479
  'watchTrades': {
226810
227480
  'name': 'trade', // 'trade' or 'aggTrade'
@@ -226838,14 +227508,14 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
226838
227508
  });
226839
227509
  }
226840
227510
  requestId(url) {
226841
- const options = this.safeValue(this.options, 'requestId', {});
227511
+ const options = this.safeDict(this.options, 'requestId', this.createSafeDictionary());
226842
227512
  const previousValue = this.safeInteger(options, url, 0);
226843
227513
  const newValue = this.sum(previousValue, 1);
226844
227514
  this.options['requestId'][url] = newValue;
226845
227515
  return newValue;
226846
227516
  }
226847
227517
  stream(type, subscriptionHash, numSubscriptions = 1) {
226848
- const streamBySubscriptionsHash = this.safeValue(this.options, 'streamBySubscriptionsHash', {});
227518
+ const streamBySubscriptionsHash = this.safeDict(this.options, 'streamBySubscriptionsHash', this.createSafeDictionary());
226849
227519
  let stream = this.safeString(streamBySubscriptionsHash, subscriptionHash);
226850
227520
  if (stream === undefined) {
226851
227521
  let streamIndex = this.safeInteger(this.options, 'streamIndex', -1);
@@ -226858,7 +227528,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
226858
227528
  this.options['streamBySubscriptionsHash'][subscriptionHash] = stream;
226859
227529
  const subscriptionsByStreams = this.safeValue(this.options, 'numSubscriptionsByStream');
226860
227530
  if (subscriptionsByStreams === undefined) {
226861
- this.options['numSubscriptionsByStream'] = {};
227531
+ this.options['numSubscriptionsByStream'] = this.createSafeDictionary();
226862
227532
  }
226863
227533
  const subscriptionsByStream = this.safeInteger(this.options['numSubscriptionsByStream'], stream, 0);
226864
227534
  const newNumSubscriptions = subscriptionsByStream + numSubscriptions;
@@ -238271,7 +238941,8 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
238271
238941
  },
238272
238942
  },
238273
238943
  };
238274
- this.options = this.extend(defaultOptions, this.options);
238944
+ // this.options = this.extend (defaultOptions, this.options);
238945
+ this.extendExchangeOptions(defaultOptions);
238275
238946
  const originalHeaders = this.options['ws']['options']['headers'];
238276
238947
  const headers = {
238277
238948
  'X-BITOPRO-API': 'ccxt',
@@ -253949,7 +254620,7 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
253949
254620
  const orderbook = await this.helperForWatchMultipleConstruct('orderbook', symbols, params);
253950
254621
  return orderbook.limit();
253951
254622
  }
253952
- async watchBidsAsks(symbols, limit = undefined, params = {}) {
254623
+ async watchBidsAsks(symbols = undefined, params = {}) {
253953
254624
  /**
253954
254625
  * @method
253955
254626
  * @name gemini#watchBidsAsks
@@ -254445,7 +255116,8 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
254445
255116
  },
254446
255117
  },
254447
255118
  };
254448
- this.options = this.extend(defaultOptions, this.options);
255119
+ // this.options = this.extend (defaultOptions, this.options);
255120
+ this.extendExchangeOptions(defaultOptions);
254449
255121
  const originalHeaders = this.options['ws']['options']['headers'];
254450
255122
  const headers = {
254451
255123
  'X-GEMINI-APIKEY': this.apiKey,
@@ -273171,7 +273843,11 @@ class phemex extends _phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
273171
273843
  'watchOrders': true,
273172
273844
  'watchOrderBook': true,
273173
273845
  'watchOHLCV': true,
273174
- 'watchPositions': undefined, // TODO
273846
+ 'watchPositions': undefined,
273847
+ // mutli-endpoints are not supported: https://github.com/ccxt/ccxt/pull/21490
273848
+ 'watchOrderBookForSymbols': false,
273849
+ 'watchTradesForSymbols': false,
273850
+ 'watchOHLCVForSymbols': false,
273175
273851
  },
273176
273852
  'urls': {
273177
273853
  'test': {
@@ -273711,9 +274387,10 @@ class phemex extends _phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
273711
274387
  /**
273712
274388
  * @method
273713
274389
  * @name phemex#watchOrderBook
274390
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-orderbook
273714
274391
  * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-orderbook-for-new-model
273715
274392
  * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-30-levels-orderbook
273716
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-orderbook
274393
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-full-orderbook
273717
274394
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
273718
274395
  * @param {string} symbol unified symbol of the market to fetch the order book for
273719
274396
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -301050,6 +301727,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
301050
301727
  '1m': 'minutes',
301051
301728
  '3m': 'minutes',
301052
301729
  '5m': 'minutes',
301730
+ '10m': 'minutes',
301053
301731
  '15m': 'minutes',
301054
301732
  '30m': 'minutes',
301055
301733
  '1h': 'minutes',
@@ -301079,6 +301757,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
301079
301757
  'candles/minutes/1',
301080
301758
  'candles/minutes/3',
301081
301759
  'candles/minutes/5',
301760
+ 'candles/minutes/10',
301082
301761
  'candles/minutes/15',
301083
301762
  'candles/minutes/30',
301084
301763
  'candles/minutes/60',
@@ -322279,7 +322958,7 @@ SOFTWARE.
322279
322958
 
322280
322959
  //-----------------------------------------------------------------------------
322281
322960
  // this is updated by vss.js when building
322282
- const version = '4.2.79';
322961
+ const version = '4.2.81';
322283
322962
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
322284
322963
  //-----------------------------------------------------------------------------
322285
322964