{"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":2785,"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":2767,"sourceCodeEnd":2803,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/futures/http/client.rs#L2767-L2803","documentation":"Thrown by the order mass-status method (request_order_status_reports) when open_only is false and instrument_id is None. Binance's /allOrders (historical orders) endpoint requires a symbol parameter, whereas /openOrders can be called account-wide with no symbol; the client mirrors that contract, refusing a symbol-less historical query before making the request.","triggerScenarios":"Calling the method with (None, false) — i.e. asking for all historical orders across all instruments; building a generic 'fetch all my orders' helper that defaults open_only=false; passing the wrong boolean positionally so an intended open-only sweep becomes a historical request.","commonSituations":"End-of-day reconciliation code that wants every fill ever; new users assuming account-wide history is available like on the income/trade-history endpoints; argument-order mixups between start/end/limit and open_only in call sites.","solutions":["Pass an explicit instrument_id when requesting historical (open_only=false) orders","If you truly need account-wide history, loop over each traded instrument and issue one request per symbol","Set open_only=true when you want the symbol-less account-wide open-order snapshot"],"exampleFix":"// before\nlet orders = client.request_order_status_reports(None, false, None, None).await?;\n\n// after\nlet orders = client\n    .request_order_status_reports(Some(instrument_id), false, None, None)\n    .await?;\n// or, for account-wide current state:\nlet open = client.request_order_status_reports(None, true, None, None).await?;","handlingStrategy":"validation","validationCode":"let instrument_id = instrument_id.or_else(|| {\n    (open_only).then(|| /* last active instrument */ None).flatten()\n});\nanyhow::ensure!(open_only || instrument_id.is_some(), \"historical query needs a symbol\");","typeGuard":null,"tryCatchPattern":"Unrecoverable precondition error: catch, log with context on which caller passed (None, false), and fix the call site to pass a symbol or open_only=true.","preventionTips":["Never request account-wide history on futures; loop per-symbol","Make open_only an explicit named argument at call sites","Write a wrapper that refuses (None, false) with a domain-specific message"],"tags":["binance","futures","order-history","validation","rust","nautilustrader"],"backgroundTag":"missing-required-parameter","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}