nautechsystems/nautilus_trader · error · anyhow::Error
invalid high price: {e}
Error message
invalid high price: {e} What it means
Same candle-to-Bar conversion as error 3105, applied to the high price: `Price::from_decimal_dp(candle.high, price_precision)` failed and is wrapped as "invalid high price". The feed returned a high value that cannot be represented as a valid Price at the instrument's precision.
Source
Thrown at crates/adapters/hyperliquid/src/data.rs:2076
}
pub(crate) fn candle_to_bar(
candle: &HyperliquidCandle,
bar_type: BarType,
price_precision: u8,
size_precision: u8,
) -> anyhow::Result<Bar> {
let ts_event = millis_to_nanos(candle.timestamp)?;
let close_boundary = candle
.end_timestamp
.checked_add(1)
.context("candle close boundary overflow")?;
let ts_init = millis_to_nanos(close_boundary)?;
let open = Price::from_decimal_dp(candle.open, price_precision)
.map_err(|e| anyhow::anyhow!("invalid open price: {e}"))?;
let high = Price::from_decimal_dp(candle.high, price_precision)
.map_err(|e| anyhow::anyhow!("invalid high price: {e}"))?;
let low = Price::from_decimal_dp(candle.low, price_precision)
.map_err(|e| anyhow::anyhow!("invalid low price: {e}"))?;
let close = Price::from_decimal_dp(candle.close, price_precision)
.map_err(|e| anyhow::anyhow!("invalid close price: {e}"))?;
let volume = Quantity::from_decimal_dp(candle.volume, size_precision)
.map_err(|e| anyhow::anyhow!("invalid volume: {e}"))?;
Ok(Bar::new(
bar_type, open, high, low, close, volume, ts_event, ts_init,
))
}
/// Request bars from HTTP API.
async fn request_bars_from_http(
http_client: HyperliquidHttpClient,
bar_type: BarType,
start: Option<Timestamp>,
end: Option<Timestamp>,View on GitHub (pinned to 18893faf8b)
Solutions
- Reload instrument definitions so price_precision matches the exchange.
- Inspect the raw candle `high` value and correct the data source.
- Re-fetch the affected candle range.
- Normalize custom candle values to the instrument's decimal precision before conversion.
Example fix
// before
Candle { high: "NaN".to_string(), .. }
// after
Candle { high: "4250.5".to_string(), .. } Defensive patterns
Strategy: validation
Validate before calling
fn candle_fits_precision(high: &str, price_precision: u8) -> bool {
rust_decimal::Decimal::from_str(high)
.map(|d| d.scale() <= price_precision as u32)
.unwrap_or(false)
} Try / catch
match result {
Err(e) if e.to_string().contains("invalid high price") => {
tracing::warn!("dropping candle with bad high: {e:#}");
}
r => r?,
} Prevention
- Reload instrument definitions after exchange precision changes.
- Validate all four OHLC fields, not just the one that failed last time.
- Log the raw candle payload on failure to speed up diagnosis.
When it happens
Trigger: Historical/requested candle whose `high` field is an unparsable decimal or exceeds the configured price_precision during Bar construction.
Common situations: Stale instrument precision config; corrupted exchange payload; manually constructed Candle structs in tests/backtests with wrong formatting.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- invalid open price: {e}
- invalid low price: {e}
- invalid close price: {e}
- invalid volume: {e}
- invalid candle volume: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/6069aefcf1513d6b.
Report an issue: GitHub.