RiskGuard is a real-time trading bias detection system designed to help traders identify and mitigate psychological pitfalls like revenge trading and overtrading. By monitoring trading activity and intervening when necessary, RiskGuard aims to preserve capital and promote disciplined trading habits.
- Real-time Bias Detection: Analyzes trading patterns to detect emotional biases.
- Intervention System: Alerts traders and provides friction to prevent impulsive decisions.
- Capital Preservation Tracking: Visualizes potential losses avoided through interventions.
- Trade Logging & Analysis: Comprehensive dashboard for reviewing trade history and performance.
- LLM-Powered Insights: (Optional) Provides AI-driven analysis of trading behavior.
The project consists of three main components:
- Backend (
/backend): A Flask-based API that handles data processing, bias detection logic, and communication with Snowflake. - Frontend (
/frontend): A Next.js web application serving as the user dashboard. - Extension (
/extension): A Chrome extension (built with WXT) that overlays trading platforms to provide real-time alerts.
- Python 3.9+
- Node.js 18+ & npm
- Snowflake Account (for data storage)
The backend powers the analysis and data storage.
cd backend
# Create a virtual environment (optional but recommended)
python -m venv venv
# Windows
venv\Scripts\activate
# Mac/Linux
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Note: You may also need 'snowflake-connector-python' if not already installed.
pip install snowflake-connector-pythonConfiguration:
Ensure you have a .env file in the backend directory with your Snowflake credentials (USER, PASSWORD, ACCOUNT, WAREHOUSE, DATABASE, SCHEMA).
Run the Server:
python server.py
# The server will start at http://localhost:5000The frontend provides the dashboard for analytics.
cd frontend
npm install
npm run dev
# The dashboard will be available at http://localhost:3000The extension integrates with your browser.
cd extension
npm install
# Run in development mode (loads into a temporary Chrome instance)
npm run dev
# Or build for production
npm run build
# The built extension will be in extension/.output/chrome-mv3
# Load this directory as an unpacked extension in chrome://extensions/- Start all services: Ensure Backend and Frontend are running. Load the Extension.
- Dashboard: Navigate to
http://localhost:3000to view your trading stats and recent interventions. - Trading: (Demo Mode) Use the provided demo scripts or endpoints to simulate trading activity and observe how RiskGuard detects biases.
- Start Demo Mode:
POST /start_demowith{"user_id": "test_user"} - Seed Scenario:
POST /seed_scenariowith{"user_id": "test_user", "type": "revenge"}
- Start Demo Mode:
This project was built for QHacks 2026.
MIT