{"record":{"id":"9eed19af5be93beb","repo":"nautechsystems/nautilus_trader","slug":"invalid-field-precision-e","errorCode":null,"errorMessage":"invalid {field} precision: {e}","messagePattern":"invalid (.+?) precision: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/http/models.rs","lineNumber":1768,"sourceCode":"    raw.filter(|price| !price.is_empty())\n        .map(|price| parse_positive_price_at_precision(price, price_precision, \"avg_price\"))\n        .transpose()\n        .map(|price| price.flatten().map(|price| price.as_decimal()))\n}\n\nfn parse_positive_price_at_precision(\n    raw: &str,\n    precision: u8,\n    field: &str,\n) -> anyhow::Result<Option<Price>> {\n    let decimal = parse_required_decimal(raw, field)?;\n    if decimal <= Decimal::ZERO {\n        return Ok(None);\n    }\n\n    Price::from_decimal_dp(decimal, precision)\n        .map(Some)\n        .map_err(|e| anyhow::anyhow!(\"invalid {field} precision: {e}\"))\n}\n\nfn parse_callback_rate_basis_points(raw: &str) -> anyhow::Result<Option<Decimal>> {\n    let rate = parse_required_decimal(raw, \"callback_rate\")?;\n    if rate <= Decimal::ZERO {\n        return Ok(None);\n    }\n\n    rate.checked_mul(Decimal::from(100))\n        .map(Some)\n        .ok_or_else(|| anyhow::anyhow!(\"invalid callback_rate='{raw}': multiplication overflow\"))\n}\n\nfn parse_working_type(working_type: Option<BinanceWorkingType>) -> TriggerType {\n    match working_type {\n        Some(BinanceWorkingType::ContractPrice) => TriggerType::LastPrice,\n        Some(BinanceWorkingType::MarkPrice) => TriggerType::MarkPrice,\n        Some(BinanceWorkingType::Unknown) | None => TriggerType::Default,","sourceCodeStart":1750,"sourceCodeEnd":1786,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/futures/http/models.rs#L1750-L1786","documentation":"Raised when converting a parsed decimal into a Price at the required precision fails via Price::from_decimal_dp — the value has more decimal places than the instrument's precision permits (or is otherwise not representable at that precision). The {field} placeholder names which order/quantity field (e.g. price, stopPrice) failed. It guards against constructing invalid domain prices from Futures order payloads.","triggerScenarios":"A Futures model field parsed as a decimal has fractional precision exceeding the configured precision — e.g. building order/position models from REST payloads where a price string like \"0.123456789\" is checked against a smaller precision; parse_optional_price helper in futures/http/models.rs:1768.","commonSituations":"Wrong precision constant for the symbol (spot vs futures tick size), newly listed symbols with unusual tick sizes, adapter metadata not refreshed after Binance precision changes.","solutions":["Verify the precision passed to the parser matches the symbol's exchangeInfo tickSize for Futures.","Refresh/rebuild instrument definitions so precision metadata is current.","Truncate or round the incoming decimal to the instrument precision at the boundary before constructing Price, if lossy input is acceptable.","Log the field name and raw value from the error to pinpoint which payload field needs adjustment."],"exampleFix":"// before\nlet precision = 4; // stale\nPrice::from_decimal_dp(decimal, precision)\n// after\nlet precision = instrument.price_precision; // from latest exchangeInfo\nPrice::from_decimal_dp(decimal.round_dp(precision), precision)","handlingStrategy":"validation","validationCode":"let d: Decimal = raw.parse()?;\nif d.scale() > precision as u32 {\n    return Err(format!(\"{field} {} has {} dp, exceeds precision {precision}\", raw, d.scale()));\n}","typeGuard":null,"tryCatchPattern":"match parse_price_field(&raw, precision, \"price\") {\n    Ok(Some(price)) => use(price),\n    Ok(None) => {}, // absent/zero: optional field\n    Err(e) if e.to_string().contains(\"precision\") => refresh_instrument_metadata(),\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Source precision from the latest exchangeInfo, not constants.","Re-sync instrument definitions when Binance changes tick sizes.","Round inputs to the instrument precision at system boundaries."],"tags":["binance","futures","price","precision","decimal-parsing"],"backgroundTag":"invalid-argument-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}