{"record":{"id":"18f6ab44d77b6e84","repo":"nautechsystems/nautilus_trader","slug":"unsupported-bar-aggregation","errorCode":null,"errorMessage":"Unsupported bar aggregation: {:?}","messagePattern":"Unsupported bar aggregation: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/dydx/src/common/enums.rs","lineNumber":681,"sourceCode":"    /// 1 day candles.\n    #[serde(rename = \"1DAY\")]\n    #[strum(serialize = \"1DAY\")]\n    OneDay,\n}\n\nimpl DydxCandleResolution {\n    /// Maps a Nautilus [`BarSpecification`] to a dYdX candle resolution.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the step/aggregation combination is not supported.\n    pub fn from_bar_spec(spec: &BarSpecification) -> anyhow::Result<Self> {\n        match spec.step.get() {\n            1 => match spec.aggregation {\n                BarAggregation::Minute => Ok(Self::OneMinute),\n                BarAggregation::Hour => Ok(Self::OneHour),\n                BarAggregation::Day => Ok(Self::OneDay),\n                _ => anyhow::bail!(\"Unsupported bar aggregation: {:?}\", spec.aggregation),\n            },\n            5 if spec.aggregation == BarAggregation::Minute => Ok(Self::FiveMinutes),\n            15 if spec.aggregation == BarAggregation::Minute => Ok(Self::FifteenMinutes),\n            30 if spec.aggregation == BarAggregation::Minute => Ok(Self::ThirtyMinutes),\n            4 if spec.aggregation == BarAggregation::Hour => Ok(Self::FourHours),\n            step => anyhow::bail!(\n                \"Unsupported bar step: {step} with aggregation {:?}\",\n                spec.aggregation\n            ),\n        }\n    }\n}\n\n/// dYdX network environment (mainnet vs testnet).\n///\n/// This selects the underlying Cosmos chain for transaction submission.\n#[derive(\n    Copy,","sourceCodeStart":663,"sourceCodeEnd":699,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/dydx/src/common/enums.rs#L663-L699","documentation":"The dYdX adapter maps NautilusTrader BarSpecifications onto its fixed set of candle resolutions. Within the step==1 branch, only Minute, Hour, and Day aggregations map to dYdX enums; any other aggregation with step 1 (Week, Second, Tick, Volume, etc.) is rejected.","triggerScenarios":"Calling from_bar_spec (via bar data subscription/request) with a BarSpecification of step 1 and an aggregation outside Minute/Hour/Day, e.g. 1 WEEK bars or 1 SECOND bars.","commonSituations":"Configuring 1-week candles against dYdX; reusing bar specs designed for Derive (which supports 1 WEEK) with the dYdX adapter.","solutions":["Use Minute, Hour, or Day aggregation with step 1 for dYdX","Aggregate weekly bars locally from daily data instead of requesting them from dYdX","Switch to an adapter that supports the requested aggregation"],"exampleFix":"// before\nlet spec = BarSpecification::new(1.into(), BarAggregation::Week, PriceType::Last);\n// after\nlet spec = BarSpecification::new(1.into(), BarAggregation::Day, PriceType::Last);","handlingStrategy":"validation","validationCode":"fn is_dydx_bar_spec_supported(spec: &BarSpecification) -> bool {\n    match spec.step.get() {\n        1 => matches!(spec.aggregation, BarAggregation::Minute | BarAggregation::Hour | BarAggregation::Day),\n        5 | 15 | 30 => spec.aggregation == BarAggregation::Minute,\n        4 => spec.aggregation == BarAggregation::Hour,\n        _ => false,\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use step-1 Minute/Hour/Day specs for dYdX","Share a per-venue bar-spec whitelist in configuration code"],"tags":["rust","bars","dydx-exchange","unsupported-aggregation"],"backgroundTag":"unsupported-enum-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"}