Inspiration

Trading is 20% strategy and 80% psychology. Every trader must suppress their own emotions to consistently execute successful trades. We realized that while there are consistent tools for market analysis (charts, indicators, news), there are almost no tools for trader analysis. We built RiskGuard to be the emotional guardrail that stops you from making the one bad trade that wipes out a month of gains. We wanted to solve the problem of "Tilt," "Revenge Trading," and "Overtrading" by intervening in the exact moment of decision.

What it does

RiskGuard is an AI-powered risk management layer that sits on top of your trading platform.

  1. Real-time Intervention: Our Chrome Extension injects a non-intrusive but firm overlay whenever you attempt to place a trade that exhibits high-risk behavioural patterns (e.g., doubling down after a loss).
  2. Bias Detection: It detects specific psychological biases such as Revenge Trading, Loss Aversion, and Overtrading by analyzing your recent trade history and current market conditions.
  3. AI Coaching: Instead of just blocking you, it uses Gemini 2.0 to act as an on-demand trading psychologist, explaining why you might be acting irrationally and suggesting a cooldown.
  4. Performance Dashboard: A Next.js-powered dashboard that tracks your "Capital Preserved". Money you didn't lose because RiskGuard stopped you with visualizations for your diverse behavioural metrics over time.

How we built it

We built a robust, multi-service architecture centred around data and AI:

  • Backend: We used Python (Flask) to build a high-performance API that handles trade logic and bias detection algorithms.
  • Database: We leveraged Snowflake as our core data warehouse. All trade attempts, successful entries, and stopped interventions are logged to Snowflake. Its speed allowed us to query historical trade context in near real-time to detect patterns like "revenge trading" (placing a trade seconds after a loss).
  • AI Engine: We integrated the Gemini 2.0 Flash API to analyze structured trade data and generate human-like, empathetic, yet firm psychological advice.
  • Frontend: The dashboard is built with Next.js 16 and Tailwind CSS, providing a sleek, modern interface for traders to review their performance.
  • Extension: We built a Cross-Browser Extension using the WXT Framework (React + TypeScript) to inject our React-based overlay directly into trading platforms (demoed on Investopedia Simulator).
  • Communication: The extension and frontend stay in sync via our backend, ensuring that your dashboard immediately reflects interventions that happen in the browser.

Challenges we ran into

  • Cross-Context Synchronization: Coordinating state between the Chrome Extension's content script (running on a third-party site), our background service worker, and the Next.js dashboard was complex. We had to ensure that when a bias was detected, the overlay appeared instantly without lag.
  • Snowflake Integration: Setting up the Snowflake connector to handle real-time inserts and queries efficiently within a Flask environment required careful connection management to avoid latency.
  • Prompt Engineering: Getting the AI to sound like a professional risk manager rather than a generic chatbot took several iterations of system prompting and context injection using the Gemini API.

Accomplishments that we're proud of

  • "Capital Preserved" Metric: We successfully implemented a logic that quantifies the value of inaction. showing users exactly how much money they saved by listening to the AI.
  • Seamless Overlay: The extension feels like a native part of the trading platform, not a clunky popup.
  • Speed: The bias detection pipeline (Frontend -> Backend -> Snowflake Query -> Bias Algo -> Frontend) executes in under 200ms, making it viable for active trading.

What we learned

  • The Power of Snowflake: We learned how to use Snowflake not just for analytics, but as a real-time transactional store for our high-frequency trade logs.
  • Browser Extension Architecture: We gained deep insights into the Shadow DOM and how to inject complex React applications into existing webpages without breaking their styles.
  • Behavioral Finance: We merged code with psychology, learning that the best way to change behavior is through friction at the point of action.

What's next for RiskGuard

  • Broker Integration: Direct API integration with platforms like Alpaca or Interactive Brokers to execute "hard stops" (actually preventing the order at the broker level).
  • Voice Mode: Using Gemini's multimodal capabilities to have a voice conversation with the trader during high-stress moments.
  • Mobile App: Bringing the dashboard and notification system to iOS/Android for on-the-go risk management.

Built With

Share this project:

Updates