{"record":{"id":"da14c628a2505d10","repo":"nautechsystems/nautilus_trader","slug":"failed-to-create-price-from-fill-px-e","errorCode":null,"errorMessage":"Failed to create price from fill px: {e}","messagePattern":"Failed to create price from fill px: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/hyperliquid/src/http/parse.rs","lineNumber":1186,"sourceCode":"            fill.sz,\n        );\n    }\n\n    let trade_id = make_fill_trade_id(\n        &fill.hash,\n        fill.oid,\n        fill.px,\n        fill.sz,\n        fill.time,\n        fill.start_position,\n    );\n    let order_side = parse_fill_side(&fill.side);\n\n    let price_precision = instrument.price_precision();\n    let size_precision = instrument.size_precision();\n\n    let last_px = Price::from_decimal_dp(fill.px, price_precision)\n        .map_err(|e| anyhow::anyhow!(\"Failed to create price from fill px: {e}\"))?;\n    let last_qty = Quantity::from_decimal_dp(fill.sz.abs(), size_precision)\n        .map_err(|e| anyhow::anyhow!(\"Failed to create quantity from fill sz: {e}\"))?;\n\n    let fee_amount = fill.fee;\n\n    let fee_currency = resolve_fee_currency(fill.fee_token.as_str(), fee_amount, instrument)?;\n    let commission = Money::from_decimal(fee_amount, fee_currency)\n        .map_err(|e| anyhow::anyhow!(\"Failed to create commission from fee: {e}\"))?;\n\n    // Determine liquidity side based on 'crossed' flag\n    let liquidity_side = if fill.crossed {\n        LiquiditySide::Taker\n    } else {\n        LiquiditySide::Maker\n    };\n\n    let ts_event = UnixNanos::from(fill.time * 1_000_000);\n    let report_id = UUID4::new();","sourceCodeStart":1168,"sourceCodeEnd":1204,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/hyperliquid/src/http/parse.rs#L1168-L1204","documentation":"Raised in parse_fill_report when Price::from_decimal_dp fails converting fill.px (the trade price) into a domain Price at the instrument's price precision. The Price type uses fixed-point storage, so it rejects negative values, precision above its fixed maximum, and raw-range overflow. This means the venue-reported fill price cannot be represented for this instrument.","triggerScenarios":"Calling fill_reports_from_response (user fills HTTP endpoint) for a fill whose px is negative, has more decimals than price_precision, or whose magnitude overflows PriceRaw during scaling.","commonSituations":"Fills on newly listed or odd-precision assets whose instrument definition precision is stale; exchange returning anomalous fill prices (e.g. zero-liquidity prints); parsing historical fills after the venue changed tick size.","solutions":["Check the fill.px value in the raw response and the instrument's price_precision; refresh instrument definitions if stale","Confirm the fill's coin maps to the correct instrument so the right precision is applied","Round px to instrument precision upstream, or widen the instrument definition's price_precision","Handle per-fill errors so one bad fill doesn't fail the whole fills response"],"exampleFix":"// before\nlet last_px = Price::from_decimal_dp(fill.px, price_precision)\n    .map_err(|e| anyhow::anyhow!(\"Failed to create price from fill px: {e}\"))?;\n// after\nlet last_px = Price::from_decimal_dp(fill.px, price_precision)\n    .map_err(|e| anyhow::anyhow!(\"Failed to create price from fill px {}: {e}\", fill.px))?;","handlingStrategy":"try-catch","validationCode":"# Python: check fill price sanity before requesting fills processing\nassert fill_px > 0, \"fill price must be positive\"","typeGuard":null,"tryCatchPattern":"try:\n    fills = client.request_fill_reports(...)\nexcept ValueError as e:\n    if \"fill px\" in str(e):\n        log.warning(\"skipping unrepresentable fill: %s\", e)\n    else:\n        raise","preventionTips":["Refresh instrument definitions before pulling fills for newly listed assets","Validate px magnitude/scale against instrument precision","Isolate per-fill errors so one bad print doesn't discard the batch"],"tags":["rust","hyperliquid","parsing","fills","price-conversion"],"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-14T05:17:10.506Z"}