{"record":{"id":"5a373df30d5fbbed","repo":"nautechsystems/nautilus_trader","slug":"quantity-quantity-below-lighter-min-base-amoun","errorCode":null,"errorMessage":"quantity `{quantity}` below Lighter min_base_amount `{min_quantity}` for {}","messagePattern":"quantity `(.+?)` below Lighter min_base_amount `(.+?)` for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/execution.rs","lineNumber":5635,"sourceCode":"        instrument_id: cmd.instrument_id,\n        client_order_id,\n        venue_order_id: None,\n        command_id: cmd.command_id,\n        ts_init: cmd.ts_init,\n        params: cmd.params.clone(),\n        correlation_id: cmd.correlation_id,\n        causation_id: cmd.causation_id,\n    }\n}\n\nfn validate_order_amount(\n    instrument: &InstrumentAny,\n    quantity: Quantity,\n    price_ticks: u32,\n    price_precision: u8,\n) -> anyhow::Result<()> {\n    if let Some(min_quantity) = instrument.min_quantity() {\n        anyhow::ensure!(\n            quantity >= min_quantity,\n            \"quantity `{quantity}` below Lighter min_base_amount `{min_quantity}` for {}\",\n            instrument.id(),\n        );\n    }\n\n    if let Some(min_notional) = instrument.min_notional() {\n        let price = decimal_from_ticks(price_ticks, price_precision);\n        let notional = quantity.as_decimal() * price;\n        anyhow::ensure!(\n            notional >= min_notional.as_decimal(),\n            \"order notional `{notional}` below Lighter min_quote_amount `{}` for {}\",\n            min_notional.as_decimal(),\n            instrument.id(),\n        );\n    }\n\n    Ok(())","sourceCodeStart":5617,"sourceCodeEnd":5653,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/execution.rs#L5617-L5653","documentation":"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!.","triggerScenarios":"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.","commonSituations":"Trying to flatten a dust position below the minimum, submitting very small test orders, sizing logic not consulting instrument limits.","solutions":["Clamp order quantity up to instrument.min_quantity() before submission, or skip orders below it.","Handle dust positions separately (e.g. manual close or market-wide netting) rather than via exchange orders.","Check instrument definitions at startup and configure strategy minimums accordingly.","Verify quantity precision/units so rounding is not shrinking the value below the minimum."],"exampleFix":"// before\nclient.submit_order(instrument_id, side, qty, price);\n// after\nlet min_qty = instrument.min_quantity().unwrap_or(qty);\nif qty < min_qty {\n    tracing::warn!(\"skipping order below min_base_amount\");\n    return Ok(());\n}\nclient.submit_order(instrument_id, side, qty.max(min_qty), price);","handlingStrategy":"validation","validationCode":"if let Some(min_q) = instrument.min_quantity() {\n    assert!(quantity >= min_q, \"qty {quantity} below Lighter min_base_amount {min_q}\");\n}","typeGuard":"fn meets_min_quantity(instrument: &InstrumentAny, qty: Quantity) -> bool {\n    instrument.min_quantity().map_or(true, |min| qty >= min)\n}","tryCatchPattern":"match client.submit(order).await {\n    Err(e) if e.to_string().contains(\"below Lighter min_base_amount\") => {\n        // skip or aggregate the order; do not blind-retry\n    }\n    other => other,\n}","preventionTips":["Check instrument.min_quantity() during strategy sizing","Handle dust positions outside normal order submission","Verify quantity precision and rounding keep values above minimums"],"tags":["order-validation","lighter","min-quantity","pre-trade-check"],"backgroundTag":"value-out-of-range","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}