{"record":{"id":"28ea63e395dcca6a","repo":"nautechsystems/nautilus_trader","slug":"callbackrate-rate-out-of-binance-range-min-ra","errorCode":null,"errorMessage":"callbackRate {rate}% out of Binance range [{min_rate}, {max_rate}]","messagePattern":"callbackRate (.+?)% out of Binance range \\[(.+?), (.+?)\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/conversions.rs","lineNumber":100,"sourceCode":"        Some(true)\n    } else {\n        None\n    }\n}\n\n/// Converts a Nautilus trailing offset (percent) into a Binance `callbackRate` decimal.\n///\n/// # Errors\n///\n/// Returns an error if the computed rate is outside the Binance accepted range\n/// `[0.1%, 10.0%]`.\npub(crate) fn trailing_offset_to_callback_rate(offset: Decimal) -> anyhow::Result<Decimal> {\n    let rate = offset / rust_decimal::Decimal::ONE_HUNDRED;\n    let min_rate = rust_decimal::Decimal::new(1, 1);\n    let max_rate = rust_decimal::Decimal::new(100, 1);\n\n    if rate < min_rate || rate > max_rate {\n        anyhow::bail!(\"callbackRate {rate}% out of Binance range [{min_rate}, {max_rate}]\");\n    }\n\n    Ok(rate)\n}\n\n/// Converts a Nautilus trailing offset (percent) into a Binance `callbackRate` string.\n///\n/// # Errors\n///\n/// Returns an error if the computed rate is outside the Binance accepted range.\npub(crate) fn trailing_offset_to_callback_rate_string(offset: Decimal) -> anyhow::Result<String> {\n    let rate = trailing_offset_to_callback_rate(offset)?;\n    Ok(format_callback_rate(rate))\n}\n\n/// Formats a `callbackRate` decimal for Binance request params.\n///\n/// Whole percents are rendered with a trailing `.0` to match Binance examples.","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/futures/conversions.rs#L82-L118","documentation":"trailing_offset_to_callback_rate converts a Nautilus trailing-stop offset (percent) into Binance's callbackRate (percent as a 0-10 decimal fraction). Binance only accepts callbackRate between 1% and 10% (i.e. 0.01-0.10); offsets outside that range are rejected with this error.","triggerScenarios":"Submitting or validating a TRAILING_STOP/trailing-stop-market order whose trailing offset is < 1% or > 10%, e.g. offset=0.5 or offset=15; also reached via trailing_offset_to_callback_rate_string and validate_order.","commonSituations":"Porting a strategy from another venue with looser trailing-stop bounds (e.g. 0.1% or 20% trails); computing the offset from volatility and landing outside Binance's allowed band; confusing percent vs fraction units.","solutions":["Clamp the trailing offset into the 1-10% range before submitting the order","Set the strategy's trailing offset parameter within [1, 10] percent","Catch the error in validate_order and surface a clear configuration error to the user"],"exampleFix":"// before\nlet offset = Decimal::new(15, 0); // 15%\nlet rate = trailing_offset_to_callback_rate(offset)?;\n// after\nlet offset = Decimal::new(15, 0).min(Decimal::from(10)).max(Decimal::from(1));\nlet rate = trailing_offset_to_callback_rate(offset)?;","handlingStrategy":"validation","validationCode":"use rust_decimal::Decimal;\nfn is_binance_callback_rate_ok(offset_pct: Decimal) -> bool {\n    offset_pct >= Decimal::ONE && offset_pct <= Decimal::from(10)\n}","typeGuard":"fn is_valid_trailing_offset(offset: Decimal) -> bool {\n    offset >= Decimal::ONE && offset <= Decimal::from(10)\n}","tryCatchPattern":"match trailing_offset_to_callback_rate_string(offset) {\n    Err(e) if e.to_string().contains(\"out of Binance range\") => {\n        let clamped = offset.clamp(Decimal::ONE, Decimal::from(10));\n        trailing_offset_to_callback_rate_string(clamped)?\n    }\n    r => r?,\n}","preventionTips":["Enforce 1-10% bounds on trailing offsets in strategy parameter validation","Clamp volatility-derived offsets before order submission","Remember Binance callbackRate is 1-10% only; other venues differ"],"tags":["rust","binance","futures","trailing-stop","value-range"],"backgroundTag":"argument-out-of-range","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"}