nautechsystems/nautilus_trader · error
period required for historical open interest
Error message
period required for historical open interest
What it means
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.
Source
Thrown at crates/adapters/binance/src/futures/data.rs:2826
request_id,
client_id,
Some(venue),
response_data_type,
custom,
start_nanos,
end_nanos,
ts_init,
params,
)))
}
Err(e) => {
log::error!("Current open interest request failed for {instrument_id}: {e:?}");
None
}
}
} else {
let response_data_type = data_type.clone();
let period = period.expect("period required for historical open interest");
let query = match http.product_type() {
BinanceProductType::UsdM => BinanceOpenInterestHistParams {
symbol: Some(format_binance_symbol(&instrument_id)),
pair: None,
contract_type: None,
period: period.clone(),
start_time: start_ms,
end_time: end_ms,
limit,
},
BinanceProductType::CoinM => {
let (pair, contract_type) =
match Self::coinm_open_interest_hist_params(&http, &instrument_id) {
Ok(values) => values,
Err(e) => {
log::error!(
"Historical open interest request failed for {instrument_id}: {e:?}"
);View on GitHub (pinned to 18893faf8b)
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.
Example fix
// before
let params = RequestParams { instrument_id, data_type: OpenInterestHist, period: None };
// after
let params = RequestParams { instrument_id, data_type: OpenInterestHist, period: Some("5m".into()) }; Defensive patterns
Strategy: validation
Validate before calling
fn validate_open_interest_request(data_type: &str, period: Option<&str>) -> Result<(), String> {
const VALID: [&str; 9] = ["5m","15m","30m","1h","2h","4h","6h","12h","1d"];
if data_type == "open_interest_hist" {
match period {
Some(p) if VALID.contains(&p) => Ok(()),
Some(p) => Err(format!("invalid period {p} for historical open interest")),
None => Err("period required for historical open interest".into()),
}
} else { Ok(()) }
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Instrument not found in cache: {symbol}
- `close_position` cannot be combined with `reduce_only` on Bi
- callbackRate {rate}% out of Binance range [{min_rate}, {max_
- BinanceFuturesDataClient requires UsdM or CoinM product type
- historical open interest request requires `period` metadata
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/69347f325609f8b8.
Report an issue: GitHub.