{"record":{"id":"7fc954348aad2d7b","repo":"nautechsystems/nautilus_trader","slug":"failed-to-build-order-params-e-7fc954","errorCode":null,"errorMessage":"Failed to build order params: {e}","messagePattern":"Failed to build order params: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/kraken/src/http/spot/client.rs","lineNumber":3181,"sourceCode":"\n            if !valid_tiers.contains(&(n as i32)) {\n                anyhow::bail!(\n                    \"Leverage {n}:1 not supported for {raw_symbol} on {side_label} side (valid: {valid_tiers:?})\"\n                );\n            }\n            builder.leverage(format!(\"{n}:1\"));\n        }\n\n        if reduce_only {\n            if account_type != AccountType::Margin {\n                anyhow::bail!(\"reduce_only requires spot_account_type=Margin (current: Cash)\");\n            }\n            builder.reduce_only(true);\n        }\n\n        builder\n            .build()\n            .map_err(|e| anyhow::anyhow!(\"Failed to build order params: {e}\"))\n    }\n}\n\nfn collect_spot_statuses(\n    asset_pairs: &AssetPairsResponse,\n) -> AHashMap<InstrumentId, MarketStatusAction> {\n    asset_pairs\n        .iter()\n        .map(|(_, definition)| {\n            let symbol_str = definition.wsname.as_ref().unwrap_or(&definition.altname);\n            let normalized_symbol = normalize_spot_symbol(symbol_str.as_str());\n            let instrument_id = InstrumentId::new(Symbol::new(&normalized_symbol), *KRAKEN_VENUE);\n            let action = definition\n                .status\n                .map_or(MarketStatusAction::Trading, MarketStatusAction::from);\n\n            (instrument_id, action)\n        })","sourceCodeStart":3163,"sourceCodeEnd":3199,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/kraken/src/http/spot/client.rs#L3163-L3199","documentation":"The spot order submission converts a Nautilus order request into Kraken `PlaceOrderParams` via a builder. When `build()` fails its validation checks (invalid combination of side, type, prices, quantities, TIF, etc.), the adapter wraps the error in this message. No HTTP request is sent; the problem is purely in the constructed parameters.","triggerScenarios":"Placing a spot order with parameters the builder rejects: missing price on a limit order, invalid order-type/field combinations, non-positive quantity or price, leverage/trigger fields invalid per the builder's rules.","commonSituations":"Strategy emits a limit order with a None/unset price; zero or negative quantity from position math; post-only/reduce-only flags combined in ways Kraken's param schema disallows; precision-lost price strings.","solutions":["Read the inner `{e}` message to identify the failed builder validation.","Ensure required fields per order type are set (price for limit orders, stop/trigger price for conditional orders).","Validate quantity and prices are positive and correctly formatted (use Price/Quantity `to_string()`).","Check TIF and flags (post_only, reduce_only, leverage) form a combination Kraken spot accepts."],"exampleFix":"// before\nbuilder.order_type(\"limit\"); // no price set -> build() fails\n// after\nbuilder.order_type(\"limit\").price(order.price().unwrap().to_string());","handlingStrategy":"validation","validationCode":"fn validate_order(req: &OrderRequest) -> Result<(), String> {\n    if req.quantity <= Decimal::ZERO { return Err(\"quantity must be positive\".into()); }\n    if req.order_type == \"limit\" && req.price.map_or(true, |p| p <= Decimal::ZERO) {\n        return Err(\"limit order requires a positive price\".into());\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"match client.submit_order(req).await {\n    Ok(resp) => resp,\n    Err(e) if e.to_string().contains(\"Failed to build order params\") => {\n        log::error!(\"malformed order request {:?}: {e}\", req);\n        return Err(e); // do not retry; fix the request\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Build orders with domain Price/Quantity types and convert via to_string() to keep precision","Ensure each order type has its required fields (limit needs price, stops need trigger price)","Unit-test param building for each order-type/TIF combination your strategy uses"],"tags":["order-submission","params-builder","validation","kraken"],"backgroundTag":"schema-validation-failed","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"}