nautechsystems/nautilus_trader · error
invalid Futures kline
Error message
invalid Futures kline {} taker buy base volume: {e} What it means
Raised when kline.taker_buy_base_volume cannot be parsed into a Decimal during Futures kline conversion. The value must be a valid decimal string; empty or malformed input aborts bar construction. The message includes the kline open_time for correlation with the raw payload.
Solutions
- Inspect the raw response for the reported open_time and verify taker_buy_base_volume is present as a numeric string.
- Update mocks/fixtures to match the current Binance futures kline schema.
- Confirm the adapter version supports the current API schema; upgrade the crate if Binance changed field formats.
- Handle by skipping and logging the candle if the data source is known to be unreliable.
Example fix
// before (fixture) "takerBuyBaseVolume": null // after "takerBuyBaseVolume": "123.456"
Defensive patterns
Strategy: validation
Validate before calling
let _tbb: Decimal = kline.taker_buy_base_volume.parse()
.map_err(|_| format!("bad taker_buy_base_volume: {}", kline.taker_buy_base_volume))?; Try / catch
match convert_kline(&kline) {
Ok(bar) => emit(bar),
Err(e) if e.to_string().contains("taker buy base volume") => skip_and_log(e),
Err(e) => return Err(e.into()),
} Prevention
- Ensure test mocks include all current kline fields.
- Regenerate fixtures from live API responses when tests fail.
- Check adapter version against Binance changelog.
When it happens
Trigger: Futures kline REST response with taker_buy_base_volume missing, empty, or non-numeric; encountered in BinanceFuturesHttpClient kline parsing (client.rs:3305).
Common situations: Outdated API mocks/fixtures lacking newer kline fields, schema drift after Binance API updates, proxies or cache layers returning truncated JSON.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- invalid Futures kline
- invalid Futures kline
- invalid precision
- invalid Futures funding rate at
- invalid Futures kline
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/02aec2dfd16e4324.
Report an issue: GitHub.
Appendix: source
Thrown at crates/adapters/binance/src/futures/http/client.rs:3305
.map_err(|e| anyhow::anyhow!("invalid Futures kline {}: {e}", kline.open_time))?;
let close = parse_required_price_at_precision(&kline.close, price_precision, "kline.close")
.map_err(|e| anyhow::anyhow!("invalid Futures kline {}: {e}", kline.open_time))?;
let volume =
parse_required_quantity_at_precision(&kline.volume, size_precision, "kline.volume")
.map_err(|e| anyhow::anyhow!("invalid Futures kline {}: {e}", kline.open_time))?;
let ts_event = parse_millis(kline.close_time, "Futures kline close time")?;
let quote_volume = kline.quote_volume.parse::<Decimal>().map_err(|e| {
anyhow::anyhow!(
"invalid Futures kline {} quote volume: {e}",
kline.open_time
)
})?;
let taker_buy_base_volume = kline
.taker_buy_base_volume
.parse::<Decimal>()
.map_err(|e| {
anyhow::anyhow!(
"invalid Futures kline {} taker buy base volume: {e}",
kline.open_time
)
})?;
let taker_buy_quote_volume = kline
.taker_buy_quote_volume
.parse::<Decimal>()
.map_err(|e| {
anyhow::anyhow!(
"invalid Futures kline {} taker buy quote volume: {e}",
kline.open_time
)
})?;
let count = u64::try_from(kline.num_trades).map_err(|_| {
anyhow::anyhow!(
"invalid Futures kline {} negative trade count",
kline.open_time
)View on GitHub (pinned to 18893faf8b)