{"record":{"id":"84a8ee9c5a0ad722","repo":"nautechsystems/nautilus_trader","slug":"invalid-peg-offset-value-s","errorCode":null,"errorMessage":"Invalid peg_offset_value: {s}","messagePattern":"Invalid peg_offset_value: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/bitmex/src/common/parse.rs","lineNumber":522,"sourceCode":"        Some(s) => BitmexPegPriceType::from_str(s)\n            .map(Some)\n            .map_err(|_| anyhow::anyhow!(\"Invalid peg_price_type: {s}\")),\n        None => Ok(None),\n    }\n}\n\n/// Extracts the peg offset value from order command parameters.\n///\n/// # Errors\n///\n/// Returns an error if the value is present but not a valid `f64`.\npub fn parse_peg_offset_value(params: Option<&Params>) -> anyhow::Result<Option<f64>> {\n    let value = params.and_then(|p| p.get_str(\"peg_offset_value\"));\n    match value {\n        Some(s) => s\n            .parse::<f64>()\n            .map(Some)\n            .map_err(|_| anyhow::anyhow!(\"Invalid peg_offset_value: {s}\")),\n        None => Ok(None),\n    }\n}\n\n/// Derives a deterministic [`TradeId`] for BitMEX trades that arrive without a\n/// `trdMatchID` (e.g. certain historical or bucketed rows).\n///\n/// The hash combines the symbol, timestamp, price, size, and side so replayed\n/// data yields the same identifier across runs. FNV-1a is stable across\n/// architectures and crate versions; the 0x1f delimiter keeps variable-length\n/// fields from colliding.\n#[must_use]\npub fn derive_trade_id(\n    symbol: Ustr,\n    ts_event_ns: u64,\n    price: f64,\n    size: i64,\n    side: Option<BitmexSide>,","sourceCodeStart":504,"sourceCodeEnd":540,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bitmex/src/common/parse.rs#L504-L540","documentation":"parse_peg_offset_value reads the optional peg_offset_value string from order command Params and parses it as f64. A present value that is not a valid f64 number produces this error, preventing a malformed peg offset from being sent to BitMEX.","triggerScenarios":"Submitting an order with peg_offset_value in Params set to a non-numeric string (e.g. \"10 bps\", \"1,000\", empty string).","commonSituations":"Strategies formatting the offset with units or locale separators; passing a Decimal-formatted value with commas; wiring a config string directly into Params.","solutions":["Pass peg_offset_value as a plain numeric string, e.g. \"0.005\"","Convert Decimal/price values with a plain to_string (no thousands separators or suffixes) before inserting into Params","Validate the value parses as f64 before submitting"],"exampleFix":"// before\nparams.insert(\"peg_offset_value\", format!(\"{} bps\", offset_bps));\n// after\nparams.insert(\"peg_offset_value\", (offset_bps as f64 / 10000.0).to_string());","handlingStrategy":"validation","validationCode":"fn peg_offset_ok(s: &str) -> bool { s.trim().parse::<f64>().is_ok() }","typeGuard":"fn is_numeric_string(s: &str) -> bool { s.parse::<f64>().is_ok() }","tryCatchPattern":"match client.submit_order(order) {\n    Err(e) if e.to_string().starts_with(\"Invalid peg_offset_value\") => {\n        log::error!(\"peg_offset_value must be a plain f64 string: {e}\");\n    }\n    r => r?,\n}","preventionTips":["Always serialize numeric params with plain to_string() (no units, commas, or suffixes)","Parse-validate config values once at strategy startup","Use f64/Decimal types end-to-end instead of formatted strings"],"tags":["order-submission","parameters","numeric-parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}