nautechsystems/nautilus_trader · error · anyhow::Error
Unsupported BitmexTimeInForce: {value}
Error message
Unsupported BitmexTimeInForce: {value} What it means
TryFrom<BitmexTimeInForce> (to Nautilus TimeInForce) falls back to a catch-all bail for BitMEX time-in-force variants that have no Nautilus mapping. Any BitmexTimeInForce outside Gtc/Gtd/Ioc/Fok/AtTheOpen/AtTheClose produces this error.
Source
Thrown at crates/adapters/bitmex/src/common/enums.rs:328
GoodTillDate,
AtTheClose,
GoodThroughCrossing,
AtCrossing,
}
impl TryFrom<BitmexTimeInForce> for TimeInForce {
type Error = anyhow::Error;
fn try_from(value: BitmexTimeInForce) -> Result<Self, Self::Error> {
match value {
BitmexTimeInForce::Day => Ok(Self::Day),
BitmexTimeInForce::GoodTillCancel => Ok(Self::Gtc),
BitmexTimeInForce::GoodTillDate => Ok(Self::Gtd),
BitmexTimeInForce::ImmediateOrCancel => Ok(Self::Ioc),
BitmexTimeInForce::FillOrKill => Ok(Self::Fok),
BitmexTimeInForce::AtTheOpening => Ok(Self::AtTheOpen),
BitmexTimeInForce::AtTheClose => Ok(Self::AtTheClose),
_ => anyhow::bail!("Unsupported BitmexTimeInForce: {value}"),
}
}
}
impl TryFrom<TimeInForce> for BitmexTimeInForce {
type Error = anyhow::Error;
fn try_from(value: TimeInForce) -> Result<Self, Self::Error> {
match value {
TimeInForce::Day => Ok(Self::Day),
TimeInForce::Gtc => Ok(Self::GoodTillCancel),
TimeInForce::Gtd => Ok(Self::GoodTillDate),
TimeInForce::Ioc => Ok(Self::ImmediateOrCancel),
TimeInForce::Fok => Ok(Self::FillOrKill),
TimeInForce::AtTheOpen => Ok(Self::AtTheOpening),
TimeInForce::AtTheClose => Ok(Self::AtTheClose),
}
}View on GitHub (pinned to 18893faf8b)
Solutions
- Upgrade the nautilus_bitmex adapter to a version that maps the new BitmexTimeInForce variant
- Check the exact `value` in the message and handle that variant upstream before conversion
- Patch the match in common/enums.rs to add the missing BitmexTimeInForce -> TimeInForce mapping
Defensive patterns
Strategy: type-guard
Type guard
fn is_mapped_bitmex_tif(t: BitmexTimeInForce) -> bool {
matches!(t, Gtc | Gtd | Ioc | Fok | AtTheOpen | AtTheClose)
} Try / catch
match BitmexTimeInForce::try_from(raw_tif) {
Ok(v) => v,
Err(e) => { log::warn!("unknown BitMEX TIF: {e}"); BitmexTimeInForce::GoodTillCancel }
} Prevention
- Keep the adapter updated when BitMEX adds TIF variants
- Log and skip unmapped inbound TIF values instead of failing the stream
When it happens
Trigger: Converting a BitMEX time-in-force value from inbound exchange data (e.g. execution reports) whose variant is not covered by the explicit match arms.
Common situations: BitMEX adds or emits a new/less common TIF variant (e.g. grouped or peg-related TIFs) that the adapter version does not map; deserializing historical or new exchange payloads with a stale adapter.
Related errors
- Unsupported `TimeInForce` for Binance: {value:?}
- GTD time in force is not supported for BitMEX order submit;
- Unsupported `TimeInForce` for Polymarket: {value:?}
- Unsupported `TimeInForce` for Polymarket market order: {valu
- Unsupported `OrderSide` for Binance: {value:?}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/e5e5ccb921399df0.
Report an issue: GitHub.