nautechsystems/nautilus_trader · error
instrument_id is required for historical orders
Error message
instrument_id is required for historical orders
What it means
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.
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
Example fix
// before
let orders = client.query_orders(None, None, None).await?;
// after
let orders = client.query_orders(Some(InstrumentId::from("BTCUSDT-PERP.BINANCE")), None, None).await?; Defensive patterns
Strategy: validation
Validate before calling
if instrument_id.is_none() {
return Err(anyhow::anyhow!("historical order queries require an instrument_id"));
} Try / catch
match client.query_orders(instrument_id, venue_order_id, None).await {
Ok(orders) => orders,
Err(e) if e.to_string().contains("instrument_id is required") => {
// prompt caller / fall back to open-orders query
...
}
Err(e) => return Err(e),
} Prevention
- Always supply an InstrumentId for historical (allOrders) queries
- Remember only open-orders queries may omit the instrument
- Iterate instruments explicitly when you need breadth
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Algo order type requires a trigger price
- Ambiguous order-list submit failure, awaiting reconciliation
- Binance does not support
- Binance timestamp is outside the UnixNanos range
- Binance Futures account state request failed
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/e6ee464a141be75a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/adapters/binance/src/futures/http/client.rs:2848
/// 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 18893faf8b)