{"record":{"id":"906bb2a84dac62fe","repo":"nautechsystems/nautilus_trader","slug":"handle-trade-tick-is-not-implemented-for","errorCode":null,"errorMessage":"`handle_trade_tick` is not implemented for `{}`","messagePattern":"`handle_trade_tick` is not implemented for `(.+?)`","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/indicators/src/indicator.rs","lineNumber":61,"sourceCode":"    fn handle_depth(&mut self, depth: &OrderBookDepth10) {\n        panic!(\"`handle_depth` {IMPL_ERR} `{}`\", self.name());\n    }\n\n    fn handle_book(&mut self, book: &OrderBook) {\n        panic!(\"`handle_book_mbo` {IMPL_ERR} `{}`\", self.name());\n    }\n\n    /// Updates the indicator with the given quote tick.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the configured price type cannot be extracted from the quote.\n    fn handle_quote(&mut self, quote: &QuoteTick) -> anyhow::Result<()> {\n        anyhow::bail!(\"`handle_quote_tick` {IMPL_ERR} `{}`\", self.name());\n    }\n\n    fn handle_trade(&mut self, trade: &TradeTick) {\n        panic!(\"`handle_trade_tick` {IMPL_ERR} `{}`\", self.name());\n    }\n\n    fn handle_bar(&mut self, bar: &Bar) {\n        panic!(\"`handle_bar` {IMPL_ERR} `{}`\", self.name());\n    }\n\n    fn reset(&mut self);\n}\n\npub trait MovingAverage: Indicator {\n    fn value(&self) -> f64;\n    fn count(&self) -> usize;\n    fn update_raw(&mut self, value: f64);\n}\n\nimpl Debug for dyn Indicator + Send {\n    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {\n        // Implement custom formatting for the Indicator trait object","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/indicators/src/indicator.rs#L43-L79","documentation":"Default `Indicator::handle_trade` panics when an indicator receives a `TradeTick` without overriding `handle_trade`. The default body is a guard panic with the message \"`handle_trade_tick` is not implemented for `<indicator name>`\" (the panic text uses the label handle_trade_tick). Trade-tick input requires the indicator to implement trade processing; hitting the default means a type/wiring mismatch.","triggerScenarios":"Calling `handle_trade(&TradeTick)` on an indicator that only implements `handle_quote` (e.g. a quote-based average like a bid/ask indicator) or `handle_bar` — typically because the data engine dispatches every trade tick to all subscribed indicators.","commonSituations":"Quote-based indicators subscribed to a trade stream by mistake; custom indicators where handle_trade was left to the default; replaying tick datasets containing trades into quote-only indicators.","solutions":["Override `fn handle_trade(&mut self, trade: &TradeTick)` in the indicator impl to consume trade ticks.","Unsubscribe the indicator from trade ticks and subscribe it to the data type it implements (quotes or bars).","Use a trade-capable indicator (e.g. one keyed off trade price) if your data source only emits trades."],"exampleFix":"// before\nimpl Indicator for QuoteBasedMA { /* only handle_quote */ }\n\n// after\nimpl Indicator for QuoteBasedMA {\n    fn handle_trade(&mut self, trade: &TradeTick) {\n        // feed trade.price into the average\n    }\n}","handlingStrategy":"validation","validationCode":"// before subscribing\nassert!(ind.accepts(DataType::TradeTick), \"{} has no handle_trade impl\", ind.name());","typeGuard":null,"tryCatchPattern":"// guard: if trade_capable(ind) { ind.handle_trade(trade); } else if quote_capable(ind) { /* skip or synthesize quote */ }","preventionTips":["Match indicator kind (quote-based vs trade-based) to the subscription data type.","Implement handle_trade in any indicator used in strategies that receive trades.","Unit-test each indicator with the exact data types your engine dispatches."],"tags":["rust","panic","indicators","trade-tick","missing-override"],"backgroundTag":"method-not-implemented","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}