nautechsystems/nautilus_trader · error · anyhow::Error
invalid {field} precision: {e}
Error message
invalid {field} precision: {e} What it means
parse_positive_price_at_precision converts a raw price string from a Binance Futures algo-order update into a Nautilus Price at the instrument's price precision. Price::from_decimal_dp rounds to the target precision but still fails when the instrument precision exceeds the model's FIXED_PRECISION, the value cannot be converted to the fixed-point raw representation, or scaling overflows/out-ranges PriceRaw. The field name (trigger_price or price) is included in the message.
Source
Thrown at crates/adapters/binance/src/futures/websocket/streams/parse_exec.rs:435
return None;
}
Price::from_decimal_dp(decimal, precision).ok()
}
fn parse_positive_price_at_precision(
raw: &str,
precision: u8,
field: &str,
) -> anyhow::Result<Option<Price>> {
let decimal = parse_required_decimal(raw, field)?;
if decimal <= Decimal::ZERO {
return Ok(None);
}
Price::from_decimal_dp(decimal, precision)
.map(Some)
.map_err(|e| anyhow::anyhow!("invalid {field} precision: {e}"))
}
fn parse_algo_trigger_price(
algo_data: &AlgoOrderUpdateData,
price_precision: u8,
) -> anyhow::Result<Option<Price>> {
let trigger_price = parse_positive_price_at_precision(
&algo_data.trigger_price,
price_precision,
"trigger_price",
)?;
if trigger_price.is_none() && requires_algo_trigger_price(algo_data.order_type) {
anyhow::bail!(
"missing positive trigger_price for Binance algo order type {:?}",
algo_data.order_type
);
}View on GitHub (pinned to a4b06ed870)
Solutions
- Check the log line for which field failed and the underlying {e}; compare the raw value and the instrument's price precision
- Refresh the Binance Futures instrument definitions (exchangeInfo) so price precision matches the venue, then re-run
- If the venue legitimately sends values outside the representable range, report upstream with the raw algo order update payload
- Update to the latest adapter version in case the precision mapping was corrected
Defensive patterns
Strategy: validation
Validate before calling
use rust_decimal::Decimal;
fn fits_price_precision(price: Decimal, price_precision: u8) -> bool {
// Price::from_decimal_dp rounds, so only range/precision limits matter:
// reject absurd values and precisions beyond the model's fixed maximum.
price.abs() < Decimal::from(1_000_000_000u64) && price_precision <= 18
}
let trigger = Decimal::from_str_exact(&raw_trigger_price)?;
assert!(fits_price_precision(trigger, instrument.price_precision), "trigger price not representable"); Try / catch
Wrap per-message algo-order parsing in an error boundary: log the field name and raw string from the error, skip that update, and keep the stream running; alert if failures repeat for the same symbol (indicates stale instrument metadata).
Prevention
- Refresh instrument definitions after Binance tick-size/precision changes
- Place orders at tick-aligned prices
- Alert on repeated precision failures per symbol to catch metadata drift early
When it happens
Trigger: An algo order update whose trigger_price or price string cannot be represented as a Price at the given instrument precision: precision metadata above the model maximum, or a value whose scaled mantissa overflows the fixed-point PriceRaw range (extremely large or extremely fine-grained values).
Common situations: Stale instrument cache built before Binance changed a symbol's precision or tick size; new listings whose metadata was guessed with an out-of-range precision; symbols with very high precision and very large mantissas.
Related errors
- Algo order type {order_type:?} requires a trigger price
- Invalid price_match value: {s:?}
- Unsupported underlying type '{underlying_type}' for TRADIFI_
- callbackRate {rate}% out of Binance range [{min_rate}, {max_
- BinanceFuturesDataClient requires UsdM or CoinM product type
AI-assisted analysis of nautechsystems/nautilus_trader@a4b06ed870 (2026-08-16).
Data as JSON: /api/errors/61b6e12e5e85e383.
Report an issue: GitHub.