{"record":{"id":"75c5fafdc9359381","repo":"nautechsystems/nautilus_trader","slug":"unsupported-week-interval-step-w","errorCode":null,"errorMessage":"Unsupported week interval: {step}w","messagePattern":"Unsupported week interval: (.+?)w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/common/parse.rs","lineNumber":1457,"sourceCode":"            _ => anyhow::bail!(\"Unsupported minute interval: {step}m\"),\n        },\n        BarAggregation::Hour => match step {\n            1 => BinanceKlineInterval::Hour1,\n            2 => BinanceKlineInterval::Hour2,\n            4 => BinanceKlineInterval::Hour4,\n            6 => BinanceKlineInterval::Hour6,\n            8 => BinanceKlineInterval::Hour8,\n            12 => BinanceKlineInterval::Hour12,\n            _ => anyhow::bail!(\"Unsupported hour interval: {step}h\"),\n        },\n        BarAggregation::Day => match step {\n            1 => BinanceKlineInterval::Day1,\n            3 => BinanceKlineInterval::Day3,\n            _ => anyhow::bail!(\"Unsupported day interval: {step}d\"),\n        },\n        BarAggregation::Week => match step {\n            1 => BinanceKlineInterval::Week1,\n            _ => anyhow::bail!(\"Unsupported week interval: {step}w\"),\n        },\n        BarAggregation::Month => match step {\n            1 => BinanceKlineInterval::Month1,\n            _ => anyhow::bail!(\"Unsupported month interval: {step}M\"),\n        },\n        agg => anyhow::bail!(\"Unsupported bar aggregation for Binance: {agg:?}\"),\n    };\n\n    Ok(interval)\n}\n\npub(crate) fn quote_to_l1_deltas(quote: QuoteTick, sequence: u64) -> OrderBookDeltas {\n    let bid_action = if quote.bid_size.is_zero() {\n        BookAction::Delete\n    } else {\n        BookAction::Update\n    };\n    let ask_action = if quote.ask_size.is_zero() {","sourceCodeStart":1439,"sourceCodeEnd":1475,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/common/parse.rs#L1439-L1475","documentation":"Binance offers only a single weekly kline (1w). bar_spec_to_binance_interval raises this error for any Week-aggregated bar spec whose step is not 1, refusing to subscribe to an interval the exchange cannot serve.","triggerScenarios":"subscribe_bars or unsubscribe_bars with BarAggregation::Week and step != 1, e.g. a 2-WEEK bar spec.","commonSituations":"Requesting bi-weekly or multi-week bars directly from Binance klines, usually to align a strategy with a longer-term timeframe.","solutions":["Change the bar spec to 1-WEEK","Aggregate 1w bars internally (or aggregate 1d bars) to build 2-week bars","Pull longer timeframes from historical/data-vendor sources instead of Binance klines"],"exampleFix":"// before\nBarSpec::new(instrument_id, BAR_SPEC_2_WEEK, PriceType::Last)\n// after\nBarSpec::new(instrument_id, BAR_SPEC_1_WEEK, PriceType::Last)","handlingStrategy":"validation","validationCode":"fn is_supported_week_step(step: u64) -> bool { step == 1 }\nassert!(is_supported_week_step(bar_spec.aggregation_step), \"Binance supports only 1w bars\");","typeGuard":"fn is_supported_week_step(step: u64) -> bool { step == 1 }","tryCatchPattern":"match client.subscribe_bars(bar_spec) {\n    Err(e) if e.to_string().contains(\"Unsupported week interval\") => {\n        log::warn!(\"subscribing 1w and aggregating multi-week bars internally\");\n    }\n    r => r?,\n}","preventionTips":["Use step 1 for all weekly bar specs on Binance","Build multi-week bars via the data engine's internal aggregation","Add config-time checks that reject week steps != 1"],"tags":["rust","binance","bar-aggregation","config"],"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-23T08:17:48.524Z"}