nautechsystems/nautilus_trader · error

Architect AX adapter cannot encode display_qty iceberg…

Error message

Architect AX adapter cannot encode display_qty iceberg instructions

What it means

AX cannot encode iceberg-style display_qty instructions, so the adapter rejects any order that has a display_qty set. The flag is checked in validate_order_instructions to prevent silently dropping the iceberg behavior.

Solutions

  1. Submit the order without display_qty (set it to None)
  2. Implement iceberg slicing locally: submit child orders of display-size and resubmit on fills
  3. If iceberg execution is essential, use a different venue/adapter that supports it

Example fix

// before
let order = order_factory.limit(market_id, OrderSide::Buy, total_qty, price, TimeInForce::Gtc, None).with_display_qty(disp);
// after
let order = order_factory.limit(market_id, OrderSide::Buy, total_qty, price, TimeInForce::Gtc, None); // no display_qty
Defensive patterns

Strategy: validation

Validate before calling

if order.display_qty().is_some() {
    return Err(anyhow::anyhow!("AX adapter: display_qty not supported"));
}

Type guard

fn has_display_qty(order: &OrderAny) -> bool {
    order.display_qty().is_some()
}

Try / catch

match submit(order).await {
    Err(e) if e.to_string().contains("display_qty") => {
        let plain = without_display_qty(order.clone());
        submit(&plain).await
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling submit_order with a limit order whose display_qty field is Some(...) (iceberg order) — e.g. order_factory.limit(...).with_display_qty(qty).

Common situations: Large-order execution strategies using iceberg slicing ported from venues that support display quantity; copied order templates retaining display_qty.

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/05e360fbd0cb58ca. Report an issue: GitHub.

Appendix: source

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

}

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 {
        AxHttpError::MissingCredentials
        | AxHttpError::MissingSessionToken
        | AxHttpError::ValidationError(_)
        | AxHttpError::BuildError(_) => CommandFailure::NotSent(message),
        AxHttpError::ApiError { .. }
        | AxHttpError::JsonError(_)

View on GitHub (pinned to 18893faf8b)