ccxt 4.2.81 → 4.2.82

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,93 @@
1
+ ## 4.2.80 (2024-03-22)
2
+
3
+ * chore(exchange): marketIds, marketSymbols, marketCodes parameter type (#21761) [d5f1c28cae](https://github.com/ccxt/ccxt/commits/d5f1c28cae693e360ffaf60c8d5672e7cba24849)
4
+ * fix(gate): edit swap sell orders (#21863) [e1d3914ed8](https://github.com/ccxt/ccxt/commits/e1d3914ed8b260627f30f88b92061ff0ceb38216)
5
+ * fix(hyperliquid): position contracts and format vault address (#21868) [3bface52e3](https://github.com/ccxt/ccxt/commits/3bface52e350b4e0343ffe7e3e029a209959dcfa)
6
+ * [ADD] python upbit 10m timeframe (#21869) [b3ff6fe50f](https://github.com/ccxt/ccxt/commits/b3ff6fe50fca9c3c84440cad6730f48977343198)
7
+ * mexc error handling comments [d239a59329](https://github.com/ccxt/ccxt/commits/d239a59329c3e05ac5423d25026b88527ecc750a)
8
+ * deribit: new methods, fetchOption and fetchOptionChain (#21867) [b5bea6497a](https://github.com/ccxt/ccxt/commits/b5bea6497a43e74363cd600cf0d392727407b16a)
9
+ * 4.2.80 [8afc29bb25](https://github.com/ccxt/ccxt/commits/8afc29bb258518e634d4f2bbdc82e48c0f34fa0a)
10
+
11
+
12
+ ## 4.2.79 (2024-03-21)
13
+
14
+ * fix(bitget): ws auth in c# (#21840) [22b7e6e65c](https://github.com/ccxt/ccxt/commits/22b7e6e65c71a19625f5dfc980b4f90ef0ed8b3c)
15
+ * `bitstamp` `fetchBalance` and `parseBalance` update (#21825) [bcdfffd50f](https://github.com/ccxt/ccxt/commits/bcdfffd50fa35ff239d3120d70e4b1851707e1b0)
16
+ * fix(bybit): watchPositions on the closing event (#21841) [a2a5f93bfe](https://github.com/ccxt/ccxt/commits/a2a5f93bfe2d70a3d44f23dc8f12df810a70dfbf)
17
+ * gate: add apis (#21852) [91e0e0866e](https://github.com/ccxt/ccxt/commits/91e0e0866e2bad2b01ed1ea08bfb86295db4d047)
18
+ * feat(bybit): add fetchFundingHistory (#21844) [9f8fc85ab2](https://github.com/ccxt/ccxt/commits/9f8fc85ab21ac8d3a6cc7d23ff128c8d856984f2)
19
+ * feat(bingx): add api to close position by id (#21849) [730535dbab](https://github.com/ccxt/ccxt/commits/730535dbabda2fb1aa3225e461640a929ef711db)
20
+ * Remove usage of deprecated python datetime functions (#21846) [e132357357](https://github.com/ccxt/ccxt/commits/e132357357099e8ee724840ccf0d00ed5fb2fdec)
21
+ * fix(coinbaseinternational): api docs link (#21842) [fc327b9d19](https://github.com/ccxt/ccxt/commits/fc327b9d1918e42db1aaac265ee16f6e0a03a8a8)
22
+ * fix(gate): swap edit order amount (#21859) [87d826245f](https://github.com/ccxt/ccxt/commits/87d826245f345ac56a0b281ee3d3f514af08d995)
23
+ * 4.2.79 [a348b23a09](https://github.com/ccxt/ccxt/commits/a348b23a09d864326157f86637bf22758a81d464)
24
+
25
+
26
+ ## 4.2.78 (2024-03-20)
27
+
28
+ * fix(gateio): add loan endpoint for gateio (#21822) [316877858f](https://github.com/ccxt/ccxt/commits/316877858fa6271011991fc4235dde9d15122cf0)
29
+ * fix(coinbase): protect fetchLedger (#21821) [7d0e269080](https://github.com/ccxt/ccxt/commits/7d0e269080bb01b4aed08b91995fbca11232833f)
30
+ * okx: update error code & withdraw status code (#21829) [4c91a6f41a](https://github.com/ccxt/ccxt/commits/4c91a6f41abfe3730e1b498a0f91030f3472934e)
31
+ * fix(coinbase): allow params in fetchAccountId (#21827) [8fb8aaccae](https://github.com/ccxt/ccxt/commits/8fb8aaccae64d658bdfd0c3776f586532e641620)
32
+ * fix(hyperliquid): omit timeInForce (#21826) [58bef456c0](https://github.com/ccxt/ccxt/commits/58bef456c0ea1c8da84a19e10af34843efb6f2fc)
33
+ * okcoin: update errorcode (#21833) [0fdd0c2b67](https://github.com/ccxt/ccxt/commits/0fdd0c2b679e097cc5ed2eb76ca0772951984ce8)
34
+ * kucoin: update errorcode (#21832) [5d9c021b5f](https://github.com/ccxt/ccxt/commits/5d9c021b5f8103d43f62bf6d6254c5a47e10821b)
35
+ * feat(woo): add fetchOpenOrders and fetchClosedOrders (#21835) [70ba9aaeda](https://github.com/ccxt/ccxt/commits/70ba9aaeda83147f69b793807e23baa0b2d2cd1b)
36
+ * fix(cs): make this.clients threadSafe (#21838) [35d3cad8eb](https://github.com/ccxt/ccxt/commits/35d3cad8ebe9d9450f5b73b253bc53ceccc79640)
37
+ * fix(bybit): add maxNotional in fetchLeverageTiers (#21828) [40bc877975](https://github.com/ccxt/ccxt/commits/40bc87797522b19271be7bce64c45cc303ff3bbe)
38
+ * 4.2.78 [c581613a52](https://github.com/ccxt/ccxt/commits/c581613a5204c360b1307b50abff57f8a014c415)
39
+
40
+
41
+ ## 4.2.77 (2024-03-19)
42
+
43
+ * fix(blofin): add tpsl to cancelOrder (#21786) [e5c97aa3c5](https://github.com/ccxt/ccxt/commits/e5c97aa3c5b4507425be4d2cf2724c537615aae8)
44
+ * chore: added types to safeMarket header (#21579) [fab83a86de](https://github.com/ccxt/ccxt/commits/fab83a86de079a80f0601f68fcfd3cd65796458c)
45
+ * fix(test): remove php warnings from idTests (#21788) [d8325cfa0f](https://github.com/ccxt/ccxt/commits/d8325cfa0f1ec72f48fc7d69acc5f968aaf3e847)
46
+ * bybit: fetchMyTrades, execType (#21801) [0532234266](https://github.com/ccxt/ccxt/commits/0532234266f653f0a31329386ed463f7bbeb935d)
47
+ * Bingx parse status FAILED as canceled (#21796) [f3b41ac22b](https://github.com/ccxt/ccxt/commits/f3b41ac22bcc8edbb418f2e2245c6824d1bf38eb)
48
+ * kucoin: add fetchBorrowRateHistory & fetchBorrowRateHistories (#21802) [7b60cd0b44](https://github.com/ccxt/ccxt/commits/7b60cd0b445f85aa85fde79883685e4e34323b88)
49
+ * remove extra empty lines from stderr (#21806) [367f02869e](https://github.com/ccxt/ccxt/commits/367f02869e0aa893cb77b464cbc1ca0894c19c44)
50
+ * fix(cs): authentication flow in ws (#21793) [9bb601ecc2](https://github.com/ccxt/ccxt/commits/9bb601ecc22486a8561361cd9d88c37e7c2d168d)
51
+ * bybit: createOrder, add alternative endpoint support (#21799) [6544937711](https://github.com/ccxt/ccxt/commits/654493771199f9f84422af74b11e96bc6129edc1)
52
+ * chore(exchange): convertTradingViewToOHLCV, convertOHLCVToTradingView parameter type (#21758) [d2fee03dc0](https://github.com/ccxt/ccxt/commits/d2fee03dc0f6dc29d5099fd6b2d03d55f7511b07)
53
+ * chore(exchange): isRoundNumber parameter type (#21757) [7ddc5902dc](https://github.com/ccxt/ccxt/commits/7ddc5902dcd842c1375dc0b1b76835976e57875a)
54
+ * fix(kraken): update docstring @see links (#21810) [318e6c5ef1](https://github.com/ccxt/ccxt/commits/318e6c5ef135707454807b82c6b611a75c0e5ba0)
55
+ * `delta.ts` `marketsByNumericId` and `currenciesByNumericId` update (#21794) [ff1a077e2e](https://github.com/ccxt/ccxt/commits/ff1a077e2ebfc57130f423cb30629693352cb7c8)
56
+ * fix(delta): parseLedgerEntry fix (#21815) [030b135b8b](https://github.com/ccxt/ccxt/commits/030b135b8b440e5a500470bf341708f0ba656eb1)
57
+ * fix(types): handle list info on trade (#21814) [7003616664](https://github.com/ccxt/ccxt/commits/7003616664851201446f87c2a58403e26cc8ae67)
58
+ * fix(coinbase): increase pagination maxEntriesPerRequest (#21816) [73ada1ff4c](https://github.com/ccxt/ccxt/commits/73ada1ff4ca295f07bd1e7eec0550482b96d2d69)
59
+ * 4.2.77 [629627af68](https://github.com/ccxt/ccxt/commits/629627af6803b7ec8128022edaab2195bc543ada)
60
+
61
+
62
+ ## 4.2.76 (2024-03-18)
63
+
64
+ * coinbaseinternational exchange title capitalized [c4adb62474](https://github.com/ccxt/ccxt/commits/c4adb624743f2b11951e375aae2c63bd586a7b5a)
65
+ * coinbaseinternational exchange title capitalized [6c74bbfd60](https://github.com/ccxt/ccxt/commits/6c74bbfd60dd3b1294eaacad1ae3fae73d854893)
66
+ * bingx: minor update (#21772) [6d7b4c59af](https://github.com/ccxt/ccxt/commits/6d7b4c59af3d8190b5fe43938b060b872b0cd325)
67
+ * fix(coinbaseinternational): rename errors to exceptions (#21779) [47e3525a67](https://github.com/ccxt/ccxt/commits/47e3525a67762646cdcab48d4e295a066482e152)
68
+ * binance: add apis (#21771) [cb1d2c2408](https://github.com/ccxt/ccxt/commits/cb1d2c2408281ee37a7f53c35cb51017834da0ec)
69
+ * feat(coinbase): add pagination in fetchLedger (#21769) [9eeab3ddb2](https://github.com/ccxt/ccxt/commits/9eeab3ddb29841dc3b6d94cdbc502eca25a63961)
70
+ * bybit: update doc (#21775) [7a4a3bedd1](https://github.com/ccxt/ccxt/commits/7a4a3bedd1030064343d5f4fd49451e7efa1ff25)
71
+ * gate: update doc (#21776) [61a335ed5f](https://github.com/ccxt/ccxt/commits/61a335ed5f3769832be958bc6ae9387fc4e01383)
72
+ * htx: update doc (#21777) [429aad9ecf](https://github.com/ccxt/ccxt/commits/429aad9ecf7ba4b79af4352d0053a43fbfa3f9f6)
73
+ * binance: update doc (#21778) [eb53b3f77b](https://github.com/ccxt/ccxt/commits/eb53b3f77b3feffb96aedffc6548ddaefa23fc93)
74
+ * fix(bybit): infer trade symbol correctly (#21781) [4311df78d1](https://github.com/ccxt/ccxt/commits/4311df78d17e2b657b91e20468724ac8491180ff)
75
+ * 4.2.76 [97fd954eef](https://github.com/ccxt/ccxt/commits/97fd954eef223c3d61c87e11b81cb2f73d1faa0b)
76
+
77
+
78
+ ## 4.2.75 (2024-03-17)
79
+
80
+ * ascendex: edit fetchPositions (#21749) [d1420eb5c0](https://github.com/ccxt/ccxt/commits/d1420eb5c0125ca56b729e46b840b3e3d07e4dfb)
81
+ * CLI.md: added some useful examples (#21750) [f0f8c09dd8](https://github.com/ccxt/ccxt/commits/f0f8c09dd82adda071dda9fda39acff7847f8475)
82
+ * coinex: update documentation links (#21751) [a066b72157](https://github.com/ccxt/ccxt/commits/a066b721573d96f1f15f04a85de5f7d2687a5eae)
83
+ * gate: Add order type mapping for finish orders (#21765) [a7f9a99deb](https://github.com/ccxt/ccxt/commits/a7f9a99deb3ea987e0ccae9a7d7c7731811a2ca0)
84
+ * chore: update changelog (#21766) [2f52e67538](https://github.com/ccxt/ccxt/commits/2f52e675383d1b84d960f3e33d377c676db67018)
85
+ * chore: added type AccountStructure to be returned by fetchAccounts (#21708) [8417abb788](https://github.com/ccxt/ccxt/commits/8417abb78829f16f8c178681953cce72dd3d0b0e)
86
+ * feat(tradeogre): add exchange (#21767) [b811455d11](https://github.com/ccxt/ccxt/commits/b811455d11fa1d0a08dde199ba2b5c5099c996c6)
87
+ * kucoin error code 400100 InsufficientFunds [66ff9026f0](https://github.com/ccxt/ccxt/commits/66ff9026f050386f4eca5855870b69b384c9b12c)
88
+ * 4.2.75 [31a135004d](https://github.com/ccxt/ccxt/commits/31a135004da94f062e5df538b83cca813c720505)
89
+
90
+
1
91
  ## 4.2.74 (2024-03-15)
2
92
 
3
93
  * feat(Exchange) make Str type export (#21734) [e96637c76b](https://github.com/ccxt/ccxt/commits/e96637c76be50115842cfadac8df8f25bf6ae1a1)
package/README.md CHANGED
@@ -213,13 +213,13 @@ console.log(version, Object.keys(exchanges));
213
213
 
214
214
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
215
215
 
216
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.81/dist/ccxt.browser.js
217
- * unpkg: https://unpkg.com/ccxt@4.2.81/dist/ccxt.browser.js
216
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.82/dist/ccxt.browser.js
217
+ * unpkg: https://unpkg.com/ccxt@4.2.82/dist/ccxt.browser.js
218
218
 
219
219
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
220
220
 
221
221
  ```HTML
222
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.81/dist/ccxt.browser.js"></script>
222
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.82/dist/ccxt.browser.js"></script>
223
223
  ```
224
224
 
225
225
  Creates a global `ccxt` object:
@@ -122349,6 +122349,8 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
122349
122349
  'fetchOHLCV': true,
122350
122350
  'fetchOpenInterest': true,
122351
122351
  'fetchOpenOrders': true,
122352
+ 'fetchOption': true,
122353
+ 'fetchOptionChain': false,
122352
122354
  'fetchOrderBook': true,
122353
122355
  'fetchPosition': true,
122354
122356
  'fetchPositionMode': false,
@@ -125600,6 +125602,151 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
125600
125602
  'marginMode': this.safeString(marginMode, 'margin_mode'),
125601
125603
  };
125602
125604
  }
125605
+ async fetchOption(symbol, params = {}) {
125606
+ /**
125607
+ * @method
125608
+ * @name delta#fetchOption
125609
+ * @description fetches option data that is commonly found in an option chain
125610
+ * @see https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
125611
+ * @param {string} symbol unified market symbol
125612
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
125613
+ * @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
125614
+ */
125615
+ await this.loadMarkets();
125616
+ const market = this.market(symbol);
125617
+ const request = {
125618
+ 'symbol': market['id'],
125619
+ };
125620
+ const response = await this.publicGetTickersSymbol(this.extend(request, params));
125621
+ //
125622
+ // {
125623
+ // "result": {
125624
+ // "close": 6793.0,
125625
+ // "contract_type": "call_options",
125626
+ // "greeks": {
125627
+ // "delta": "0.94739174",
125628
+ // "gamma": "0.00002206",
125629
+ // "rho": "11.00890725",
125630
+ // "spot": "36839.58124652",
125631
+ // "theta": "-18.18365310",
125632
+ // "vega": "7.85209698"
125633
+ // },
125634
+ // "high": 7556.0,
125635
+ // "low": 6793.0,
125636
+ // "mark_price": "6955.70698909",
125637
+ // "mark_vol": "0.66916863",
125638
+ // "oi": "1.8980",
125639
+ // "oi_change_usd_6h": "110.4600",
125640
+ // "oi_contracts": "1898",
125641
+ // "oi_value": "1.8980",
125642
+ // "oi_value_symbol": "BTC",
125643
+ // "oi_value_usd": "69940.7319",
125644
+ // "open": 7.2e3,
125645
+ // "price_band": {
125646
+ // "lower_limit": "5533.89814767",
125647
+ // "upper_limit": "11691.37688371"
125648
+ // },
125649
+ // "product_id": 129508,
125650
+ // "quotes": {
125651
+ // "ask_iv": "0.90180438",
125652
+ // "ask_size": "1898",
125653
+ // "best_ask": "7210",
125654
+ // "best_bid": "6913",
125655
+ // "bid_iv": "0.60881706",
125656
+ // "bid_size": "3163",
125657
+ // "impact_mid_price": null,
125658
+ // "mark_iv": "0.66973549"
125659
+ // },
125660
+ // "size": 5,
125661
+ // "spot_price": "36839.58153868",
125662
+ // "strike_price": "30000",
125663
+ // "symbol": "C-BTC-30000-241123",
125664
+ // "timestamp": 1699584998504530,
125665
+ // "turnover": 184.41206804,
125666
+ // "turnover_symbol": "USDT",
125667
+ // "turnover_usd": 184.41206804,
125668
+ // "volume": 0.005
125669
+ // },
125670
+ // "success": true
125671
+ // }
125672
+ //
125673
+ const result = this.safeDict(response, 'result', {});
125674
+ return this.parseOption(result, undefined, market);
125675
+ }
125676
+ parseOption(chain, currency = undefined, market = undefined) {
125677
+ //
125678
+ // {
125679
+ // "close": 6793.0,
125680
+ // "contract_type": "call_options",
125681
+ // "greeks": {
125682
+ // "delta": "0.94739174",
125683
+ // "gamma": "0.00002206",
125684
+ // "rho": "11.00890725",
125685
+ // "spot": "36839.58124652",
125686
+ // "theta": "-18.18365310",
125687
+ // "vega": "7.85209698"
125688
+ // },
125689
+ // "high": 7556.0,
125690
+ // "low": 6793.0,
125691
+ // "mark_price": "6955.70698909",
125692
+ // "mark_vol": "0.66916863",
125693
+ // "oi": "1.8980",
125694
+ // "oi_change_usd_6h": "110.4600",
125695
+ // "oi_contracts": "1898",
125696
+ // "oi_value": "1.8980",
125697
+ // "oi_value_symbol": "BTC",
125698
+ // "oi_value_usd": "69940.7319",
125699
+ // "open": 7.2e3,
125700
+ // "price_band": {
125701
+ // "lower_limit": "5533.89814767",
125702
+ // "upper_limit": "11691.37688371"
125703
+ // },
125704
+ // "product_id": 129508,
125705
+ // "quotes": {
125706
+ // "ask_iv": "0.90180438",
125707
+ // "ask_size": "1898",
125708
+ // "best_ask": "7210",
125709
+ // "best_bid": "6913",
125710
+ // "bid_iv": "0.60881706",
125711
+ // "bid_size": "3163",
125712
+ // "impact_mid_price": null,
125713
+ // "mark_iv": "0.66973549"
125714
+ // },
125715
+ // "size": 5,
125716
+ // "spot_price": "36839.58153868",
125717
+ // "strike_price": "30000",
125718
+ // "symbol": "C-BTC-30000-241123",
125719
+ // "timestamp": 1699584998504530,
125720
+ // "turnover": 184.41206804,
125721
+ // "turnover_symbol": "USDT",
125722
+ // "turnover_usd": 184.41206804,
125723
+ // "volume": 0.005
125724
+ // }
125725
+ //
125726
+ const marketId = this.safeString(chain, 'symbol');
125727
+ market = this.safeMarket(marketId, market);
125728
+ const quotes = this.safeDict(chain, 'quotes', {});
125729
+ const timestamp = this.safeIntegerProduct(chain, 'timestamp', 0.001);
125730
+ return {
125731
+ 'info': chain,
125732
+ 'currency': undefined,
125733
+ 'symbol': market['symbol'],
125734
+ 'timestamp': timestamp,
125735
+ 'datetime': this.iso8601(timestamp),
125736
+ 'impliedVolatility': this.safeNumber(quotes, 'mark_iv'),
125737
+ 'openInterest': this.safeNumber(chain, 'oi'),
125738
+ 'bidPrice': this.safeNumber(quotes, 'best_bid'),
125739
+ 'askPrice': this.safeNumber(quotes, 'best_ask'),
125740
+ 'midPrice': this.safeNumber(quotes, 'impact_mid_price'),
125741
+ 'markPrice': this.safeNumber(chain, 'mark_price'),
125742
+ 'lastPrice': undefined,
125743
+ 'underlyingPrice': this.safeNumber(chain, 'spot_price'),
125744
+ 'change': undefined,
125745
+ 'percentage': undefined,
125746
+ 'baseVolume': this.safeNumber(chain, 'volume'),
125747
+ 'quoteVolume': undefined,
125748
+ };
125749
+ }
125603
125750
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
125604
125751
  const requestPath = '/' + this.version + '/' + this.implodeParams(path, params);
125605
125752
  let url = this.urls['api'][api] + requestPath;
@@ -129260,7 +129407,7 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
129260
129407
  const timestamp = this.safeInteger(chain, 'timestamp');
129261
129408
  return {
129262
129409
  'info': chain,
129263
- 'currency': code['code'],
129410
+ 'currency': code,
129264
129411
  'symbol': market['symbol'],
129265
129412
  'timestamp': timestamp,
129266
129413
  'datetime': this.iso8601(timestamp),
@@ -162617,7 +162764,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162617
162764
  'createMarketSellOrderWithCost': false,
162618
162765
  'createOrder': true,
162619
162766
  'createOrders': true,
162620
- 'createReduceOnlyOrder': false,
162767
+ 'createReduceOnlyOrder': true,
162621
162768
  'editOrder': true,
162622
162769
  'fetchAccounts': false,
162623
162770
  'fetchBalance': true,
@@ -163454,7 +163601,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
163454
163601
  'tif': timeInForce,
163455
163602
  };
163456
163603
  }
163457
- orderParams = this.omit(orderParams, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id']);
163604
+ orderParams = this.omit(orderParams, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id', 'reduceOnly', 'postOnly']);
163458
163605
  const orderObj = {
163459
163606
  'a': this.parseToInt(market['baseId']),
163460
163607
  'b': isBuy,
@@ -164607,10 +164754,10 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
164607
164754
  [userAux, params] = this.handleOptionAndParams(params, methodName, 'user');
164608
164755
  let user = userAux;
164609
164756
  [user, params] = this.handleOptionAndParams(params, methodName, 'address', userAux);
164610
- if (user !== undefined) {
164757
+ if ((user !== undefined) && (user !== '')) {
164611
164758
  return [user, params];
164612
164759
  }
164613
- if (this.walletAddress !== undefined) {
164760
+ if ((this.walletAddress !== undefined) && (this.walletAddress !== '')) {
164614
164761
  return [this.walletAddress, params];
164615
164762
  }
164616
164763
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' ' + methodName + '() requires a user parameter inside \'params\' or the wallet address set');
@@ -205450,6 +205597,8 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
205450
205597
  'fetchOpenInterestHistory': true,
205451
205598
  'fetchOpenOrder': undefined,
205452
205599
  'fetchOpenOrders': true,
205600
+ 'fetchOption': true,
205601
+ 'fetchOptionChain': true,
205453
205602
  'fetchOrder': true,
205454
205603
  'fetchOrderBook': true,
205455
205604
  'fetchOrderBooks': false,
@@ -212766,6 +212915,143 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
212766
212915
  const order = this.safeValue(data, 0);
212767
212916
  return this.parseOrder(order, market);
212768
212917
  }
212918
+ async fetchOption(symbol, params = {}) {
212919
+ /**
212920
+ * @method
212921
+ * @name okx#fetchOption
212922
+ * @description fetches option data that is commonly found in an option chain
212923
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker
212924
+ * @param {string} symbol unified market symbol
212925
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
212926
+ * @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
212927
+ */
212928
+ await this.loadMarkets();
212929
+ const market = this.market(symbol);
212930
+ const request = {
212931
+ 'instId': market['id'],
212932
+ };
212933
+ const response = await this.publicGetMarketTicker(this.extend(request, params));
212934
+ //
212935
+ // {
212936
+ // "code": "0",
212937
+ // "msg": "",
212938
+ // "data": [
212939
+ // {
212940
+ // "instType": "OPTION",
212941
+ // "instId": "BTC-USD-241227-60000-P",
212942
+ // "last": "",
212943
+ // "lastSz": "0",
212944
+ // "askPx": "",
212945
+ // "askSz": "0",
212946
+ // "bidPx": "",
212947
+ // "bidSz": "0",
212948
+ // "open24h": "",
212949
+ // "high24h": "",
212950
+ // "low24h": "",
212951
+ // "volCcy24h": "0",
212952
+ // "vol24h": "0",
212953
+ // "ts": "1711176035035",
212954
+ // "sodUtc0": "",
212955
+ // "sodUtc8": ""
212956
+ // }
212957
+ // ]
212958
+ // }
212959
+ //
212960
+ const result = this.safeList(response, 'data', []);
212961
+ const chain = this.safeDict(result, 0, {});
212962
+ return this.parseOption(chain, undefined, market);
212963
+ }
212964
+ async fetchOptionChain(code, params = {}) {
212965
+ /**
212966
+ * @method
212967
+ * @name okx#fetchOptionChain
212968
+ * @description fetches data for an underlying asset that is commonly found in an option chain
212969
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
212970
+ * @param {string} currency base currency to fetch an option chain for
212971
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
212972
+ * @param {string} [params.uly] the underlying asset, can be obtained from fetchUnderlyingAssets ()
212973
+ * @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
212974
+ */
212975
+ await this.loadMarkets();
212976
+ const currency = this.currency(code);
212977
+ const request = {
212978
+ 'uly': currency['code'] + '-USD',
212979
+ 'instType': 'OPTION',
212980
+ };
212981
+ const response = await this.publicGetMarketTickers(this.extend(request, params));
212982
+ //
212983
+ // {
212984
+ // "code": "0",
212985
+ // "msg": "",
212986
+ // "data": [
212987
+ // {
212988
+ // "instType": "OPTION",
212989
+ // "instId": "BTC-USD-240323-52000-C",
212990
+ // "last": "",
212991
+ // "lastSz": "0",
212992
+ // "askPx": "",
212993
+ // "askSz": "0",
212994
+ // "bidPx": "",
212995
+ // "bidSz": "0",
212996
+ // "open24h": "",
212997
+ // "high24h": "",
212998
+ // "low24h": "",
212999
+ // "volCcy24h": "0",
213000
+ // "vol24h": "0",
213001
+ // "ts": "1711176207008",
213002
+ // "sodUtc0": "",
213003
+ // "sodUtc8": ""
213004
+ // },
213005
+ // ]
213006
+ // }
213007
+ //
213008
+ const result = this.safeList(response, 'data', []);
213009
+ return this.parseOptionChain(result, undefined, 'instId');
213010
+ }
213011
+ parseOption(chain, currency = undefined, market = undefined) {
213012
+ //
213013
+ // {
213014
+ // "instType": "OPTION",
213015
+ // "instId": "BTC-USD-241227-60000-P",
213016
+ // "last": "",
213017
+ // "lastSz": "0",
213018
+ // "askPx": "",
213019
+ // "askSz": "0",
213020
+ // "bidPx": "",
213021
+ // "bidSz": "0",
213022
+ // "open24h": "",
213023
+ // "high24h": "",
213024
+ // "low24h": "",
213025
+ // "volCcy24h": "0",
213026
+ // "vol24h": "0",
213027
+ // "ts": "1711176035035",
213028
+ // "sodUtc0": "",
213029
+ // "sodUtc8": ""
213030
+ // }
213031
+ //
213032
+ const marketId = this.safeString(chain, 'instId');
213033
+ market = this.safeMarket(marketId, market);
213034
+ const timestamp = this.safeInteger(chain, 'ts');
213035
+ return {
213036
+ 'info': chain,
213037
+ 'currency': undefined,
213038
+ 'symbol': market['symbol'],
213039
+ 'timestamp': timestamp,
213040
+ 'datetime': this.iso8601(timestamp),
213041
+ 'impliedVolatility': undefined,
213042
+ 'openInterest': undefined,
213043
+ 'bidPrice': this.safeNumber(chain, 'bidPx'),
213044
+ 'askPrice': this.safeNumber(chain, 'askPx'),
213045
+ 'midPrice': undefined,
213046
+ 'markPrice': undefined,
213047
+ 'lastPrice': this.safeNumber(chain, 'last'),
213048
+ 'underlyingPrice': undefined,
213049
+ 'change': undefined,
213050
+ 'percentage': undefined,
213051
+ 'baseVolume': this.safeNumber(chain, 'volCcy24h'),
213052
+ 'quoteVolume': undefined,
213053
+ };
213054
+ }
212769
213055
  handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
212770
213056
  if (!response) {
212771
213057
  return undefined; // fallback to default error handler
@@ -322958,7 +323244,7 @@ SOFTWARE.
322958
323244
 
322959
323245
  //-----------------------------------------------------------------------------
322960
323246
  // this is updated by vss.js when building
322961
- const version = '4.2.81';
323247
+ const version = '4.2.82';
322962
323248
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
322963
323249
  //-----------------------------------------------------------------------------
322964
323250