{"record":{"id":"cf7d4521b4e63d86","repo":"nautechsystems/nautilus_trader","slug":"no-price-limit-returned-from-okx","errorCode":null,"errorMessage":"No price limit returned from OKX","messagePattern":"No price limit returned from OKX","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/okx/src/http/client.rs","lineNumber":2837,"sourceCode":"    ///\n    /// Returns an error if the HTTP request fails or no price limit is returned.\n    pub async fn request_price_limit(\n        &self,\n        instrument_id: InstrumentId,\n    ) -> anyhow::Result<OKXPriceLimit> {\n        let mut params = GetPriceLimitParamsBuilder::default();\n        params.inst_id(instrument_id.symbol.inner());\n        let params = params.build().map_err(|e| anyhow::anyhow!(e))?;\n\n        let resp = self\n            .inner\n            .get_price_limit(params)\n            .await\n            .map_err(|e| anyhow::anyhow!(e))?;\n\n        resp.first()\n            .cloned()\n            .ok_or_else(|| anyhow::anyhow!(\"No price limit returned from OKX\"))\n    }\n\n    fn option_summary_exp_time(symbol: &str) -> anyhow::Result<Option<String>> {\n        let parts: Vec<&str> = symbol.split('-').collect();\n        anyhow::ensure!(\n            parts.len() >= 5,\n            \"Expected OKX option symbol with expiry, received {symbol}\"\n        );\n        Ok(Some(parts[2].to_string()))\n    }\n\n    /// Requests the latest index price for the `instrument_id` from OKX.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the HTTP request fails or no index price is returned.\n    pub async fn request_index_price(\n        &self,","sourceCodeStart":2819,"sourceCodeEnd":2855,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/okx/src/http/client.rs#L2819-L2855","documentation":"Raised in `request_price_limit` when OKX returns success but an empty data array, meaning no price-limit record exists for the requested instrument. The adapter requires at least one row and converts the empty result into an error.","triggerScenarios":"Calling `request_price_limit` for an instrument that OKX has no price-limit entry for: delisted/expired instrument, spot pair without limit bands, or wrong symbol in configuration.","commonSituations":"Checking price limits for expired options before order placement; misconfigured instrument IDs; querying during OKX maintenance windows when data is temporarily unavailable.","solutions":["Verify the instrument is actively listed on OKX and its ID is spelled correctly.","Treat the missing price limit gracefully in the caller (e.g. skip limit checks or use risk-engine defaults).","Retry after brief backoff if OKX is under maintenance.","Reload instruments from OKX so the cache only holds live instruments."],"exampleFix":"// before\nlet limit = client.request_price_limit(&inst_id).await?;\n// after\nlet limit = match client.request_price_limit(&inst_id).await {\n    Ok(l) => l,\n    Err(e) if e.to_string().contains(\"No price limit returned\") => return Ok(None),\n    Err(e) => return Err(e),\n};","handlingStrategy":"fallback","validationCode":"if !instrument_is_listed_on_okx(&instrument_id) {\n    log::warn!(\"price limit unavailable for delisted {instrument_id}; using risk-engine defaults\");\n    return Ok(None);\n}","typeGuard":null,"tryCatchPattern":"let limit = match client.request_price_limit(&inst_id).await {\n    Ok(l) => Some(l),\n    Err(e) if e.to_string().contains(\"No price limit returned\") => None,\n    Err(e) => return Err(e),\n};","preventionTips":["Fall back to risk-engine default limits when OKX provides none.","Only query price limits for instruments confirmed live in the cache.","Distinguish empty results from transport failures; only retry the latter.","Refresh the instrument cache periodically to drop delisted instruments."],"tags":["not-found","empty-response","okx","market-data"],"backgroundTag":"empty-result-set","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}