nautechsystems/nautilus_trader · error · anyhow::Error
Pegged orders only supported for LIMIT order type, was {orde
Error message
Pegged orders only supported for LIMIT order type, was {order_type:?} What it means
BitMEX pegged orders are only allowed on LIMIT order types. If the order specifies a peg_price_type but its order type is not Limit (e.g. Market), validate_order_for_bitmex_submit bails with this message before any request reaches the venue.
Source
Thrown at crates/adapters/bitmex/src/execution.rs:1315
let is_trailing_stop = matches!(
order.order_type(),
OrderType::TrailingStopMarket | OrderType::TrailingStopLimit
);
if is_trailing_stop
&& let Some(offset_type) = order.trailing_offset_type()
&& offset_type != TrailingOffsetType::Price
{
anyhow::bail!("BitMEX only supports PRICE trailing offset type, was {offset_type:?}");
}
if peg_price_type.is_none() && peg_offset_value.is_some() {
anyhow::bail!("`peg_offset_value` requires `peg_price_type`");
}
if peg_price_type.is_some() && order.order_type() != OrderType::Limit {
let order_type = order.order_type();
anyhow::bail!("Pegged orders only supported for LIMIT order type, was {order_type:?}");
}
if let Some(contingency_type) = order.contingency_type() {
BitmexContingencyType::try_from(contingency_type)?;
}
Ok(())
}
fn is_definitive_bitmex_submit_rejection(err: &anyhow::Error) -> bool {
if is_bitmex_duplicate_clordid_submit_failure(err) {
return false;
}
if has_bitmex_api_refusal(err) {
return true;
}
View on GitHub (pinned to 18893faf8b)
Solutions
- Change the order type to OrderType::Limit when pegging
- Remove peg_price_type from non-limit orders
- Branch the submit path so peg parameters are only applied for limit orders
Example fix
// before OrderType::Market with peg_price_type Some(PrimaryPeg) // after OrderType::Limit with peg_price_type Some(PrimaryPeg)
Defensive patterns
Strategy: validation
Validate before calling
if peg_price_type.is_some() && order.order_type() != OrderType::Limit {
return Err(anyhow::anyhow!("pegged orders require OrderType::Limit"));
} Prevention
- Only attach peg parameters to Limit orders
- Match on order type before applying venue-specific params
- Test pegged submits with both limit and market orders
When it happens
Trigger: Calling validate_order_for_bitmex_submit (or submit_cached_order) with peg_price_type=Some(...) on a Market, Stop, StopLimit non-limit, or otherwise non-Limit order.
Common situations: Converting a market order to a pegged order; applying peg parameters generically across a strategy that also sends market orders.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- `peg_offset_value` requires `peg_price_type`
- `peg_offset_value` requires `peg_price_type`
- Pegged orders only supported for LIMIT order type, was {orde
- BitMEX only supports PRICE trailing offset type, was {offset
- venue_order_ids cannot be empty
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/ea0b8142f3baab3c.
Report an issue: GitHub.