{"record":{"id":"84beea390d5df5eb","repo":"nautechsystems/nautilus_trader","slug":"unsupported-order-type-for-betfair-other","errorCode":null,"errorMessage":"Unsupported order type for Betfair: {other:?}","messagePattern":"Unsupported order type for Betfair: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/betfair/src/execution.rs","lineNumber":1852,"sourceCode":"                if order.time_in_force() != TimeInForce::AtTheClose {\n                    anyhow::bail!(\n                        \"Market orders on Betfair are only supported with AtTheClose \\\n                         time in force (BSP MarketOnClose)\"\n                    );\n                }\n                PlaceInstruction {\n                    order_type: BetfairOrderType::MarketOnClose,\n                    selection_id,\n                    handicap: handicap_opt,\n                    side,\n                    limit_order: None,\n                    limit_on_close_order: None,\n                    market_on_close_order: Some(MarketOnCloseOrder { liability: size }),\n                    customer_order_ref,\n                }\n            }\n            other => {\n                anyhow::bail!(\"Unsupported order type for Betfair: {other:?}\");\n            }\n        };\n\n        let market_version = self.get_market_version(&instrument_id);\n\n        let params = PlaceOrdersParams {\n            market_id,\n            instructions: vec![instruction],\n            customer_ref: None,\n            market_version,\n            customer_strategy_ref: None,\n        };\n\n        let client_order_id = order.client_order_id();\n        let strategy_id = order.strategy_id();\n\n        log::debug!(\"OrderSubmitted client_order_id={client_order_id}\");\n        self.emitter.emit_order_submitted(&order);","sourceCodeStart":1834,"sourceCodeEnd":1870,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/betfair/src/execution.rs#L1834-L1870","documentation":"The Betfair place-instruction builder handles only OrderType::Limit and OrderType::Market; every other Nautilus order type (stop-market, stop-limit, trailing-stop, market-to-limit, ...) falls into the 'other' arm and bails. Betfair's API has no equivalent native stop order types, so these are hard local rejections before any request is sent.","triggerScenarios":"Calling submit_order with a stop or trailing order (e.g. factory.stop_market(...)) on a BETFAIR instrument; the match at execution.rs:1852 hits the catch-all arm.","commonSituations":"Shared strategies with bracket/stop-loss legs; risk-management code attaching stop orders to entries; backtests pass because the simulated venue accepts the types that live Betfair rejects.","solutions":["Remove or convert stop/trailing orders for Betfair instruments — manage exits in strategy logic with cancel/replace on price updates.","Gate order creation by venue support before submitting.","Use Limit orders with the TIF-to-persistence mapping (LAPSE/PERSIST/MARKET_ON_CLOSE) to express Betfair-native behavior."],"exampleFix":"// before\nlet stop = factory.stop_market(instrument_id, side, qty, trigger_price).build()?;\nengine.submit_order(&stop); // Betfair: unsupported\n\n// after\nif instrument_id.venue() == &VENUE_BETFAIR {\n    // manage exit in strategy: cancel/replace limit as price moves\n} else {\n    let stop = factory.stop_market(instrument_id, side, qty, trigger_price).build()?;\n    engine.submit_order(&stop);\n}","handlingStrategy":"type-guard","validationCode":"fn is_supported_betfair_order_type(order_type: OrderType) -> bool {\n    matches!(order_type, OrderType::Limit | OrderType::Market)\n}","typeGuard":"fn is_supported_betfair_order(order: &OrderAny) -> bool {\n    matches!(order.order_type(), OrderType::Limit | OrderType::Market)\n}","tryCatchPattern":null,"preventionTips":["Centralize order creation per venue and reject stop/trailing types for BETFAIR at build time.","Implement exits with strategy-driven cancel/replace of limit orders instead of stop orders.","Add a checklist assertion in integration tests that only Limit/Market orders reach the Betfair client."],"tags":["betfair","order-entry","stop-order","unsupported-type"],"backgroundTag":"unsupported-order-type","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}