{"record":{"id":"d0ca1551dd0f02ac","repo":"nautechsystems/nautilus_trader","slug":"quantity-rounds-to-0-ticks-at-size-precision","errorCode":null,"errorMessage":"quantity `{}` rounds to 0 ticks at size_precision {}","messagePattern":"quantity `(.+?)` rounds to 0 ticks at size_precision (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/execution.rs","lineNumber":1604,"sourceCode":"        let order_kind = nautilus_to_lighter_order_type(order.order_type())?;\n\n        let tif = nautilus_to_lighter_tif(\n            order.order_type(),\n            order.time_in_force(),\n            order.is_post_only(),\n        )?;\n        let now_ms = (self.clock.get_time_ns().as_u64() / 1_000_000) as i64;\n        let order_expiry = order_expiry_for(\n            order.order_type(),\n            &order.time_in_force(),\n            order.expire_time(),\n            now_ms,\n        )?;\n\n        let base_amount = quantity_to_ticks(&order.quantity(), instrument.size_precision())?;\n\n        // `quantity_to_ticks` floors sub-precision quantities to 0.\n        anyhow::ensure!(\n            base_amount > 0,\n            \"quantity `{}` rounds to 0 ticks at size_precision {}\",\n            order.quantity(),\n            instrument.size_precision(),\n        );\n        let price_precision = instrument.price_precision();\n        let is_buy = matches!(order.order_side(), OrderSide::Buy);\n\n        // Lighter requires `price` on market-style orders as the worst\n        // acceptable cap; derive it from far-side quote or trigger.\n        let price_ticks = match order.order_type() {\n            OrderType::Market => {\n                let quote = self\n                    .core\n                    .cache()\n                    .quote(&instrument_id)\n                    .copied()\n                    .ok_or_else(|| {","sourceCodeStart":1586,"sourceCodeEnd":1622,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/execution.rs#L1586-L1622","documentation":"The order quantity converted to integer Lighter base-amount ticks is zero because quantity_to_ticks floors the quantity using the instrument's size_precision. Lighter only accepts discrete tick amounts, so a sub-minimum quantity is rejected up front rather than sending an invalid order.","triggerScenarios":"submit_order/submit_order_list with a quantity smaller than one tick at the instrument's size_precision (e.g. qty 0.0004 when size_precision allows only 0.001 steps).","commonSituations":"Position-sizing math producing tiny fractions; Decimal division rounding down; using an instrument definition with coarser precision than the strategy assumes; leftover-dust sells.","solutions":["Increase the order quantity to at least one size tick for the instrument.","Check the instrument's size_precision/size_increment and enforce a minimum-size check before submitting.","Skip or accumulate dust amounts until they exceed one tick.","Verify the instrument definition loaded matches the venue's actual precision."],"exampleFix":"// before\nlet qty = Quantity::from_decimal(dec!(0.0004));\nlet order = order_factory.limit(instrument_id, Side::Buy, qty, price);\n// after\nlet min_qty = Quantity::new(1.0, instrument.size_precision());\nanyhow::ensure!(order.quantity() >= min_qty, \"qty below one tick\");\nlet order = order_factory.limit(instrument_id, Side::Buy, order.quantity(), price);","handlingStrategy":"validation","validationCode":"// Rust\nlet ticks = qty.as_decimal() / dec!(10).powi(instrument.size_precision() as i64);\nanyhow::ensure!(ticks >= dec!(1), \"quantity below one size tick\");","typeGuard":null,"tryCatchPattern":"if quantity_to_ticks(&qty, instrument.size_precision()).unwrap_or(0) == 0 {\n    log::warn!(\"skipping sub-tick quantity {qty}\");\n    return Ok(());\n}","preventionTips":["Enforce a per-instrument minimum quantity in position-sizing code","Accumulate dust rather than submitting sub-tick orders","Verify size_precision in the loaded instrument definition"],"tags":["validation","precision","quantity","trading"],"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"}