{"record":{"id":"e9ea8623e4afb54b","repo":"nautechsystems/nautilus_trader","slug":"invalid-candle-low-e-e9ea86","errorCode":null,"errorMessage":"invalid candle low: {e}","messagePattern":"invalid candle low: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/websocket/parse.rs","lineNumber":404,"sourceCode":"/// # Errors\n///\n/// Returns an error if the OHLCV decimals overflow the instrument's precision, or if the\n/// timestamp cannot be converted.\npub fn parse_ws_bar(\n    instrument: &InstrumentAny,\n    candle: &LighterWsCandle,\n    resolution: LighterCandleResolution,\n    ts_init: UnixNanos,\n) -> anyhow::Result<Bar> {\n    let price_precision = instrument.price_precision();\n    let size_precision = instrument.size_precision();\n\n    let open = Price::from_decimal_dp(candle.o, price_precision)\n        .map_err(|e| anyhow::anyhow!(\"invalid candle open: {e}\"))?;\n    let high = Price::from_decimal_dp(candle.h, price_precision)\n        .map_err(|e| anyhow::anyhow!(\"invalid candle high: {e}\"))?;\n    let low = Price::from_decimal_dp(candle.l, price_precision)\n        .map_err(|e| anyhow::anyhow!(\"invalid candle low: {e}\"))?;\n    let close = Price::from_decimal_dp(candle.c, price_precision)\n        .map_err(|e| anyhow::anyhow!(\"invalid candle close: {e}\"))?;\n    let volume = Quantity::from_decimal_dp(candle.v, size_precision)\n        .map_err(|e| anyhow::anyhow!(\"invalid candle volume: {e}\"))?;\n\n    let t_ms = u64::try_from(candle.t)\n        .map_err(|_| anyhow::anyhow!(\"negative candle timestamp: {}\", candle.t))?;\n    let ts_event = parse_millis_to_nanos(t_ms)?;\n\n    let bar_type = BarType::new(\n        instrument.id(),\n        resolution.to_bar_spec(),\n        AggregationSource::External,\n    );\n\n    Bar::new_checked(bar_type, open, high, low, close, volume, ts_event, ts_init)\n        .map_err(|e| anyhow::anyhow!(\"invalid candle bar: {e}\"))\n}","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/websocket/parse.rs#L386-L422","documentation":"parse_ws_bar converts the candle's low decimal into a Price at the instrument's price_precision via Price::from_decimal_dp. A failure is wrapped as 'invalid candle low', meaning the venue's low value is not representable at the configured precision.","triggerScenarios":"Candle low decimal exceeding price_precision fractional digits or otherwise failing Price construction from the WebSocket candle payload.","commonSituations":"Under-configured instrument price_precision; venue format change; candle stream bound to the wrong instrument.","solutions":["Correct instrument price_precision to match venue ticks","Round candle.l to price_precision before constructing the Price","Log the offending low value and root error","Check instrument-to-subscription mapping"],"exampleFix":"// before\nlet low = Price::from_decimal_dp(candle.l, price_precision)?;\n// after\nlet low = Price::from_decimal_dp(candle.l.round_dp(price_precision as u32), price_precision)?;","handlingStrategy":"validation","validationCode":"let low = candle.l.round_dp(instrument.price_precision() as u32);","typeGuard":null,"tryCatchPattern":"match parse_ws_bar(candle, instrument, ...) {\n    Err(e) if e.to_string().contains(\"invalid candle low\") => {\n        log::warn!(\"bad candle low {}, skipping bar: {e}\", candle.l);\n    }\n    other => other?,\n}","preventionTips":["Align price_precision with venue metadata","Pre-quantize candle.l before Price construction","Validate instrument definitions against venue metadata at startup"],"tags":["rust","websocket","candles","precision"],"backgroundTag":"invalid-argument-value","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"}