{"record":{"id":"0c3797ec6802bc46","repo":"nautechsystems/nautilus_trader","slug":"unsupported-bar-specification-for-ax-step","errorCode":null,"errorMessage":"Unsupported bar specification for AX: {step}-{:?}","messagePattern":"Unsupported bar specification for AX: (.+?)-(.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/architect_ax/src/common/enums.rs","lineNumber":636,"sourceCode":"    #[serde(rename = \"1d\")]\n    #[strum(serialize = \"1d\")]\n    Days1,\n}\n\nimpl TryFrom<&BarSpecification> for AxCandleWidth {\n    type Error = anyhow::Error;\n\n    fn try_from(spec: &BarSpecification) -> Result<Self, Self::Error> {\n        let step = spec.step.get();\n        match (step, spec.aggregation) {\n            (1, BarAggregation::Second) => Ok(Self::Seconds1),\n            (5, BarAggregation::Second) => Ok(Self::Seconds5),\n            (1, BarAggregation::Minute) => Ok(Self::Minutes1),\n            (5, BarAggregation::Minute) => Ok(Self::Minutes5),\n            (15, BarAggregation::Minute) => Ok(Self::Minutes15),\n            (1, BarAggregation::Hour) => Ok(Self::Hours1),\n            (1, BarAggregation::Day) => Ok(Self::Days1),\n            _ => anyhow::bail!(\n                \"Unsupported bar specification for AX: {step}-{:?}\",\n                spec.aggregation,\n            ),\n        }\n    }\n}\n\n/// WebSocket market data request type (client to server).\n///\n/// # References\n/// - <https://docs.architect.exchange/api-reference/marketdata/md-ws>\n#[derive(\n    Clone,\n    Copy,\n    Debug,\n    Display,\n    Eq,\n    PartialEq,","sourceCodeStart":618,"sourceCodeEnd":654,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/architect_ax/src/common/enums.rs#L618-L654","documentation":"TryFrom<&BarSpecification> for AxCandleWidth maps NautilusTrader bar specs onto ArchitectX's fixed candle-width enum. Architect only supports 1s, 5s, 1m, 5m, 15m, 1h and 1d; any other step/aggregation combination (including tick- or volume-based aggregation) is unsupported and rejected with the step and aggregation in the message.","triggerScenarios":"Requesting AX market data or historical bars with e.g. BarSpecification(30, BarAggregation::Second), 4-hour bars, daily step 7, or any BarAggregation::Tick/Volume spec — any pair not in the eight accepted matches.","commonSituations":"Reusing a strategy's bar config (tuned for another venue) with the architect_ax adapter; assuming arbitrary step values are negotiated like on crypto venues; subscribing with the default bar spec from an example.","solutions":["Use one of the supported widths: 1-SECOND, 5-SECOND, 1-MINUTE, 5-MINUTE, 15-MINUTE, 1-HOUR, 1-DAY","Aggregate unsupported widths client-side from a finer supported width (e.g. build 30s bars from 5s bars)","Check spec.step/spec.aggregation against the accepted set before building the AX request"],"exampleFix":"// before\nlet spec = BarSpecification::new(30, BarAggregation::Second, PriceType::Last);\nlet width = AxCandleWidth::try_from(&spec)?; // Unsupported bar specification for AX: 30-Second\n\n// after\nlet spec = BarSpecification::new(5, BarAggregation::Second, PriceType::Last);\nlet width = AxCandleWidth::try_from(&spec)?; // Seconds5","handlingStrategy":"validation","validationCode":"// Rust: check before converting\nconst SUPPORTED: &[(u64, BarAggregation)] = &[\n    (1, BarAggregation::Second),\n    (5, BarAggregation::Second),\n    (1, BarAggregation::Minute),\n    (5, BarAggregation::Minute),\n    (15, BarAggregation::Minute),\n    (1, BarAggregation::Hour),\n    (1, BarAggregation::Day),\n];\nif !SUPPORTED.contains(&(spec.step.get(), spec.aggregation)) {\n    anyhow::bail!(\"unsupported AX bar width: {}\", spec);\n}\nlet width = AxCandleWidth::try_from(&spec)?;","typeGuard":"fn is_supported_ax_width(spec: &BarSpecification) -> bool {\n    matches!(\n        (spec.step.get(), spec.aggregation),\n        (1, BarAggregation::Second)\n            | (5, BarAggregation::Second)\n            | (1, BarAggregation::Minute)\n            | (5, BarAggregation::Minute)\n            | (15, BarAggregation::Minute)\n            | (1, BarAggregation::Hour)\n            | (1, BarAggregation::Day)\n    )\n}","tryCatchPattern":"let width = match AxCandleWidth::try_from(&spec) {\n    Ok(w) => w,\n    Err(e) => {\n        tracing::warn!(\"{e}; falling back to 1-minute bars\");\n        AxCandleWidth::Minutes1\n    }\n};","preventionTips":["Hard-code the AX-supported widths in strategy config validation","Never assume Tick/Volume aggregation works on Architect; it is time-bars only","Build exotic widths client-side by aggregating a supported base width"],"tags":["rust","architect","adapter","bar-specification","unsupported-value","enum-mapping"],"backgroundTag":"unsupported-enum-value","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}