{"record":{"id":"e6ee464a141be75a","repo":"nautechsystems/nautilus_trader","slug":"instrument-id-is-required-for-historical-orders","errorCode":null,"errorMessage":"instrument_id is required for historical orders","messagePattern":"instrument_id is required for historical orders","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/http/client.rs","lineNumber":2848,"sourceCode":"    /// Returns an error if the request fails or parsing fails.\n    pub async fn request_order_status_reports(\n        &self,\n        account_id: AccountId,\n        instrument_id: Option<InstrumentId>,\n        open_only: bool,\n    ) -> anyhow::Result<Vec<OrderStatusReport>> {\n        let symbol = instrument_id.map(|id| format_binance_symbol(&id));\n\n        let orders = if open_only {\n            let params = BinanceOpenOrdersParams {\n                symbol: symbol.clone(),\n                recv_window: None,\n            };\n            self.inner.query_open_orders(&params).await?\n        } else {\n            // For historical orders, symbol is required\n            let symbol = symbol.ok_or_else(|| {\n                anyhow::anyhow!(\"instrument_id is required for historical orders\")\n            })?;\n            let params = BinanceAllOrdersParams {\n                symbol,\n                order_id: None,\n                start_time: None,\n                end_time: None,\n                limit: None,\n                recv_window: None,\n            };\n            self.inner.query_all_orders(&params).await?\n        };\n\n        let ts_init = self.clock.get_time_ns();\n        let mut reports = Vec::with_capacity(orders.len());\n\n        for order in orders {\n            let order_instrument_id = instrument_id\n                .unwrap_or_else(|| format_instrument_id(&order.symbol, self.product_type));","sourceCodeStart":2830,"sourceCodeEnd":2866,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/futures/http/client.rs#L2830-L2866","documentation":"Binance's allOrders (historical orders) endpoint requires a symbol query parameter, unlike openOrders. The adapter therefore requires an instrument_id to resolve the symbol when querying historical orders, and throws this error when it is not supplied.","triggerScenarios":"Calling the historical orders query (query_orders / all orders) with instrument_id = None, which is allowed for open-orders queries but not for historical ones.","commonSituations":"Reusing a 'list all orders' call pattern that works without an instrument_id on other venues or for open orders on Binance; generic pagination code that omits the instrument.","solutions":["Pass a valid InstrumentId for the symbol you want historical orders for","If you need all historical orders, iterate over the instruments you trade and call once per instrument_id","Only omit instrument_id when querying currently open orders"],"exampleFix":"// before\nlet orders = client.query_orders(None, None, None).await?;\n// after\nlet orders = client.query_orders(Some(InstrumentId::from(\"BTCUSDT-PERP.BINANCE\")), None, None).await?;","handlingStrategy":"validation","validationCode":"if instrument_id.is_none() {\n    return Err(anyhow::anyhow!(\"historical order queries require an instrument_id\"));\n}","typeGuard":null,"tryCatchPattern":"match client.query_orders(instrument_id, venue_order_id, None).await {\n    Ok(orders) => orders,\n    Err(e) if e.to_string().contains(\"instrument_id is required\") => {\n        // prompt caller / fall back to open-orders query\n        ...\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Always supply an InstrumentId for historical (allOrders) queries","Remember only open-orders queries may omit the instrument","Iterate instruments explicitly when you need breadth"],"tags":["binance","required-parameter","historical-orders"],"backgroundTag":"missing-required-argument","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}