nautechsystems/nautilus_trader · error

quantity `{quantity}` below Lighter min_base_amount `{min_qu

Error message

quantity `{quantity}` below Lighter min_base_amount `{min_quantity}` for {}

What it means

Before submitting an order, the adapter validates the requested quantity against the instrument's minimum base amount (min_quantity from the Lighter instrument definition). Orders below the exchange minimum would be rejected server-side, so the adapter fails early with this ensure!.

Source

Thrown at crates/adapters/lighter/src/execution.rs:5635

        instrument_id: cmd.instrument_id,
        client_order_id,
        venue_order_id: None,
        command_id: cmd.command_id,
        ts_init: cmd.ts_init,
        params: cmd.params.clone(),
        correlation_id: cmd.correlation_id,
        causation_id: cmd.causation_id,
    }
}

fn validate_order_amount(
    instrument: &InstrumentAny,
    quantity: Quantity,
    price_ticks: u32,
    price_precision: u8,
) -> anyhow::Result<()> {
    if let Some(min_quantity) = instrument.min_quantity() {
        anyhow::ensure!(
            quantity >= min_quantity,
            "quantity `{quantity}` below Lighter min_base_amount `{min_quantity}` for {}",
            instrument.id(),
        );
    }

    if let Some(min_notional) = instrument.min_notional() {
        let price = decimal_from_ticks(price_ticks, price_precision);
        let notional = quantity.as_decimal() * price;
        anyhow::ensure!(
            notional >= min_notional.as_decimal(),
            "order notional `{notional}` below Lighter min_quote_amount `{}` for {}",
            min_notional.as_decimal(),
            instrument.id(),
        );
    }

    Ok(())

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Clamp order quantity up to instrument.min_quantity() before submission, or skip orders below it.
  2. Handle dust positions separately (e.g. manual close or market-wide netting) rather than via exchange orders.
  3. Check instrument definitions at startup and configure strategy minimums accordingly.
  4. Verify quantity precision/units so rounding is not shrinking the value below the minimum.

Example fix

// before
client.submit_order(instrument_id, side, qty, price);
// after
let min_qty = instrument.min_quantity().unwrap_or(qty);
if qty < min_qty {
    tracing::warn!("skipping order below min_base_amount");
    return Ok(());
}
client.submit_order(instrument_id, side, qty.max(min_qty), price);
Defensive patterns

Strategy: validation

Validate before calling

if let Some(min_q) = instrument.min_quantity() {
    assert!(quantity >= min_q, "qty {quantity} below Lighter min_base_amount {min_q}");
}

Type guard

fn meets_min_quantity(instrument: &InstrumentAny, qty: Quantity) -> bool {
    instrument.min_quantity().map_or(true, |min| qty >= min)
}

Try / catch

match client.submit(order).await {
    Err(e) if e.to_string().contains("below Lighter min_base_amount") => {
        // skip or aggregate the order; do not blind-retry
    }
    other => other,
}

Prevention

When it happens

Trigger: Submitting a Lighter order whose quantity is smaller than instrument.min_quantity() — e.g. a residual close of a tiny dust position, an over-aggressive risk engine sizing, or hardcoded small test quantities.

Common situations: Trying to flatten a dust position below the minimum, submitting very small test orders, sizing logic not consulting instrument limits.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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