MCPcopy Index your code
hub / github.com/ccxt/ccxt / fetchOption

Method fetchOption

java/lib/src/main/java/io/github/ccxt/exchanges/OkxCore.java:9589–9632  ·  view source on GitHub ↗

@method @name okx#fetchOption @description fetches option data that is commonly found in an option chain @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker @param {string} symbol unified market symbol @param {object} [params] extra parameters specific to the exchange API

(Object symbol, Object... optionalArgs)

Source from the content-addressed store, hash-verified

9587 * @returns {object} an [option chain structure]{@link https://docs.ccxt.com/?id=option-chain-structure}
9588 */
9589 public java.util.concurrent.CompletableFuture<Object> fetchOption(Object symbol, Object... optionalArgs)
9590 {
9591
9592 return java.util.concurrent.CompletableFuture.supplyAsync(() -> {
9593
9594 Object parameters = Helpers.getArg(optionalArgs, 0, new java.util.HashMap<String, Object>() {{}});
9595 (this.loadMarkets()).join();
9596 Object market = this.market(symbol);
9597 Object request = new java.util.HashMap<String, Object>() {{
9598 put( "instId", Helpers.GetValue(market, "id") );
9599 }};
9600 Object response = (this.publicGetMarketTicker(this.extend(request, parameters))).join();
9601 //
9602 // {
9603 // "code": "0",
9604 // "msg": "",
9605 // "data": [
9606 // {
9607 // "instType": "OPTION",
9608 // "instId": "BTC-USD-241227-60000-P",
9609 // "last": "",
9610 // "lastSz": "0",
9611 // "askPx": "",
9612 // "askSz": "0",
9613 // "bidPx": "",
9614 // "bidSz": "0",
9615 // "open24h": "",
9616 // "high24h": "",
9617 // "low24h": "",
9618 // "volCcy24h": "0",
9619 // "vol24h": "0",
9620 // "ts": "1711176035035",
9621 // "sodUtc0": "",
9622 // "sodUtc8": ""
9623 // }
9624 // ]
9625 // }
9626 //
9627 Object result = this.safeList(response, "data", new java.util.ArrayList<Object>(java.util.Arrays.asList()));
9628 Object chain = this.safeDict(result, 0, new java.util.HashMap<String, Object>() {{}});
9629 return this.parseOption(chain, null, market);
9630 });
9631
9632 }
9633
9634 /**
9635 * @method

Callers

nothing calls this directly

Calls 9

getArgMethod · 0.95
GetValueMethod · 0.95
parseOptionMethod · 0.95
publicGetMarketTickerMethod · 0.65
loadMarketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45
safeListMethod · 0.45
safeDictMethod · 0.45

Tested by

no test coverage detected