Inspiration
On April 7, 2026, I watched Indian markets crash 5.9% in a single day. My social media was flooded with people asking "Should I stop my SIP?" and "I'm selling everything tomorrow."
Then I found the statistic that changed everything: 76% of SIP investors stopped their investments during the recent correction. They weren't just losing money from the crash — they were destroying years of future wealth by panicking.
I started calculating: an investor who stops a ₹10,000/month SIP during a crash loses approximately ₹8.45 lakhs in future wealth over 10 years compared to one who simply continues. Multiply that across 55 million SIP investors, and the scale of wealth destruction is staggering.
The problem isn't the market crash. The problem is that no tool exists to help regular investors make rational decisions during their worst emotional moments. Every crash, the same pattern repeats — panic, sell, regret, miss the recovery. I built PanicGuard AI to break that cycle.
What it does
PanicGuard AI is a multi-agent system with three autonomous AI agents that work together to prevent panic-driven financial decisions:
Agent 1 — Crisis Detector: An XGBoost model trained on 10 years of Indian market data generates a real-time Panic Score (0-100). Every score comes with a SHAP explanation showing exactly which factors are driving market stress — drawdown from peak, volatility spikes, consecutive red days, VIX levels, and more. No black box.
Agent 2 — Portfolio Analyzer: Takes YOUR portfolio and calculates the personal cost of panicking. It shows four scenarios side by side:
- Stop SIP (panic): ₹26.26 L in 10 years
- Continue SIP (hold): ₹34.71 L in 10 years
- Increase SIP 50% (brave): ₹42.60 L in 10 years
- Switch to debt (defensive): ₹29.80 L in 10 years The "Wealth Destroyed by Panicking" number — ₹8.45 L — is what changes minds.
Agent 3 — Behavioral Coach: An LLM-powered coach that detects cognitive biases (loss aversion, recency bias, herd mentality) and provides empathetic, data-backed guidance. It doesn't just say "don't panic" — it shows you proof from 7 historical crashes that every single Indian market crash has recovered.
The three agents work autonomously: Crisis detected → Portfolio impact calculated → Personalized coaching delivered. Full pipeline runs in under 2 seconds.
How we built it
Day 1: Built the data pipeline (yfinance, mftool) and trained the XGBoost model with 15 engineered features. Used walk-forward cross-validation to prevent data leakage and SMOTE for class imbalance. The model successfully detects all major Indian crash events in backtesting.
Day 2: Wired up three autonomous agents with an orchestrator. Each agent is error-isolated — if one fails, others still work with fallback data. Added a template-based coaching engine so the entire app works without any API keys.
Day 3: Built the Streamlit dashboard (1,100+ lines). Focused on making the "wealth destroyed" number impossible to ignore. Added 35+ smoke tests to bulletproof everything. Deployed to Streamlit Cloud.
Day 4: UI overhaul — moved from a generic AI-generated look to a professional fintech design. Fixed every edge case (API failures, zero inputs, missing model files). Recorded demo video. Submitted.
Key technical decisions:
- Walk-forward CV instead of random split (time series data requires this)
- SHAP for every prediction (transparency builds trust)
- Triple fallback for LLM coach: Claude → OpenAI → Template (never fails)
- Demo mode with cached April 2026 crash data (works offline during judging)
Challenges we ran into
Building solo in 4 days meant making hard tradeoffs. The biggest challenge was making the ML model genuinely useful rather than just technically impressive. Raw SHAP values mean nothing to a retail investor — I had to build a translation layer that converts "drawdown_from_peak: +0.223" into "Market has dropped 12.2% from its recent peak."
The yfinance API is notoriously unreliable — it rate-limits, returns empty data, or crashes randomly. I built a complete demo mode with cached April 2026 crash data so the app never fails during a live demo. Every section has error boundaries — if one breaks, others still render.
The hardest challenge was emotional, not technical: building a tool about market panic while the market was actually crashing in real-time (April 7-14, 2026). The urgency made it personal.
Accomplishments that we're proud of
- The XGBoost model detected the COVID-19 crash 11 days before the market bottom
- "Wealth Destroyed by Panicking: ₹8.45 L" — one number that makes the cost of panic personal and undeniable
- Full 3-agent autonomous pipeline runs end-to-end in under 2 seconds
- 35+ automated tests with zero failures
- Works completely offline — no API keys, no internet needed for the demo
- At just 0.1% adoption among India's 55M SIP investors, PanicGuard could preserve ₹440 Cr in retail wealth per crash event
What we learned
- The biggest threat to Indian retail investors isn't market volatility — it's their own cognitive biases during volatility
- Explainability isn't optional — investors need to know WHY the AI thinks what it thinks, or they won't trust it
- Building for failure (demo modes, error boundaries, fallback chains) is what separates hackathon demos that impress from ones that crash
- Behavioral finance + ML is a massively underserved space — 55 million SIP investors and virtually no tools helping them stay rational during crashes
What's next for PanicGuard AI
- Connect to real brokerage APIs (Zerodha, Groww) for live portfolio tracking instead of manual input
- WhatsApp alerts when the Panic Score crosses thresholds — reaching investors before they open their trading app
- Multi-language support (Hindi, Tamil, Bengali) — panic doesn't speak only English
- Partner with mutual fund distributors to reach investors who need this most
Built With
- anthropic-claude-api
- imbalanced-learn-(smote)
- mftool
- numpy
- openai-api
- pandas
- plotly
- python
- scikit-learn
- shap
- streamlit
- xgboost
- yfinance
Log in or sign up for Devpost to join the conversation.