nautechsystems/nautilus_trader · error
invalid Futures funding rate at
Error message
invalid Futures funding rate at {}: {e} What it means
Raised when a Binance Futures funding rate entry's funding_rate string cannot be parsed into a Decimal while producing a FundingRateUpdate. The parser (parse_futures_funding_rate_update) requires a valid decimal string; malformed input aborts the conversion. funding_time is included in the message to identify the entry.
Solutions
- Log the raw funding rate entry at the reported funding_time and inspect funding_rate.
- Ensure fixtures/mocks include funding_rate as a numeric string (e.g. "0.00010000").
- Confirm the client queries the current futures funding-info endpoint and the adapter schema matches it.
- Treat individual bad entries as skippable in polling loops, logging instead of failing the whole fetch.
Example fix
// before (fixture)
{"fundingTime": 1700000000000}
// after
{"fundingTime": 1700000000000, "fundingRate": "0.00010000"} Defensive patterns
Strategy: validation
Validate before calling
let _rate: Decimal = rate.funding_rate.parse()
.map_err(|_| format!("bad funding_rate at {}: {}", rate.funding_time, rate.funding_rate))?; Try / catch
match parse_funding_update(&rate, instrument_id, ts_init) {
Ok(update) => emit(update),
Err(e) if e.to_string().contains("invalid Futures funding rate") => skip_and_log(e),
Err(e) => return Err(e.into()),
} Prevention
- Check funding_rate is present and a decimal string before processing.
- Keep fixtures in sync with the live funding endpoint schema.
- Skip-and-log individual bad entries in polling loops.
When it happens
Trigger: Funding rate REST response (premiumIndex/fundingRate endpoints) where rate.funding_rate is empty or not a decimal literal; triggered during futures funding rate polling via BinanceFuturesHttpClient.
Common situations: Fixtures missing the funding_rate field, Binance API schema changes, proxy corruption, or pointing the client at an endpoint that returns a different shape (e.g. mark price stream without fundingRate).
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 precision
- invalid Futures kline
- invalid Futures kline
- invalid Futures kline
- Binance Futures account state request failed
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/7c7800100b63b6ac.
Report an issue: GitHub.
Appendix: source
Thrown at crates/adapters/binance/src/futures/http/client.rs:3348
low,
close,
volume,
quote_volume,
count,
taker_buy_base_volume,
taker_buy_quote_volume,
ts_event,
ts_init,
))
}
fn parse_futures_funding_rate_update(
rate: &BinanceFundingRate,
instrument_id: InstrumentId,
ts_init: UnixNanos,
) -> anyhow::Result<FundingRateUpdate> {
let funding_rate = rate.funding_rate.parse::<Decimal>().map_err(|e| {
anyhow::anyhow!("invalid Futures funding rate at {}: {e}", rate.funding_time)
})?;
let ts_event = parse_millis(rate.funding_time, "Futures funding time")?;
Ok(FundingRateUpdate::new(
instrument_id,
funding_rate,
None, // Funding interval is not provided by the history endpoint
None, // Next funding time is not provided by the history endpoint
ts_event,
ts_init,
))
}
fn parse_futures_commission_rates(
response: &BinanceFuturesCommissionRate,
) -> anyhow::Result<(Decimal, Decimal)> {
Ok((
response.maker_commission_rate.parse()?,View on GitHub (pinned to 18893faf8b)