{"record":{"id":"3b736722bc6436bc","repo":"nautechsystems/nautilus_trader","slug":"unsupported-order-type-for-derive-other","errorCode":null,"errorMessage":"unsupported order type for Derive: {other:?}","messagePattern":"unsupported order type for Derive: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/derive/src/common/parse.rs","lineNumber":124,"sourceCode":"\n/// Maps a Nautilus order side to the Derive direction string.\npub fn order_side_to_derive(side: OrderSide) -> DeriveOrderSide {\n    match side {\n        OrderSide::Buy => DeriveOrderSide::Buy,\n        OrderSide::Sell => DeriveOrderSide::Sell,\n    }\n}\n\n/// Maps a Nautilus order type to the Derive order type string.\n///\n/// # Errors\n///\n/// Returns an error for order types Derive does not accept.\npub fn order_type_to_derive(order_type: OrderType) -> anyhow::Result<DeriveOrderType> {\n    match order_type {\n        OrderType::Limit => Ok(DeriveOrderType::Limit),\n        OrderType::Market => Ok(DeriveOrderType::Market),\n        other => anyhow::bail!(\"unsupported order type for Derive: {other:?}\"),\n    }\n}\n\n/// Maps a supported Nautilus trigger order type to the child Derive order type.\n///\n/// # Errors\n///\n/// Returns an error for order types not supported by Derive trigger orders.\npub fn trigger_order_type_to_derive(order_type: OrderType) -> anyhow::Result<DeriveOrderType> {\n    match order_type {\n        OrderType::StopMarket | OrderType::MarketIfTouched => Ok(DeriveOrderType::Market),\n        OrderType::StopLimit | OrderType::LimitIfTouched => Ok(DeriveOrderType::Limit),\n        other => anyhow::bail!(\n            \"unsupported trigger order type for Derive: {other:?}; supported types are StopMarket, StopLimit, MarketIfTouched, and LimitIfTouched\"\n        ),\n    }\n}\n","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/derive/src/common/parse.rs#L106-L142","documentation":"Derive (Deribit's L2 DEX) only accepts Limit and Market order types. `order_type_to_derive` converts a Nautilus `OrderType` to Derive's `DeriveOrderType` and rejects any other type (StopMarket, StopLimit, LimitIfTouched, etc.) since plain Derive orders cannot express them.","triggerScenarios":"Submitting (via `order_to_derive_payload`), amending (via `order_replace_to_derive_payload`), or pre-validating (via `validate_order_support`) a Nautilus order whose OrderType is anything other than Limit or Market — e.g. submitting a StopMarket or trailing order routed to the Derive venue.","commonSituations":"Multi-venue strategies reusing order construction code across adapters; users configuring stop-loss or conditional orders without realizing Derive only accepts trigger (stop) orders through the dedicated trigger payload path, not as plain order types.","solutions":["Only submit Limit or Market orders to Derive; convert conditional orders to the adapter's dedicated trigger-order payload path (see `trigger_order_type_to_derive`)","Add a pre-trade check that rejects or re-routes unsupported order types before the request reaches the venue","Move conditional logic to the strategy layer (monitor prices and emit plain Market/Limit orders) if triggers aren't suitable"],"exampleFix":"// before\nlet payload = order_to_derive_payload(&StopMarketOrder(...))?; // errors\n// after\nlet payload = trigger_order_to_derive_payload(&StopMarketOrder(...))?; // use trigger path","handlingStrategy":"validation","validationCode":"fn is_plain_derive_order(t: OrderType) -> bool { matches!(t, OrderType::Limit | OrderType::Market) }","typeGuard":"fn is_plain_derive_order(t: OrderType) -> bool { matches!(t, OrderType::Limit | OrderType::Market) }","tryCatchPattern":"match order_type_to_derive(order.order_type()) {\n    Ok(t) => { /* build payload */ }\n    Err(e) => tracing::warn!(%e, \"rerouting unsupported order type away from Derive\"),\n}","preventionTips":["Call validate_order_support before submission in multi-venue routers","Route conditional/trigger orders through the dedicated Derive trigger payload path","Implement exotic conditional logic at the strategy layer with plain orders"],"tags":["rust","derive","orders","unsupported"],"backgroundTag":"unsupported-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}