nautechsystems/nautilus_trader · error
Ask required
Error message
Ask required
What it means
Same quote-dependency as the 'Bid required' error: for `TriggerType::Default`, `BidAsk`, or `LastOrBidAsk` the trailing basis is the ask (for Buy side) or bid (for Sell side), and both quotes must be supplied. Here `ask: Option<Price>` was `None`, so the calculation cannot proceed and returns this anyhow error.
Source
Thrown at crates/execution/src/trailing.rs:137
match trigger_type {
TriggerType::LastPrice | TriggerType::MarkPrice => {
let last = last.ok_or(OrderError::InvalidStateTransition)?;
let cand_trigger = compute(trailing_offset, last)?;
new_trigger_price = maybe_move(&mut trigger_price, cand_trigger, better_trigger);
if order_type == OrderType::TrailingStopLimit {
let limit_offset = order.limit_offset().ok_or_else(|| {
anyhow::anyhow!("Missing `limit_offset` for trailing stop limit calculation")
})?;
let cand_limit = compute(limit_offset, last)?;
new_limit_price = maybe_move(&mut limit_price, cand_limit, better_limit);
}
}
TriggerType::Default | TriggerType::BidAsk | TriggerType::LastOrBidAsk => {
let (bid, ask) = (
bid.ok_or_else(|| anyhow::anyhow!("Bid required"))?,
ask.ok_or_else(|| anyhow::anyhow!("Ask required"))?,
);
let basis = match order_side {
OrderSide::Buy => ask,
OrderSide::Sell => bid,
};
let cand_trigger = compute(trailing_offset, basis)?;
new_trigger_price = maybe_move(&mut trigger_price, cand_trigger, better_trigger);
if order_type == OrderType::TrailingStopLimit {
let limit_offset = order.limit_offset().ok_or_else(|| {
anyhow::anyhow!("Missing `limit_offset` for trailing stop limit calculation")
})?;
let cand_limit = compute(limit_offset, basis)?;
new_limit_price = maybe_move(&mut limit_price, cand_limit, better_limit);
}
if trigger_type == TriggerType::LastOrBidAsk {
let last = last.ok_or_else(|| anyhow::anyhow!("Last required"))?;View on GitHub (pinned to 18893faf8b)
Solutions
- Pass the current `ask` (and `bid`) from the quote cache when invoking the calculator.
- Defer the update until both bid and ask are present: check `ask.is_some() && bid.is_some()` before calling.
- Use a `LastPrice`/`MarkPrice` trigger type instead if only last-trade data is reliably available.
- Verify the market-data subscription is configured for quotes on the instrument.
Example fix
// before
let result = trailing_stop_calculate(increment, None, &order, bid, None, last)?;
// after
if let (Some(bid), Some(ask)) = (bid, ask) {
let result = trailing_stop_calculate(increment, None, &order, Some(bid), Some(ask), last)?;
} else {
// defer update until quotes available
} Defensive patterns
Strategy: validation
Validate before calling
fn ask_available(ask: Option<Price>, trigger_type: TriggerType) -> Result<(), String> {
if matches!(trigger_type, TriggerType::Default | TriggerType::BidAsk | TriggerType::LastOrBidAsk)
&& ask.is_none()
{
return Err("ask quote not yet available; defer trailing update".into());
}
Ok(())
} Try / catch
if let Err(e) = update_trailing_stop_order(&mut order, bid, ask, last) {
if e.to_string().contains("Ask required") {
// retry on next quote tick
return Ok(());
}
return Err(e.into());
} Prevention
- Guard with `bid.is_some() && ask.is_some()` before invoking the trailing calculation.
- Ensure quote subscriptions are established and warmed up before arming trailing stop orders.
- Monitor feed health: a persistent missing ask usually indicates a subscription or venue connectivity issue.
When it happens
Trigger: Calling `trailing_stop_calculate`/`update_trailing_stop_order` with `trigger_type` in {Default, BidAsk, LastOrBidAsk} and `ask: None` — typical when only the bid side of the book is populated or no ask quote has been received yet.
Common situations: Fresh instrument subscription where the ask hasn't arrived; one-sided/illiquid book; feed disruption dropping ask updates; strategy passing only trade data while the order expects quotes.
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
- Bid required
- callbackRate {rate}% out of Binance range [{min_rate}, {max_
- BitMEX only supports PRICE trailing offset type, was {offset
- Unknown IB historical tick type: {value}
- Subscription error: {e:?}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/7dcd513d126ecfc2.
Report an issue: GitHub.