{"record":{"id":"dc9be10c7a993d90","repo":"nautechsystems/nautilus_trader","slug":"unsupported-month-interval-step-m","errorCode":null,"errorMessage":"Unsupported month interval: {step}M","messagePattern":"Unsupported month interval: (.+?)M","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/common/parse.rs","lineNumber":1467,"sourceCode":"            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() {\n        BookAction::Delete\n    } else {\n        BookAction::Update\n    };","sourceCodeStart":1449,"sourceCodeEnd":1485,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/common/parse.rs#L1449-L1485","documentation":"Thrown by bar_spec_to_binance_interval when converting a Nautilus BarSpecification to a Binance kline interval. Binance's kline API only offers a fixed set of intervals per time unit, and for months only 1M exists, so any month step other than 1 has no server-side equivalent. The adapter refuses the mapping instead of silently returning wrong-sized bars.","triggerScenarios":"Subscribing to bars or requesting historical bars with a BarType whose aggregation is MONTH and step != 1, e.g. 'BTCUSDT.BINANCE-3-MONTH-LAST-INTERNAL' passed to subscribe_bars / request_bars, or used in a BacktestEngine catalog request routed through the Binance data client.","commonSituations":"Porting a strategy from another platform (TradingView '3M' charts, MT5 MN3) that supports multi-month bars; building BarType programmatically from a config file where the step multiplier is user-controlled; assuming Binance supports every composite interval because 1m/5m/1h composites work.","solutions":["Change the BarType to the supported 1-month step: 'BTCUSDT.BINANCE-1-MONTH-LAST-INTERNAL'.","If you need 3M/6M bars, subscribe to or request 1-MONTH bars and aggregate them in your strategy (or via the data catalog) instead of asking the exchange.","Check the interval table in bar_spec_to_binance_interval (parse.rs) for all supported steps: 1s; 1/3/5/15/30m; 1/2/4/6/8/12h; 1/3d; 1w; 1M."],"exampleFix":"# before\nbar_type = BarType.from_str('BTCUSDT.BINANCE-3-MONTH-LAST-INTERNAL')\nclient.subscribe_bars(BarSubscription(bar_type))\n\n# after\nbar_type = BarType.from_str('BTCUSDT.BINANCE-1-MONTH-LAST-INTERNAL')\nclient.subscribe_bars(BarSubscription(bar_type))","handlingStrategy":"validation","validationCode":"SUPPORTED_STEPS = {\n    'SECOND': {1}, 'MINUTE': {1, 3, 5, 15, 30}, 'HOUR': {1, 2, 4, 6, 8, 12},\n    'DAY': {1, 3}, 'WEEK': {1}, 'MONTH': {1},\n}\n\ndef binance_bar_spec_supported(bar_spec) -> bool:\n    agg = bar_spec.aggregation_string  # e.g. 'MINUTE'\n    step = int(bar_spec.step)\n    return step in SUPPORTED_STEPS.get(agg, set())","typeGuard":"def is_supported_binance_interval(bar_type) -> bool:\n    spec = bar_type.spec\n    return spec.aggregation_string in (\n        'SECOND', 'MINUTE', 'HOUR', 'DAY', 'WEEK', 'MONTH'\n    ) and binance_bar_spec_supported(spec)","tryCatchPattern":null,"preventionTips":["Centralize BarType construction in one factory function and run the interval check there.","When loading strategy params from files, validate every bar spec against the supported-step table before node start.","Remember Binance only has 1M month klines; aggregate locally for multi-month bars."],"tags":["binance","bars","klines","interval","subscription","validation"],"backgroundTag":"unsupported-timeframe","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}