{"record":{"id":"c4fe28a20714dd5e","repo":"nautechsystems/nautilus_trader","slug":"unsupported-second-interval-step-s","errorCode":null,"errorMessage":"Unsupported second interval: {step}s","messagePattern":"Unsupported second interval: (.+?)s","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/common/parse.rs","lineNumber":1431,"sourceCode":"            .map(|bar| bar.bar())\n            .collect(),\n    )\n}\n\n/// Converts a Nautilus bar specification to a Binance kline interval.\n///\n/// # Errors\n///\n/// Returns an error if the bar specification does not map to a supported\n/// Binance kline interval.\npub fn bar_spec_to_binance_interval(\n    bar_spec: BarSpecification,\n) -> anyhow::Result<BinanceKlineInterval> {\n    let step = bar_spec.step.get();\n    let interval = match bar_spec.aggregation {\n        BarAggregation::Second => match step {\n            1 => BinanceKlineInterval::Second1,\n            _ => anyhow::bail!(\"Unsupported second interval: {step}s\"),\n        },\n        BarAggregation::Minute => match step {\n            1 => BinanceKlineInterval::Minute1,\n            3 => BinanceKlineInterval::Minute3,\n            5 => BinanceKlineInterval::Minute5,\n            15 => BinanceKlineInterval::Minute15,\n            30 => BinanceKlineInterval::Minute30,\n            _ => 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        },","sourceCodeStart":1413,"sourceCodeEnd":1449,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/common/parse.rs#L1413-L1449","documentation":"The Binance adapter maps Nautilus BarSpecifications to Binance kline intervals, and it only supports a fixed set of step sizes per aggregation. For second-based bars only a 1-second interval exists, so any other Second step throws this error. Binance simply does not offer klines at other sub-minute resolutions.","triggerScenarios":"subscribe_bars / unsubscribe_bars (or bar_spec_to_binance_interval directly) called with a BarSpecification whose aggregation is Second and whose step is anything other than 1 — e.g. a 5-SECOND bar request on a Binance venue.","commonSituations":"Strategy configs written generically (e.g. 10s bars) and reused across venues; copy-pasting an aggregation spec from another adapter (Bybit/OKX have finer intervals); building bar specs programmatically without checking venue support.","solutions":["Change the bar spec to Second with step 1, or use Minute aggregation with a supported step","Use the 1-SECOND bar and aggregate/resample to the desired higher resolution in the strategy","Check the supported interval list for the venue before configuring bars","Pick a venue whose adapter supports the desired sub-minute interval if fine granularity is essential"],"exampleFix":"// before\nlet bar_spec = BarSpecification::new(5, BarAggregation::Second, PriceType::Last);\n// after\nlet bar_spec = BarSpecification::new(1, BarAggregation::Second, PriceType::Last); // or Minute/1","handlingStrategy":"validation","validationCode":"fn is_supported_bar_spec(spec: &BarSpecification) -> bool {\n    matches!(\n        (spec.aggregation, spec.step.get()),\n        (BarAggregation::Second, 1)\n            | (BarAggregation::Minute, 1 | 3 | 5 | 15 | 30)\n            | (BarAggregation::Hour, 1 | 2 | 4 | 6 | 8 | 12)\n            | (BarAggregation::Day, 1 | 3 | 7 | 14)\n    )\n}\n// assert!(is_supported_bar_spec(&bar_spec), \"unsupported bar spec for Binance\");","typeGuard":null,"tryCatchPattern":"let interval = bar_spec_to_binance_interval(bar_spec)\n    .map_err(|e| AdapterError::UnsupportedBarSpec(e.to_string()))?; // surface a typed config error instead of a runtime bail","preventionTips":["Validate bar specs against venue-supported intervals at config load time","Do not reuse bar-spec configs across venues without checking support","Use 1-SECOND bars plus resampling when finer-than-1s steps are needed"],"tags":["binance","bars","interval","bar-aggregation","unsupported-value"],"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-23T08:17:48.524Z"}