nautechsystems/nautilus_trader · error
Unsupported algo order type: {:?}
Error message
Unsupported algo order type: {:?} What it means
parse_algo_order_fields maps OKX algo order ord_type values to Nautilus OrderType variants; anything outside the supported set (e.g. unexpected or newly added OKX algo types) hits the catch-all arm and bails. The library cannot represent that algo order type.
Source
Thrown at crates/adapters/okx/src/websocket/parse.rs:1695
OrderType::LimitIfTouched
},
trigger_px: msg.tp_trigger_px.as_str(),
trigger_px_type: msg.tp_trigger_px_type,
ord_px,
})
}
}
OKXAlgoOrderType::Trigger => Ok(AlgoOrderFields {
order_type: if is_market_price(&msg.ord_px) {
OrderType::StopMarket
} else {
OrderType::StopLimit
},
trigger_px: msg.trigger_px.as_str(),
trigger_px_type: msg.trigger_px_type,
ord_px: msg.ord_px.as_str(),
}),
_ => anyhow::bail!("Unsupported algo order type: {:?}", msg.ord_type),
}
}
fn parse_algo_order_quantity(
msg: &OKXAlgoOrderMsg,
instrument: &InstrumentAny,
) -> anyhow::Result<Quantity> {
if !msg.sz.is_empty() {
return parse_quantity(msg.sz.as_str(), instrument.size_precision());
}
if !msg.close_fraction.is_empty()
|| !msg.sl_trigger_px.is_empty()
|| !msg.tp_trigger_px.is_empty()
{
return Ok(Quantity::zero(instrument.size_precision()));
}
View on GitHub (pinned to 18893faf8b)
Solutions
- Check the msg.ord_type value in the error and confirm it is an OKX-supported algo type the adapter handles
- Place only supported algo order types (trigger/stop-limit style) through this adapter
- If OKX added a new type, update parse_algo_order_fields to map it or filter those channels out
Example fix
// before
"twap" => anyhow::bail!("Unsupported algo order type: {:?}", msg.ord_type),
// after (in parse_algo_order_fields)
OKXAlgoOrdType::Conditional => OrderType::StopMarket,
OKXAlgoOrdType::Trigger => OrderType::StopMarket, Defensive patterns
Strategy: try-catch
Validate before calling
let supported = ["conditional", "trigger", "oco", ""];
if let Some(t) = &msg.ord_type && !supported.contains(&t.as_str()) {
tracing::warn!("skipping unsupported algo ord_type {t}");
return Ok(None);
} Try / catch
match parse_algo_order_status_report(msg, instrument) {
Ok(r) => handle(r),
Err(e) if e.to_string().starts_with("Unsupported algo order type") => {
tracing::warn!("ignoring unsupported algo type: {e}");
}
Err(e) => return Err(e),
} Prevention
- Keep the OKX algo ord_type mapping in sync with OKX API docs
- Only place algo orders via the adapter's supported types
- Log-and-skip unknown enum values at the serde layer
When it happens
Trigger: Receiving an OKX algo order update whose ord_type is not one of the handled values (e.g. 'oco', 'twap', 'iceberg', or a newly introduced OKX type) while parsing an algo order status report.
Common situations: OKX adds a new algo order type; user places algo orders via OKX web UI or another client that the adapter doesn't support; typos in manually crafted test messages.
Related errors
- Missing sz for algo order {}
- Cannot determine spread fill quantity: fill_sz='{}' and acc_
- Cannot determine fill quantity: fill_sz is empty/zero and ac
- Cannot determine fill quantity: fill_sz='{}' and acc_fill_sz
- Invalid funding_rate value: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/4bb9efd914ef8917.
Report an issue: GitHub.