{"record":{"id":"69347f325609f8b8","repo":"nautechsystems/nautilus_trader","slug":"period-required-for-historical-open-interest","errorCode":null,"errorMessage":"period required for historical open interest","messagePattern":"period required for historical open interest","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/data.rs","lineNumber":2826,"sourceCode":"                            request_id,\n                            client_id,\n                            Some(venue),\n                            response_data_type,\n                            custom,\n                            start_nanos,\n                            end_nanos,\n                            ts_init,\n                            params,\n                        )))\n                    }\n                    Err(e) => {\n                        log::error!(\"Current open interest request failed for {instrument_id}: {e:?}\");\n                        None\n                    }\n                }\n            } else {\n                let response_data_type = data_type.clone();\n                let period = period.expect(\"period required for historical open interest\");\n                let query = match http.product_type() {\n                    BinanceProductType::UsdM => BinanceOpenInterestHistParams {\n                        symbol: Some(format_binance_symbol(&instrument_id)),\n                        pair: None,\n                        contract_type: None,\n                        period: period.clone(),\n                        start_time: start_ms,\n                        end_time: end_ms,\n                        limit,\n                    },\n                    BinanceProductType::CoinM => {\n                        let (pair, contract_type) =\n                            match Self::coinm_open_interest_hist_params(&http, &instrument_id) {\n                                Ok(values) => values,\n                                Err(e) => {\n                                    log::error!(\n                                        \"Historical open interest request failed for {instrument_id}: {e:?}\"\n                                    );","sourceCodeStart":2808,"sourceCodeEnd":2844,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/futures/data.rs#L2808-L2844","documentation":"For Binance Futures open-interest data requests, the current open-interest endpoint needs no period, but the historical endpoint (openInterestHist) requires one (e.g. '5m', '1h'). When the request is historical and data_funcs found no period, the code reaches an expect that panics with 'period required for historical open interest', since the API parameter cannot be omitted.","triggerScenarios":"Requesting the historical open interest data type via request_data without supplying a period in the request params/metadata (period=None) for a Binance Futures instrument.","commonSituations":"Configuring a data request with 'open interest' type but forgetting the period field in the data catalog config or request; copying a current-open-interest request config and switching it to historical without adding period; upstream requests from a strategy config missing the interval key.","solutions":["Add a valid Binance period ('5m','15m','30m','1h','2h','4h','6h','12h','1d') to the open-interest data request parameters.","Validate request params before submission: reject historical open-interest requests lacking a period with a clear config error.","If you actually want the latest snapshot, use the current open interest data type instead of the historical one.","Consult the Binance Futures openInterestHist docs to confirm the period enum supported by your adapter version."],"exampleFix":"// before\nlet params = RequestParams { instrument_id, data_type: OpenInterestHist, period: None };\n// after\nlet params = RequestParams { instrument_id, data_type: OpenInterestHist, period: Some(\"5m\".into()) };","handlingStrategy":"validation","validationCode":"fn validate_open_interest_request(data_type: &str, period: Option<&str>) -> Result<(), String> {\n    const VALID: [&str; 9] = [\"5m\",\"15m\",\"30m\",\"1h\",\"2h\",\"4h\",\"6h\",\"12h\",\"1d\"];\n    if data_type == \"open_interest_hist\" {\n        match period {\n            Some(p) if VALID.contains(&p) => Ok(()),\n            Some(p) => Err(format!(\"invalid period {p} for historical open interest\")),\n            None => Err(\"period required for historical open interest\".into()),\n        }\n    } else { Ok(()) }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Include period in every historical open-interest data request config.","Validate data request parameters against Binance's openInterestHist period enum before submission.","Distinguish current vs historical open interest data types in your config schema."],"tags":["binance","futures","open-interest","missing-parameter","rust"],"backgroundTag":"missing-required-argument","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}