nautechsystems/nautilus_trader · error

Architect AX adapter cannot encode quote_quantity; submit a…

Error message

Architect AX adapter cannot encode quote_quantity; submit a base quantity instead

What it means

AX order encoding cannot represent a quote-denominated quantity, so validate_order_instructions rejects any order with quote_quantity = true. The adapter only supports base-asset quantities, and the error tells you to convert to base quantity.

Solutions

  1. Recreate the order with quote_quantity = false and a base-asset quantity
  2. Convert the quote notional to base using the current price before constructing the order
  3. Adjust strategy sizing config to emit base quantities

Example fix

// before
let order = order_factory.market(market_id, OrderSide::Buy, Quantity::from(1000), None, /*quote*/ true);
// after
let base_qty = quote_notional / price; // convert at current price
let order = order_factory.market(market_id, OrderSide::Buy, base_qty, None, false);
Defensive patterns

Strategy: validation

Validate before calling

if order.quote_quantity() {
    let base_qty = quote_notional / instrument.last_price();
    order = build_order(base_qty, /*quote_quantity*/ false);
}

Try / catch

match submit(order).await {
    Err(e) if e.to_string().contains("quote_quantity") => {
        let base = to_base_quantity(order, price)?;
        submit(&base).await
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling submit_order with an order created with quote_quantity = true (e.g. order_factory.market(..., quote_quantity: true)) or a strategy configured to spend a notional amount.

Common situations: Strategies sized in quote currency (e.g. 'buy $1000 of BTC') ported from adapters that support quote_quantity; notional-based risk sizing.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

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

fn validate_order_init_instructions(order_init: &OrderInitialized) -> anyhow::Result<()> {
    validate_order_instructions(
        order_init.reduce_only,
        order_init.quote_quantity,
        order_init.display_qty.is_some(),
    )
}

fn validate_order_instructions(
    reduce_only: bool,
    quote_quantity: bool,
    has_display_qty: bool,
) -> anyhow::Result<()> {
    if reduce_only {
        anyhow::bail!("AX does not support reduce-only orders");
    }

    if quote_quantity {
        anyhow::bail!(
            "Architect AX adapter cannot encode quote_quantity; submit a base quantity instead"
        );
    }

    if has_display_qty {
        anyhow::bail!("Architect AX adapter cannot encode display_qty iceberg instructions");
    }

    Ok(())
}

// The AX HTTP API documents only a bare 400 with no error schema, so no venue
// failure can be allowlisted as an unambiguous rejection; those arrive via the
// orders WS `Rejected` and `CancelRejected` events instead. AX therefore never
// classifies a send failure as `CommandFailure::VenueRejected`.
fn classify_ax_http_failure(error: &AxHttpError) -> CommandFailure {
    let message = error.to_string();
    match error {

View on GitHub (pinned to 18893faf8b)