Market Mayhem
Play the market. Outsmart the villain. Understand your psychology under pressure.
🌟 Inspiration
Most investing tools are either too abstract or too idealized. We wanted a hands-on, emotionally grounded learning experience that teaches portfolio construction and decision-making under real pressure, revealing how fear, bias, and emotion drive financial behavior.
Market Mayhem simulates this tension by introducing an AI Villain - a sentient adversary designed to induce bias, overconfidence, or fear through selective market narratives. Your challenge: fact-check, research, and stay rational while navigating volatile markets and misleading cues.
💼 What It Does
How to Play
1. Set up your portfolio
- Start with $1,000,000 in virtual capital.
- Select your risk style: Risk-Off, Balanced, or Risk-On.
- Pick at least two stocks and allocate your budget across them.
- The “Remaining” tracker helps you fully allocate your funds before starting.
2. Play decision rounds
- Each round begins with a market update about one of your holdings.
- (Optional) Open the Data tab for real-world headlines and signals.
Choose an action:
- BUY – Increase position
- HOLD – Stay the course
- SELL HALF – Reduce exposure
- SELL ALL – Exit completely
The AI Villain injects emotional pressure through market commentary, attempting to distort your judgment. Your task is to verify information, analyze objectively, and respond rationally rather than reactively.
3. Review the results
- See how your decision affected returns and portfolio risk.
- Use the feedback to refine your next move.
4. End of game
- After several rounds, view a detailed summary of your performance, including:
- Profit/loss and volatility
- Behavioral tendencies (e.g., cautious, bold, reactive)
- Tailored insights to improve future decision-making
🛠️ How We Built It
- Frontend: Next.js, Tailwind CSS, Framer Motion
- Backend: FastAPI with endpoints for portfolio creation, round logic, and player decisions
- Agents: Modular architecture with Event, News, Price, Villain, and Insight agents orchestrated via a graph-based game engine
- Prompts: Purpose-built, role-specific prompts for explainable and consistent outputs
- Data: Real-time market data through
yfinance; Supabase for persistence with in-memory fallback for rapid prototyping Observability:
- LangSmith for tracing, monitoring, and debugging agent runs
- Comet-ML Opik for experiment tracking, evaluations, and performance analytics
Challenges We Faced
- Maintaining context alignment between portfolio state and multi-agent reasoning
- Balancing LLM creativity and determinism for a stable, replayable experience
- Managing noisy market data while keeping game pacing natural
- Designing a clear, intuitive UI to visualize risk and decisions within seconds
- Debugging Supabase, CORS, and environment synchronization across frontend and backend
Accomplishments
- Complete end-to-end playable simulation loop — from portfolio creation to round-based feedback to performance report
- The Villain/Insight pairing: an AI that manipulates and then explains, exposing user bias in real time
- Graph-driven orchestration that allows flexible agent addition and experimentation
- Resilient fallbacks: fully playable offline with in-memory stores, seamlessly upgrading to Supabase and observability tools
- A polished, responsive UI that makes learning behavioral finance interactive and fast
What We Learned
- Agentic architectures require clear contracts between agents — ambiguity compounds quickly
- Human factors (tone, copy, pacing) deeply influence perception of financial risk
- Observability and telemetry via LangSmith and Opik are invaluable for debugging, traceability, and structured evaluation
- Typed data models and consistent prompt schemas improve reliability under time constraints
What’s Next
- Expanded market regimes and asset classes
- Adaptive skill progression and “bias quest” challenges
- Multiplayer and classroom modes with leaderboards
- Advanced analytics dashboards (drawdowns, streaks, volatility attribution)
- Persistent game history and authentication via Supabase/Postgres
- Continuous agent evaluation and cost/safety optimization
Built With
- comet
- javascript
- langchain
- next.js
- python
- sql
- tailwindcss
- typescript

Log in or sign up for Devpost to join the conversation.