nautechsystems/nautilus_trader · error
invalid candle low: {e}
Error message
invalid candle low: {e} What it means
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.
Source
Thrown at crates/adapters/lighter/src/websocket/parse.rs:404
/// # Errors
///
/// Returns an error if the OHLCV decimals overflow the instrument's precision, or if the
/// timestamp cannot be converted.
pub fn parse_ws_bar(
instrument: &InstrumentAny,
candle: &LighterWsCandle,
resolution: LighterCandleResolution,
ts_init: UnixNanos,
) -> anyhow::Result<Bar> {
let price_precision = instrument.price_precision();
let size_precision = instrument.size_precision();
let open = Price::from_decimal_dp(candle.o, price_precision)
.map_err(|e| anyhow::anyhow!("invalid candle open: {e}"))?;
let high = Price::from_decimal_dp(candle.h, price_precision)
.map_err(|e| anyhow::anyhow!("invalid candle high: {e}"))?;
let low = Price::from_decimal_dp(candle.l, price_precision)
.map_err(|e| anyhow::anyhow!("invalid candle low: {e}"))?;
let close = Price::from_decimal_dp(candle.c, price_precision)
.map_err(|e| anyhow::anyhow!("invalid candle close: {e}"))?;
let volume = Quantity::from_decimal_dp(candle.v, size_precision)
.map_err(|e| anyhow::anyhow!("invalid candle volume: {e}"))?;
let t_ms = u64::try_from(candle.t)
.map_err(|_| anyhow::anyhow!("negative candle timestamp: {}", candle.t))?;
let ts_event = parse_millis_to_nanos(t_ms)?;
let bar_type = BarType::new(
instrument.id(),
resolution.to_bar_spec(),
AggregationSource::External,
);
Bar::new_checked(bar_type, open, high, low, close, volume, ts_event, ts_init)
.map_err(|e| anyhow::anyhow!("invalid candle bar: {e}"))
}View on GitHub (pinned to 18893faf8b)
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
Example fix
// before let low = Price::from_decimal_dp(candle.l, price_precision)?; // after let low = Price::from_decimal_dp(candle.l.round_dp(price_precision as u32), price_precision)?;
Defensive patterns
Strategy: validation
Validate before calling
let low = candle.l.round_dp(instrument.price_precision() as u32);
Try / catch
match parse_ws_bar(candle, instrument, ...) {
Err(e) if e.to_string().contains("invalid candle low") => {
log::warn!("bad candle low {}, skipping bar: {e}", candle.l);
}
other => other?,
} Prevention
- Align price_precision with venue metadata
- Pre-quantize candle.l before Price construction
- Validate instrument definitions against venue metadata at startup
When it happens
Trigger: Candle low decimal exceeding price_precision fractional digits or otherwise failing Price construction from the WebSocket candle payload.
Common situations: Under-configured instrument price_precision; venue format change; candle stream bound to the wrong instrument.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- invalid candle open: {e}
- invalid candle high: {e}
- invalid candle close: {e}
- invalid candle volume: {e}
- invalid candle open: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/e9ea8623e4afb54b.
Report an issue: GitHub.