nautechsystems/nautilus_trader · error

instrument_id is required when open_only=false

Error message

instrument_id is required when open_only=false

What it means

The query_orders method supports two modes: open_only=true queries open orders across all symbols, while open_only=false requires a specific symbol to call Binance's all_orders endpoint. When open_only=false and no instrument_id (hence no symbol) was supplied, the adapter rejects the call with this error rather than sending a request Binance would reject.

Source

Thrown at crates/adapters/binance/src/spot/http/client.rs:3228

        &self,
        account_id: AccountId,
        instrument_id: Option<InstrumentId>,
        start: Option<Timestamp>,
        end: Option<Timestamp>,
        open_only: bool,
        limit: Option<u32>,
    ) -> anyhow::Result<Vec<OrderStatusReport>> {
        let ts_init = self.generate_ts_init();
        let symbol = instrument_id.map(|id| id.symbol.to_string());

        let orders = if open_only {
            self.inner
                .open_orders(symbol.as_deref())
                .await
                .map_err(|e| anyhow::anyhow!(e))?
        } else {
            let symbol = symbol
                .ok_or_else(|| anyhow::anyhow!("instrument_id is required when open_only=false"))?;
            self.inner
                .all_orders(
                    &symbol,
                    start.map(|dt| dt.as_millisecond()),
                    end.map(|dt| dt.as_millisecond()),
                    limit,
                )
                .await
                .map_err(|e| anyhow::anyhow!(e))?
        };

        orders
            .iter()
            .map(|order| {
                let symbol = Ustr::from(&order.symbol);
                let instrument = self.instrument_from_cache(symbol)?;
                parse_order_status_report_sbe(
                    order,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Pass a valid InstrumentId whose symbol resolves to a Binance symbol (e.g. InstrumentId::from("BTCUSDT.BINANCE")) when open_only=false.
  2. Set open_only=true if you actually want open orders for all symbols without a symbol filter.
  3. Verify the instrument_id is registered in the adapter's instrument cache so its symbol converts to a valid string.

Example fix

// before
client.query_orders(None, None, None, None, Some(false), None).await?;
// after
let instrument_id = InstrumentId::from("BTCUSDT.BINANCE");
client.query_orders(Some(instrument_id), None, None, None, Some(false), None).await?;
Defensive patterns

Strategy: validation

Validate before calling

fn ensure_symbol_for_query(instrument_id: Option<InstrumentId>, open_only: bool) -> Result<(), String> {
    if !open_only && instrument_id.is_none() {
        return Err("instrument_id is required when open_only=false".into());
    }
    Ok(())
}

Try / catch

match client.query_orders(instrument_id, None, None, None, Some(open_only), None).await {
    Ok(orders) => orders,
    Err(e) if e.to_string().contains("instrument_id is required") => {
        eprintln!("supply an InstrumentId like BTCUSDT.BINANCE when open_only=false");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling query_orders(instrument_id=None, open_only=False, ...) — the symbol extracted from instrument_id is None, hitting the ok_or_else guard at client.rs:3228.

Common situations: Requesting full order history without specifying which instrument; passing an empty/placeholder InstrumentId that serializes to no usable symbol; a caller that historically used open-only mode switched to open_only=false without adding the instrument_id argument.

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


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/996305492b675e90. Report an issue: GitHub.