{"record":{"id":"7e5f3458137a28e2","repo":"nautechsystems/nautilus_trader","slug":"invalid-close-price-e","errorCode":null,"errorMessage":"invalid close price: {e}","messagePattern":"invalid close price: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/hyperliquid/src/data.rs","lineNumber":2080,"sourceCode":"    bar_type: BarType,\n    price_precision: u8,\n    size_precision: u8,\n) -> anyhow::Result<Bar> {\n    let ts_event = millis_to_nanos(candle.timestamp)?;\n    let close_boundary = candle\n        .end_timestamp\n        .checked_add(1)\n        .context(\"candle close boundary overflow\")?;\n    let ts_init = millis_to_nanos(close_boundary)?;\n\n    let open = Price::from_decimal_dp(candle.open, price_precision)\n        .map_err(|e| anyhow::anyhow!(\"invalid open price: {e}\"))?;\n    let high = Price::from_decimal_dp(candle.high, price_precision)\n        .map_err(|e| anyhow::anyhow!(\"invalid high price: {e}\"))?;\n    let low = Price::from_decimal_dp(candle.low, price_precision)\n        .map_err(|e| anyhow::anyhow!(\"invalid low price: {e}\"))?;\n    let close = Price::from_decimal_dp(candle.close, price_precision)\n        .map_err(|e| anyhow::anyhow!(\"invalid close price: {e}\"))?;\n    let volume = Quantity::from_decimal_dp(candle.volume, size_precision)\n        .map_err(|e| anyhow::anyhow!(\"invalid volume: {e}\"))?;\n\n    Ok(Bar::new(\n        bar_type, open, high, low, close, volume, ts_event, ts_init,\n    ))\n}\n\n/// Request bars from HTTP API.\nasync fn request_bars_from_http(\n    http_client: HyperliquidHttpClient,\n    bar_type: BarType,\n    start: Option<Timestamp>,\n    end: Option<Timestamp>,\n    limit: Option<u32>,\n    instruments: Arc<AtomicMap<InstrumentId, InstrumentAny>>,\n) -> anyhow::Result<Vec<Bar>> {\n    // Get instrument details for precision","sourceCodeStart":2062,"sourceCodeEnd":2098,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/hyperliquid/src/data.rs#L2062-L2098","documentation":"The close price of a Hyperliquid candle fails `Price::from_decimal_dp(candle.close, price_precision)` during Bar conversion, wrapped as \"invalid close price\". The close value is unparsable or incompatible with the instrument's price precision.","triggerScenarios":"Candle payload with a malformed `close` decimal, or a locally configured price_precision smaller than the decimals present in the close value when building the Bar.","commonSituations":"Outdated instrument definitions after a market precision change; corrupted candles from an aggregator; test data with arbitrary-precision decimals.","solutions":["Refresh instrument definitions to get the correct price_precision.","Inspect the raw candle `close` value and fix the data source.","Re-fetch the affected candle range.","Round/normalize custom close prices to the instrument precision before conversion."],"exampleFix":"// before\nCandle { close: \"0.123456789012\".to_string(), .. } // precision = 6\n// after\nCandle { close: \"0.123457\".to_string(), .. }","handlingStrategy":"validation","validationCode":"fn candle_fits_precision(close: &str, price_precision: u8) -> bool {\n    rust_decimal::Decimal::from_str(close)\n        .map(|d| d.scale() <= price_precision as u32)\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"invalid close price\") => {\n        tracing::warn!(\"dropping candle with bad close: {e:#}\");\n    }\n    r => r?,\n}","preventionTips":["Round close prices to the instrument precision before conversion.","Refresh instrument definitions periodically; precision can change.","Validate candle payloads (all OHLCV fields parse as decimals) on ingestion."],"tags":["data","candles","parsing","precision","hyperliquid"],"backgroundTag":"invalid-argument-format","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"}