nautechsystems/nautilus_trader · error
instrument_id is required for historical orders
Error message
instrument_id is required for historical orders
What it means
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.
Source
Thrown at crates/adapters/binance/src/futures/http/client.rs:2785
/// Returns an error if the request fails or parsing fails.
pub async fn request_order_status_reports(
&self,
account_id: AccountId,
instrument_id: Option<InstrumentId>,
open_only: bool,
) -> anyhow::Result<Vec<OrderStatusReport>> {
let symbol = instrument_id.map(|id| format_binance_symbol(&id));
let orders = if open_only {
let params = BinanceOpenOrdersParams {
symbol: symbol.clone(),
recv_window: None,
};
self.inner.query_open_orders(¶ms).await?
} else {
// For historical orders, symbol is required
let symbol = symbol.ok_or_else(|| {
anyhow::anyhow!("instrument_id is required for historical orders")
})?;
let params = BinanceAllOrdersParams {
symbol,
order_id: None,
start_time: None,
end_time: None,
limit: None,
recv_window: None,
};
self.inner.query_all_orders(¶ms).await?
};
let ts_init = self.clock.get_time_ns();
let mut reports = Vec::with_capacity(orders.len());
for order in orders {
let order_instrument_id = instrument_id
.unwrap_or_else(|| format_instrument_id(&order.symbol, self.product_type));View on GitHub (pinned to a4b06ed870)
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
Example fix
// before
let orders = client.request_order_status_reports(None, false, None, None).await?;
// after
let orders = client
.request_order_status_reports(Some(instrument_id), false, None, None)
.await?;
// or, for account-wide current state:
let open = client.request_order_status_reports(None, true, None, None).await?; Defensive patterns
Strategy: validation
Validate before calling
let instrument_id = instrument_id.or_else(|| {
(open_only).then(|| /* last active instrument */ None).flatten()
});
anyhow::ensure!(open_only || instrument_id.is_some(), "historical query needs a symbol"); Try / catch
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.
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- invalid Binance Futures order-book depth; valid values are {
- Invalid venue order ID: {e}
- Cancel algo order failed: code={}, msg={}
- Cancel all orders failed: {}
- Cancel all algo orders failed: {}
AI-assisted analysis of nautechsystems/nautilus_trader@a4b06ed870 (2026-08-16).
Data as JSON: /api/errors/e6ee464a141be75a.
Report an issue: GitHub.