nautechsystems/nautilus_trader · error
leverage requires spot_account_type=Margin (current: Cash)
Error message
leverage requires spot_account_type=Margin (current: Cash)
What it means
Leverage on Kraken Spot is only available on margin accounts. The adapter checks the configured spot account type before applying leverage and fails fast when the account is a Cash account, because Kraken's API would otherwise reject or misinterpret the leverage field.
Source
Thrown at crates/adapters/kraken/src/http/spot/client.rs:3141
if let Some(tif) = timeinforce {
builder.timeinforce(tif);
}
if let Some(expire) = expiretm {
builder.expiretm(expire);
}
if let Some(dq) = display_qty {
builder.displayvol(dq.to_string());
}
if let Some(ac) = asset_class {
builder.asset_class(ac);
}
if leverage.is_some() && account_type != AccountType::Margin {
anyhow::bail!("leverage requires spot_account_type=Margin (current: Cash)");
}
if let Some(n) = leverage {
let tiers = self.leverage_tiers_cache.get_cloned(&raw_symbol);
let (buy_tiers, sell_tiers) = tiers.ok_or_else(|| {
anyhow::anyhow!(
"Leverage tiers not loaded for {raw_symbol}; cannot validate leverage {n}:1 (instruments must be initialized before submitting margin orders)"
)
})?;
let valid_tiers = match order_side {
OrderSide::Buy => buy_tiers,
_ => sell_tiers,
};
let side_label = match order_side {
OrderSide::Buy => "buy",
_ => "sell",
};
View on GitHub (pinned to 18893faf8b)
Solutions
- Reconfigure the client with spot_account_type = AccountType::Margin.
- Remove the leverage parameter from the order request if cash trading is intended.
- Verify the Kraken account actually has margin enabled, since the account type in config must match the real Kraken account.
Example fix
// before spot_account_type: AccountType::Cash, leverage: Some(3) // after spot_account_type: AccountType::Margin, leverage: Some(3)
Defensive patterns
Strategy: validation
Validate before calling
if leverage.is_some() && account_config.spot_account_type != AccountType::Margin {
return Err("leverage requested but account is Cash; use Margin or drop leverage");
} Try / catch
if let Err(e) = client.submit_order(req) {
if e.to_string().contains("requires spot_account_type=Margin") {
// reconfigure to Margin or resubmit without leverage
}
} Prevention
- Keep spot_account_type in config in sync with the actual Kraken account.
- Assert at strategy startup that margin config matches order intents.
- Fail fast at config load if leverage is configured for a Cash account.
When it happens
Trigger: Submitting a Kraken Spot order with leverage set to Some(n) while the client is configured with spot_account_type = AccountType::Cash.
Common situations: Default account configuration left as Cash while running a strategy that trades with leverage; switching strategies from a margin account to a cash account without removing leverage parameters.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- reduce_only requires spot_account_type=Margin (current: Cash
- Leverage not supported for {raw_symbol} on {side_label} side
- Leverage {n}:1 not supported for {raw_symbol} on {side_label
- Leverage tiers not loaded for {raw_symbol}; cannot validate
- Kraken Spot does not support the demo environment
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/69ed1dc450ff64f0.
Report an issue: GitHub.