{"record":{"id":"ad15e2322ec20de2","repo":"nautechsystems/nautilus_trader","slug":"leverage-n-1-not-supported-for-raw-symbol-on","errorCode":null,"errorMessage":"Leverage {n}:1 not supported for {raw_symbol} on {side_label} side (valid: {valid_tiers:?})","messagePattern":"Leverage (.+?):1 not supported for (.+?) on (.+?) side \\(valid: (.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/kraken/src/http/spot/client.rs","lineNumber":3165,"sourceCode":"                anyhow::anyhow!(\n                    \"Leverage tiers not loaded for {raw_symbol}; cannot validate leverage {n}:1 (instruments must be initialized before submitting margin orders)\"\n                )\n            })?;\n            let valid_tiers = match order_side {\n                OrderSide::Buy => buy_tiers,\n                _ => sell_tiers,\n            };\n            let side_label = match order_side {\n                OrderSide::Buy => \"buy\",\n                _ => \"sell\",\n            };\n\n            if valid_tiers.is_empty() {\n                anyhow::bail!(\"Leverage not supported for {raw_symbol} on {side_label} side\");\n            }\n\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}","sourceCodeStart":3147,"sourceCodeEnd":3183,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/kraken/src/http/spot/client.rs#L3147-L3183","documentation":"When Kraken does offer leverage tiers for the symbol/side, they form a discrete set of allowed levels (e.g. [2, 3, 4, 5]). The adapter validates the requested leverage against these valid tiers and rejects levels not in the set, including the exact supported values in the message.","triggerScenarios":"Submitting a Kraken Spot margin order with leverage Some(n) where n (as i32) is not contained in valid_tiers for the symbol and order side — e.g. requesting 10:1 when the instrument only allows up to 5:1 with steps of 2 and 3.","commonSituations":"Hard-coding a max leverage from another venue; assuming continuous leverage levels instead of Kraken's discrete tiers; a config upgrade after Kraken changed tier offerings.","solutions":["Read the valid tiers from the error message and set leverage to one of the listed values.","Query Kraken's current leverage tier data for the instrument before sizing leverage.","Clamp/snap the strategy's desired leverage down to the nearest supported tier in order-construction logic."],"exampleFix":"// before\nleverage: Some(10) // valid tiers: [2, 3, 5]\n// after\nleverage: Some(5)","handlingStrategy":"validation","validationCode":"let valid: Vec<i32> = tiers_for(symbol, side);\nlet n = desired_leverage as i32;\nif !valid.contains(&n) {\n    desired_leverage = *valid.iter().filter(|&&v| v <= n).max().unwrap_or(&1);\n}","typeGuard":null,"tryCatchPattern":"match submit_result {\n    Err(e) if e.to_string().contains(\"not supported\") && e.to_string().contains(\"valid:\") => {\n        // parse valid tiers from the message and resubmit with a supported level\n    }\n    r => r?,\n}","preventionTips":["Snap requested leverage to the nearest published Kraken tier before submitting.","Never assume leverage levels are continuous across venues.","Re-verify tiers after Kraken announcements of margin changes."],"tags":["kraken","spot","leverage","margin-tiers","validation"],"backgroundTag":"value-out-of-range","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"}