nautechsystems/nautilus_trader · error

No liquidity available for market order on

Error message

No liquidity available for market order on {instrument_id}

What it means

Raised in `submit_order_internal` when the AX aggressive-limit preview response contains no `limit_price` (the `ok_or_else` on `response.limit_price`). AX could not determine any price at which the market order could fill, meaning there is no liquidity available for the requested order, so the adapter refuses to price and submit the order.

Solutions

  1. Use a LIMIT order with an explicit price instead of a MARKET order when liquidity is thin.
  2. Reduce the order quantity to fit within available book depth (the code already warns on filled/remaining shortfall).
  3. Check the instrument is currently trading (not halted) and within market hours.
  4. Verify the symbol/order book is streaming correctly and the book is not empty due to a feed issue.
  5. Retry later if the book is temporarily empty.

Example fix

// before
let order = OrderFactory::market(instrument_id, OrderSide::Buy, qty);
// after
// use a priced limit order when liquidity may be absent
let order = OrderFactory::limit(instrument_id, OrderSide::Buy, qty, limit_price);
Defensive patterns

Strategy: fallback

Validate before calling

// ensure market data is flowing and book is non-empty before a market order
if best_bid.is_none() || best_ask.is_none() {
    anyhow::bail!("no two-sided book for {instrument_id}; avoid naked market order");
}

Try / catch

match engine.submit_order(market_order) {
    Err(e) if e.to_string().contains("No liquidity available") => {
        // fall back to a priced limit order or reduce size
        log::warn!("no liquidity for market order on {}", market_order.instrument_id());
    }
    other => other?,
}

Prevention

When it happens

Trigger: Submitting a MARKET order on an instrument whose order book is empty or has no actionable liquidity at preview time; the preview returns filled_quantity 0 / remaining_quantity > 0 with `limit_price: None`.

Common situations: Trading a very illiquid or halted instrument; submitting large market orders that exceed available depth; trading outside the venue's market hours when the book is empty; instrument with one-sided book.

Related errors


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

Appendix: source

Thrown at crates/adapters/architect_ax/src/execution.rs:278

                    let response = http_client
                        .inner
                        .preview_aggressive_limit_order(&request)
                        .await
                        .map_err(|e| {
                            anyhow::anyhow!("Failed to preview aggressive limit order: {e}")
                        })?;

                    if response.remaining_quantity > 0 {
                        log::warn!(
                            "Market order book depth insufficient: \
                             filled_qty={} remaining_qty={} for {instrument_id}",
                            response.filled_quantity,
                            response.remaining_quantity,
                        );
                    }

                    let limit_price_decimal = response.limit_price.ok_or_else(|| {
                        anyhow::anyhow!(
                            "No liquidity available for market order on {instrument_id}"
                        )
                    })?;

                    let price =
                        Price::from_decimal_dp(limit_price_decimal, instrument.price_precision())
                            .with_context(|| {
                                format!(
                                    "Failed to convert AX take-through price {limit_price_decimal} for {instrument_id}"
                                )
                            })?;
                    log::debug!("Market order take-through price: {price} for {instrument_id}",);
                    Ok(price)
                }
                .await;

                let price = match preview_result {
                    Ok(price) => price,

View on GitHub (pinned to 18893faf8b)