nautechsystems/nautilus_trader · error · anyhow::Error
limit_price is required for order type {order_type:?}
Error message
limit_price is required for order type {order_type:?} What it means
Limit-style Kraken WS orders (Limit, StopLimit, LimitIfTouched) require a limit price. build_add_order_params checks order.price() and bails when a limit-order type is submitted without one, since the Kraken API has no field to fill it from.
Source
Thrown at crates/adapters/kraken/src/common/order_params.rs:90
}
let kraken_order_type = match order_type {
OrderType::Market => KrakenOrderType::Market,
OrderType::Limit => KrakenOrderType::Limit,
OrderType::StopMarket => KrakenOrderType::StopLoss,
OrderType::StopLimit => KrakenOrderType::StopLossLimit,
OrderType::MarketIfTouched => KrakenOrderType::TakeProfit,
OrderType::LimitIfTouched => KrakenOrderType::TakeProfitLimit,
_ => anyhow::bail!("Unsupported order type for Kraken WS: {order_type:?}"),
};
let is_limit_order = matches!(
order_type,
OrderType::Limit | OrderType::StopLimit | OrderType::LimitIfTouched
);
if is_limit_order && order.price().is_none() {
anyhow::bail!("limit_price is required for order type {order_type:?}");
}
let ws_tif = compute_ws_time_in_force(is_limit_order, time_in_force, order.expire_time())?;
let expire_time = match (ws_tif, order.expire_time()) {
(Some(KrakenTimeInForce::GoodTilDate), Some(ts)) => Some(format_expire_time(ts)),
_ => None,
};
let is_conditional = matches!(
order_type,
OrderType::StopMarket
| OrderType::StopLimit
| OrderType::MarketIfTouched
| OrderType::LimitIfTouched
);
let limit_price = order.price().map(|p| p.as_decimal());
View on GitHub (pinned to 18893faf8b)
Solutions
- Ensure a price is set when creating Limit/StopLimit/LimitIfTouched orders via the order factory.
- Guard the strategy: compute a fallback or skip submission when the limit price cannot be determined.
- Log/inspect order.price() before submission to confirm it is Some for all limit-style orders.
Example fix
// before
let price = best_bid(instrument_id); // may be None
submit(limit_order(price));
// after
let Some(price) = best_bid(instrument_id) else {
anyhow::bail!("no market data to derive limit price for {instrument_id}");
};
submit(limit_order(Some(price))); Defensive patterns
Strategy: validation
Validate before calling
if matches!(order.order_type(), OrderType::Limit | OrderType::StopLimit | OrderType::LimitIfTouched)
&& order.price().is_none() {
return Err(anyhow::anyhow!("{} requires a limit price", order.order_type()));
} Prevention
- Always construct limit-style orders with an explicit price from the order factory.
- Never derive prices from market data that can be empty without a None check.
- Cover price-required invariants with unit tests on order builders.
When it happens
Trigger: Submitting a Limit, StopLimit, or LimitIfTouched order via Kraken WS where order.price() returns None — i.e. the order was constructed without a limit price or with a null price.
Common situations: A bug in order construction (price left unset), strategies that dynamically compute prices where a computation can yield None (e.g. no quotes yet), or reusing market-order builders for limit orders.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Trailing stop orders are not yet supported on the Kraken WS
- Iceberg (display_qty) orders are not supported on the Kraken
- Unsupported order type for Kraken WS: {order_type:?}
- Unsupported trigger type for Kraken Spot WS: {other:?} (only
- trigger_price is required for conditional order type {order_
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/f9fdd28eba50150e.
Report an issue: GitHub.