Built for the SESA x National Bank Hackathon by:
- Jordan Yang
- Larry Wang
- Emily Hyuhn
- Sidharth Sajan
This project helps traders upload and analyze trade history to identify behavioral bias and improve risk discipline.
It includes bias detection, portfolio optimization recommendations, and an AI coach experience (Laurent Ferreira) with:
- Persistent chat history
- Insights panel (bias summary, charts, heatmap, suggestions)
- A moving mascot trigger (
mascot-walking.gif) that walks around the page border
- Auth with Supabase
- Upload CSV or add trades manually
- Dashboard with:
- P/L index by stock
- 6-factor hexagonal bias radar (
overtrading,loss_aversion,revenge_trading,disposition_effect,anchoring,confirmation_bias) - Recent trade table + quick clear
- All Trades page:
- Server-side pagination/search
- Per-trade delete and clear-all
- Bias Analysis and Risk Profile generation
- Portfolio Analysis:
- Allocation charts and concentration metrics
- Optimization recommendations
- "Ask Laurent" handoff to AI coach with prefilled portfolio prompt
- AI Coach:
- Dedicated coach page
- Global moving mascot launcher
- Clear chat history
- Context-aware responses using trade, bias, insights, and portfolio optimization context
- Frontend: React, Vite, TypeScript, Tailwind, shadcn/ui, Recharts
- Backend services: Supabase (Auth, Postgres, Edge Functions)
- Optional analysis API: FastAPI + Polars (
backend/)
- Node.js 18+ and npm
- Supabase project (URL + anon key)
- Optional: Python 3.12+ and
uvfor the FastAPI service
Copy the template and fill values:
cp .env.example .envRequired:
VITE_SUPABASE_URLVITE_SUPABASE_PUBLISHABLE_KEY
Optional:
VITE_API_URL(FastAPI endpoint, defaults tohttp://localhost:8000if used)VITE_AI_COACH_AVATAR_URL(coach profile image)VITE_AI_COACH_MASCOT_URL(moving launcher image, defaults to/mascot-walking.gif)
npm install
npm run devProduction build:
npm run build
npm run previewcd backend
uv sync
uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000API docs: http://localhost:8000/docs
The app calls Supabase Edge Function ai-coach.
If you deploy/update it, ensure:
- Function is deployed.
- Secret
LOVABLE_API_KEYis set in Supabase project secrets.
Parser supports flexible headers. Minimum required columns are:
- timestamp/date
- action (buy/sell)
- asset/symbol
Additional useful columns:
- quantity
- entry_price
- exit_price
- pnl
- account_balance
- notes
npm run dev- start local frontendnpm run build- production buildnpm run preview- preview buildnpm run lint- lint projectnpm run test- run Vitest tests
src/- frontend appsrc/pages/- main product pagessrc/components/- UI + coach componentssrc/lib/- data/services/insight logicsupabase/- migrations + edge functionsbackend/- optional FastAPI analysis APIdocs/DEPLOYMENT.md- deployment notes
Use Vercel for frontend and Supabase for backend services.
See docs/DEPLOYMENT.md for deployment steps.