{"record":{"id":"be51e6594ea341d7","repo":"nautechsystems/nautilus_trader","slug":"cannot-subscribe-for-synthetic-instrument-optiong","errorCode":null,"errorMessage":"Cannot subscribe for synthetic instrument `OptionGreeks` data","messagePattern":"Cannot subscribe for synthetic instrument `OptionGreeks` data","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/data/src/engine/mod.rs","lineNumber":1105,"sourceCode":"            {\n                self.subscribe_spread_quotes(cmd);\n                return Ok(());\n            }\n            SubscribeCommand::Trades(cmd) if cmd.instrument_id.is_synthetic() => {\n                self.subscribe_synthetic_trades(cmd.instrument_id);\n                return Ok(());\n            }\n            SubscribeCommand::Instrument(cmd) if cmd.instrument_id.is_synthetic() => {\n                anyhow::bail!(\"Cannot subscribe for synthetic instrument `Instrument` data\");\n            }\n            SubscribeCommand::InstrumentStatus(cmd) if cmd.instrument_id.is_synthetic() => {\n                anyhow::bail!(\"Cannot subscribe for synthetic instrument `InstrumentStatus` data\");\n            }\n            SubscribeCommand::InstrumentClose(cmd) if cmd.instrument_id.is_synthetic() => {\n                anyhow::bail!(\"Cannot subscribe for synthetic instrument `InstrumentClose` data\");\n            }\n            SubscribeCommand::OptionGreeks(cmd) if cmd.instrument_id.is_synthetic() => {\n                anyhow::bail!(\"Cannot subscribe for synthetic instrument `OptionGreeks` data\");\n            }\n            _ => {} // Do nothing else\n        }\n\n        let retained = cmd.clone();\n\n        // Book ownership, including failed acquisitions, is already counted by the engine\n        let retain_on_failure = !matches!(\n            &cmd,\n            SubscribeCommand::BookDeltas(_) | SubscribeCommand::BookDepth10(_)\n        );\n\n        #[cfg(feature = \"streaming\")]\n        let cmd = self.subscribe_command_with_prefilled_start_ns(cmd)?;\n\n        if let Some(client) = self.get_command_client(cmd.client_id(), cmd.venue()) {\n            client.execute_subscribe_with_retained(cmd, retained, retain_on_failure);\n        } else {","sourceCodeStart":1087,"sourceCodeEnd":1123,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/data/src/engine/mod.rs#L1087-L1123","documentation":"OptionGreeks data is computed or provided by specific data clients and is not supported for synthetic instruments in this engine path. The engine bails on SubscribeCommand::OptionGreeks when the instrument ID is synthetic.","triggerScenarios":"Subscribing to OptionGreeks with a synthetic InstrumentId (is_synthetic() == true).","commonSituations":"Options strategy templates that subscribe to greeks for all option instruments, where some option IDs are synthetic/generated rather than venue-listed.","solutions":["Only subscribe to OptionGreeks for real (non-synthetic) instrument IDs.","Filter out ids where is_synthetic() is true before issuing greeks subscriptions.","Compute greeks locally for synthetic instruments instead of requesting them from the data engine."],"exampleFix":"// before\nengine.subscribe_option_greeks(synthetic_option_id)?;\n// after\nif !synthetic_option_id.is_synthetic() {\n    engine.subscribe_option_greeks(synthetic_option_id)?;\n}","handlingStrategy":"type-guard","validationCode":"// Rust\nif !option_id.is_synthetic() {\n    engine.subscribe_option_greeks(option_id)?;\n}","typeGuard":"// Rust\nfn supports_greeks_subscription(id: &InstrumentId) -> bool {\n    !id.is_synthetic()\n}","tryCatchPattern":"// Rust\nif let Err(e) = engine.subscribe_option_greeks(id) {\n    if e.to_string().contains(\"synthetic instrument `OptionGreeks`\") {\n        // compute greeks locally instead\n        compute_local_greeks(id);\n    } else {\n        return Err(e.into());\n    }\n}","preventionTips":["Gate OptionGreeks subscriptions on is_synthetic() == false.","Compute greeks locally for synthetic option instruments.","Separate options-subscription code paths for synthetic vs listed options."],"tags":["rust","data-engine","synthetic-instrument","options"],"backgroundTag":"unsupported-operation","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"}