nautechsystems/nautilus_trader · error · anyhow::Error
BitMEX only supports PRICE trailing offset type, was {offset
Error message
BitMEX only supports PRICE trailing offset type, was {offset_type:?} What it means
validate_order_for_bitmex_submit checks trailing stop orders before submission: BitMEX pegged (trailing) orders only support a Price-based trailing offset. If the order's trailing_offset_type is anything other than TrailingOffsetType::Price, validation bails with this error naming the offending offset type.
Source
Thrown at crates/adapters/bitmex/src/execution.rs:1306
fn validate_order_for_bitmex_submit(
order: &OrderAny,
peg_price_type: Option<BitmexPegPriceType>,
peg_offset_value: Option<f64>,
) -> anyhow::Result<()> {
BitmexOrderType::try_from_order_type(order.order_type())?;
BitmexTimeInForce::try_from_time_in_force(order.time_in_force())?;
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(())
}
View on GitHub (pinned to 18893faf8b)
Solutions
- Configure the trailing stop order with trailing_offset_type = TrailingOffsetType::Price
- Convert percentage/tick offsets to absolute price offsets in strategy logic before submit
- Route non-price trailing offset orders to a venue that supports them
Example fix
// before let order = factory.trailing_stop_market(..., trailing_offset_type=TrailingOffsetType::Percent); // after let order = factory.trailing_stop_market(..., trailing_offset_type=TrailingOffsetType::Price, trailing_offset=Price::new(abs_offset));
Defensive patterns
Strategy: validation
Validate before calling
if order.order_type().is_trailing_stop()
&& order.trailing_offset_type() != TrailingOffsetType::Price {
return Err("BitMEX trailing stops require TrailingOffsetType::Price");
} Prevention
- Configure trailing stops with absolute price offsets for BitMEX
- Convert percent/tick offsets to price offsets before submit
- Add per-venue trailing order validation in strategy pre-trade checks
When it happens
Trigger: Submitting a trailing stop market/limit order to BitMEX whose trailing_offset_type is e.g. Basis, Percent, or Ticks instead of Price.
Common situations: Strategies configured with percentage or tick trailing offsets (portable across other venues) routed to BitMEX, which only accepts absolute price offsets via its pegged order mechanism.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- BitMEX only supports PRICE trailing offset type, was {offset
- `peg_offset_value` requires `peg_price_type`
- Pegged orders only supported for LIMIT order type, was {orde
- `peg_offset_value` requires `peg_price_type`
- Pegged orders only supported for LIMIT order type, was {orde
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/f52d5509a80dc69c.
Report an issue: GitHub.