{"record":{"id":"df7fcb4131e7d872","repo":"nautechsystems/nautilus_trader","slug":"derive-only-supports-1-day-interval-bars","errorCode":null,"errorMessage":"Derive only supports 1 DAY interval bars","messagePattern":"Derive only supports 1 DAY interval bars","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/derive/src/websocket/parse.rs","lineNumber":668,"sourceCode":"    match aggregation {\n        BarAggregation::Minute => match step {\n            1 => Ok(60),\n            5 => Ok(300),\n            15 => Ok(900),\n            30 => Ok(1800),\n            _ => anyhow::bail!(\n                \"Derive only supports minute intervals 1, 5, 15, 30 (use HOUR for >= 60)\"\n            ),\n        },\n        BarAggregation::Hour => match step {\n            1 => Ok(3600),\n            4 => Ok(14400),\n            8 => Ok(28800),\n            _ => anyhow::bail!(\"Derive only supports hour intervals 1, 4, 8\"),\n        },\n        BarAggregation::Day => {\n            if step != 1 {\n                anyhow::bail!(\"Derive only supports 1 DAY interval bars\");\n            }\n            Ok(86400)\n        }\n        BarAggregation::Week => {\n            if step != 1 {\n                anyhow::bail!(\"Derive only supports 1 WEEK interval bars\");\n            }\n            Ok(604800)\n        }\n        _ => anyhow::bail!(\"Derive does not support {aggregation:?} bars\"),\n    }\n}\n\nfn timestamp_seconds_to_nanos(value: u64, field: &str) -> anyhow::Result<UnixNanos> {\n    let nanos = value\n        .checked_mul(NANOSECONDS_IN_SECOND)\n        .with_context(|| format!(\"Derive {field} overflows nanoseconds\"))?;\n    Ok(UnixNanos::from(nanos))","sourceCodeStart":650,"sourceCodeEnd":686,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/derive/src/websocket/parse.rs#L650-L686","documentation":"bar_spec_to_derive_period cannot convert a Day-aggregation bar spec whose step is not 1; Derive's candle API accepts period values in seconds and only supports a single 86400-second (1 day) period, so multi-day steps are unmappable.","triggerScenarios":"Requesting bars with BarAggregation::Day and step != 1 (e.g. Day/7) via request_bars or bar config.","commonSituations":"Weekly/monthly bar configs ported from other venues that support multi-day candles.","solutions":["Use BarAggregation::Day with step 1 only","For weekly bars aggregate 1-day bars client-side in the strategy","Use the Week aggregation if supported (step 1) instead of Day/7","Adjust the BarSpecification in the bar request"],"exampleFix":"// before\nBarAggregation::Day, step: 7\n// after\nBarAggregation::Day, step: 1 // aggregate weekly downstream","handlingStrategy":"validation","validationCode":"if agg == BarAggregation::Day && step != 1 {\n    return Err(\"Derive supports only Day step 1; aggregate weekly client-side\".into());\n}","typeGuard":null,"tryCatchPattern":"match bar_spec_to_derive_period(&BarAggregation::Day, step) {\n    Ok(p) => subscribe(p),\n    Err(e) if e.to_string().contains(\"1 DAY interval\") => {\n        // build multi-day bars from daily candles in strategy code\n        subscribe(bar_spec_to_derive_period(&BarAggregation::Day, 1)?)\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Restrict Day aggregation to step 1 for Derive","Implement client-side resampling for weekly/monthly views","Validate bar specs against venue capability tables before requests"],"tags":["rust","bars","aggregation","validation"],"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"}