The AI Trade Post-Mortem & Behavioral Journal Auto-Tagger (TradePostMortemAnalysis, TradePostMortemSheet, analyzeTradePostMortem) provides an automated, objective diagnostic review immediately upon closing an equity or options position. It evaluates trade execution quality independently of P&L outcome, identifies cognitive biases, catalogs execution mistakes, generates actionable tactical lessons, and auto-tags entries directly into the trader’s Firestore-backed Emotion Journal.
By distinguishing between “Good Wins” (disciplined execution, sound thesis) and “Bad Wins” (lucky execution that broke rules), as well as “Good Losses” (proper risk management, adhered to invalidation) and “Bad Losses” (bag-holding, averaging down against rules), the post-mortem engine protects traders from outcome bias and reinforces systematic consistency.
goodWin: Well-planned thesis, proper sizing, followed take-profit plan.badWin: Unplanned gamble or held past invalidation, saved only by market luck.goodLoss: Proper thesis, cut promptly at predefined stop-loss / invalidation level.badLoss: Moved stops, bag-holding, revenge-sized, or failed to honor trade invalidation.breakEven / scratch: Controlled flat exit with preserved capital.Analyzes the trade narrative and execution data against a comprehensive behavioral finance taxonomy:
For each detected bias, the AI delivers a concrete, actionable Cognitive Antidote (e.g., “Set bracket orders with mechanical take-profit limit orders upon entry”).
Identifies specific operational mistakes with impact severity (minor, moderate, severe):
users/{uid}/emotion_logs collection.#PostMortem, #AAPL, #GoodLoss, #LossAversion, #ExecutionDiscipline, etc.Robinhood Options Mobile
├── lib/model/trade_post_mortem_model.dart # TradePostMortemAnalysis & ExecutionFlaw models
├── lib/widgets/trade_post_mortem_sheet.dart # Interactive diagnostic bottom sheet UI
├── lib/services/generative_service.dart # Client callable invoker (analyzeTradePostMortem)
├── functions/src/gemini.ts # Backend Cloud Function with Gemini 3.1 Flash-Lite
├── lib/widgets/position_order_widget.dart # Launch action from stock order view
├── lib/widgets/option_order_widget.dart # Launch action from option order view
├── lib/widgets/personalized_coaching_widget.dart # Launch action from coaching activity stream
└── lib/widgets/trading_psychology_widgets.dart # Journal entry card tag chip rendering
analyzeTradePostMortem)src/robinhood_options_mobile/functions/src/gemini.tsrequest.auth authentication verification.gemini-3.1-flash-lite with fallback to gemini-2.5-flash-lite.executionScore (0–100 number)executionGrade (“A” |
“B” | “C” | “D” | “F”) |
outcomeVerdict (“goodWin” |
“badWin” | “goodLoss” | “badLoss” | “breakEven” | “scratch”) |
thesisAlignment (0.0–1.0 number)detectedBiases (array of { bias, evidence, antidote })executionFlaws (array of { flaw, severity, correctiveAction })tacticalLessons (array of strings)autoTags (array of strings with # prefix)coachSummary (string)Icons.fact_check_outlined) opens TradePostMortemSheet.EmotionLog to Firestore with generated tags and displays a success confirmation.functions/tests/gemini.test.ts
unauthenticated).test/trade_post_mortem_model_test.dart
test/trade_post_mortem_sheet_test.dart
EmotionLog to fake Firestore instance.