{"record":{"id":"14f6872f2b0b68e1","repo":"nautechsystems/nautilus_trader","slug":"invalid-volume-e","errorCode":null,"errorMessage":"invalid volume: {e}","messagePattern":"invalid volume: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/hyperliquid/src/data.rs","lineNumber":2082,"sourceCode":"    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\n    let instrument_id = bar_type.instrument_id();\n    let instrument = instruments","sourceCodeStart":2064,"sourceCodeEnd":2100,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/hyperliquid/src/data.rs#L2064-L2100","documentation":"The candle volume fails `Quantity::from_decimal_dp(candle.volume, size_precision)` during Bar conversion, wrapped as \"invalid volume\". The volume value from the Hyperliquid candle cannot be parsed or does not fit the instrument's size precision.","triggerScenarios":"Candle payload whose `volume` is malformed (empty, non-decimal) or has more decimals than the instrument's configured size_precision while constructing a Bar.","commonSituations":"Size precision misconfigured for the market; bad or aggregated candle data; custom fixtures with unrealistic volume strings (e.g. negative or over-precise).","solutions":["Verify the instrument's size_precision matches the Hyperliquid market.","Inspect the raw candle `volume` value and correct the source data.","Re-request the candles; retry in case of a transient bad payload.","Normalize custom volume values to plain decimals within size_precision."],"exampleFix":"// before\nCandle { volume: \"1e-9\".to_string(), .. } // size_precision = 4\n// after\nCandle { volume: \"0.0000\".to_string(), .. } // or drop the candle as dust","handlingStrategy":"validation","validationCode":"fn volume_fits_precision(volume: &str, size_precision: u8) -> bool {\n    rust_decimal::Decimal::from_str(volume)\n        .map(|d| d.scale() <= size_precision as u32 && d >= rust_decimal::Decimal::ZERO)\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"invalid volume\") => {\n        tracing::warn!(\"dropping candle with bad volume: {e:#}\");\n    }\n    r => r?,\n}","preventionTips":["Verify size_precision matches the market before requesting bars.","Treat zero/near-zero volumes explicitly instead of relying on parsing.","Pre-normalize custom volume strings to plain decimals within size_precision."],"tags":["data","candles","parsing","precision","volume","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"}