Inspiration

We were always curious about trading but felt lost: dozens of tabs, scattered tutorials, and no quick, constructive feedback. Learning trading meant repeating mistakes without a coach. From that frustration we built JBAC AI Trading Coach - a platform that turns hesitation into execution by combining real market data, paper trading, and multi‑agent AI that teaches you why a decision makes sense, not just what to do.

What it does

JBAC AI Trading Coach is an interactive, full‑stack learning environment that:

  • Provides an AI “coach” that answers trading questions, explains indicators, and critiques trades.
  • Runs paper trades and simulates portfolio P&L, Sharpe, drawdown and win rate.
  • Streams live market snapshots and technical indicators (EMA, RSI, MACD).
  • Orchestrates multi‑agent workflows (Planner → Critic → Synthesizer / Coach) to produce structured, educational guidance.
  • Exposes REST endpoints for coach, plan, critique, market data, and trade simulation.

How we built it

  • Frontend: Angular 17 + Tailwind CSS + RxJS - SPA client with chat, trade analysis UI, and portfolio dashboards.
  • Backend: FastAPI (Python 3.11) + Uvicorn - async REST API serving agent endpoints and portfolio simulation.
  • AI layer: Amazon Bedrock - Nova Micro for lightweight agent tasks via serverless Lambdas.
  • Serverless: AWS Lambda functions for agent orchestration and market data microservices.
  • Data & storage: AWS DynamoDB for Users / Portfolios / Trades; local caching for repeated queries.
  • Market data: yfinance + pandas + ta (technical indicators).
  • Deployment & infra: EC2 (Ubuntu) hosting Nginx + static Angular build; systemd service for FastAPI; Certbot/Let’s Encrypt for TLS; domain: trading.jbac.dev.
  • Authentication: Google OAuth 2.0 (Authorization Code flow) + JWT for session tokens.

Key implementation notes

  • Multi‑agent prompt templates and safety rules live in the agents layer.
  • Planner, Critic and Synthesizer orchestration implemented in backend endpoints (/api/trade-analysis, /api/coach, /api/critique).
  • Frontend uses an ApiService to call endpoints and stream AI responses.
  • Market snapshots and on‑the‑fly indicators are computed with yfinance + pandas in backend services.

Challenges we ran into

  • OAuth & redirects: Google OAuth redirect URIs and CSP required careful configuration; mismatches cause redirect_uri_mismatch errors.
  • Bundle size: Angular builds exceeded budget; solved with lazy loading, AOT, and CSS trimming.
  • LLM cost & latency: Inference costs required an orchestration strategy (small Nova model for quick tasks, Bedrock Claude 3.5 for deep reasoning) plus caching to reduce token usage. We initially tried Anthropic Claude 3.5 Sonnet, but it incurred a high inference cost and finding a reliable cost -effective alternative was difficult.
  • Deployment ops: Nginx proxy rules, TLS chains, and systemd orchestration required iterative fixes to avoid 403/404/502 errors.
  • Data quality & rate limits: yfinance responses need validation and caching to handle missing data and avoid throttles.

Accomplishments that we're proud of

  • Production deployment combining EC2 hosting, Lambda functions, and Bedrock LLMs.
  • A multi‑agent AI system that delivers structured, educational critiques and plans rather than raw predictions.
  • End‑to‑end demo: real market data, interactive coaching, and paper trading on a single secure domain (https://trading.jbac.dev).
  • Robust engineering: systemd-managed backend, Nginx reverse proxy with TLS, and DynamoDB for serverless persistence.
  • Reproducible deployment docs and scripts.

What we learned

  • Teaching traders requires explanations and critiques - not just signals; prompt engineering and agent personas are essential.
  • Model orchestration (small vs large models) is key to balancing cost and quality.
  • Production readiness is often about ops: TLS, CORS, OAuth callbacks, logging, and monitoring.
  • Effective debugging in AWS (CloudWatch, journalctl, nginx logs) is required to make a reliable service.

What's next for JBAC AI Trading Coach

Short-term:

  • WebSockets for live market updates and coach streaming.
  • Historical backtesting and strategy replay.
  • Fine-tuned prompts and user-tailored learning paths.

Long-term:

  • Multi-asset support (crypto, FX, options).
  • Portfolio optimization and reinforcement-learning driven suggestions.
  • CI/CD with zero-downtime deployments and automated model-cost-aware routing.

Technical appendix (concise)

  • LLMs: Amazon Bedrock - Nova Micro (lightweight agent tasks).
  • Market data: yfinance, pandas, ta indicators.
  • API: FastAPI endpoints include /api/health, /api/plan, /api/coach, /api/critique, /api/trade-analysis, /api/paper_trade.
  • Frontend: Angular 17, Tailwind CSS, Google Identity Services.
  • Infra: EC2 + Nginx + Certbot, systemd service jbac-backend, DynamoDB tables (Users/Portfolios/Trades), Lambda functions for agents and market data.
  • Security: Google OAuth 2.0, JWT (HS256), strict CORS, HTTPS via Let's Encrypt.

Disclaimer: Educational only — not financial advice.

Built With

Share this project:

Updates