Skip to content

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

112 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– AI Trading Copilot

The AI-powered trading platform that doesn't just show signals β€” it explains them.

Live App Backend API GitHub License

πŸŽ“ For educational purposes only Β· Paper trading Β· Not financial advice


πŸ’‘ The Problem We Solve

Every trading app shows you WHAT:

RSI: 34.2  Β·  MACD crossover  Β·  Signal: BUY

We tell you WHY:

"RSI at 34.2 suggests oversold conditions. MACD is crossing above its signal
line indicating bullish momentum building. Price action down 2.1% over last
20 candles β€” a classic reversal setup is forming. Confidence: 78%"

Bloomberg Terminal charges $24,000/year for this level of insight. AI Trading Copilot is free. Forever.


πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         USER (Browser)                          β”‚
β”‚                    Mobile / Desktop / PWA                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚  HTTPS
                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              FRONTEND  Β·  Vercel (Edge Network)                 β”‚
β”‚                                                                 β”‚
β”‚   Next.js 14  Β·  TypeScript  Β·  Tailwind CSS                   β”‚
β”‚   NextAuth.js  Β·  TradingView Charts  Β·  Recharts               β”‚
β”‚                                                                 β”‚
β”‚   Pages: Home Β· Markets Β· Dashboard Β· Learn Β· News             β”‚
β”‚          Leaderboard Β· Contact Β· About Β· Auth                   β”‚
β”‚          Forgot Password Β· Reset Password                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚  REST API (JSON)
                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              BACKEND  Β·  Render (Free Tier)                     β”‚
β”‚                                                                 β”‚
β”‚   FastAPI (Python)  Β·  SQLAlchemy  Β·  JWT Auth                 β”‚
β”‚   Pydantic  Β·  httpx  Β·  bcrypt                                 β”‚
β”‚                                                                 β”‚
β”‚   20+ API Routers: auth Β· signals Β· trades Β· portfolio         β”‚
β”‚   alerts Β· journal Β· backtest Β· chat Β· community               β”‚
β”‚   sentiment Β· news Β· leaderboard Β· contact Β· admin             β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                    β”‚                        β”‚
       β–Ό                    β–Ό                        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  DATABASE   β”‚   β”‚    AI PROVIDERS  β”‚   β”‚   MARKET DATA APIs  β”‚
β”‚             β”‚   β”‚                  β”‚   β”‚                     β”‚
β”‚ PostgreSQL  β”‚   β”‚ OpenRouter Gemma β”‚   β”‚ KuCoin   (Crypto)   β”‚
β”‚ Neon Cloud  β”‚   β”‚ (Free β€” default) β”‚   β”‚ TwelveData (Forex)  β”‚
β”‚             β”‚   β”‚        ↓         β”‚   β”‚ Polygon.io (Stocks) β”‚
β”‚ Users       β”‚   β”‚ Anthropic Claude β”‚   β”‚ NewsAPI  (News)     β”‚
β”‚ Trades      β”‚   β”‚ (Paid β€” premium) β”‚   β”‚ Yahoo Finance       β”‚
β”‚ Signals     β”‚   β”‚        ↓         β”‚   β”‚ ExchangeRate API    β”‚
β”‚ Alerts      β”‚   β”‚ Rule-based       β”‚   β”‚                     β”‚
β”‚ Journal     β”‚   β”‚ (No key needed)  β”‚   β”‚                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ” Authentication Flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     POST /auth/register      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  User    β”‚ ────────────────────────────► β”‚   Backend    β”‚
β”‚ Register β”‚                               β”‚  Create user β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ◄──────────────────────────── β”‚  Return JWT  β”‚
                    JWT Token              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     POST /auth/login          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  User    β”‚ ────────────────────────────► β”‚   Backend    β”‚
β”‚  Login   β”‚                               β”‚ Verify pass  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ◄──────────────────────────── β”‚  Return JWT  β”‚
                    JWT Token              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   GET /dashboard (+ JWT)      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Protected β”‚ ────────────────────────────► β”‚   Backend    β”‚
β”‚  Route   β”‚                               β”‚ Validate JWT β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ◄──────────────────────────── β”‚  User data   β”‚
                   Session data            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”‘ Forgot Password Flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                                                 β”‚
β”‚  1. User clicks "Forgot password?" on Login page               β”‚
β”‚                          β”‚                                      β”‚
β”‚                          β–Ό                                      β”‚
β”‚  2. /forgot-password β€” Enter email address                      β”‚
β”‚                          β”‚                                      β”‚
β”‚                          β–Ό                                      β”‚
β”‚  3. Backend generates secure token (expires in 1 hour)         β”‚
β”‚     Sends reset link to email via Web3Forms                     β”‚
β”‚                          β”‚                                      β”‚
β”‚                          β–Ό                                      β”‚
β”‚  4. User receives email with link:                              β”‚
β”‚     https://kw-trading-copilot.vercel.app/reset-password?token=β”‚
β”‚                          β”‚                                      β”‚
β”‚                          β–Ό                                      β”‚
β”‚  5. /reset-password β€” Enter new password + confirm             β”‚
β”‚                          β”‚                                      β”‚
β”‚                          β–Ό                                      β”‚
β”‚  6. Backend verifies token β†’ updates password β†’ clears token   β”‚
β”‚                          β”‚                                      β”‚
β”‚                          β–Ό                                      β”‚
β”‚  7. βœ… Redirect to /login β€” sign in with new password          β”‚
β”‚                                                                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“Š 27 Live Markets

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      ASSET CATEGORIES                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   CRYPTO   β”‚   FOREX    β”‚  STOCKS  β”‚COMMODITIES β”‚ INDICES  β”‚
β”‚  7 assets  β”‚  7 pairs   β”‚ 7 stocks β”‚  3 assets  β”‚ 3 index  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ BTC/USDT   β”‚ EUR/USD    β”‚ AAPL     β”‚ XAU (Gold) β”‚ SPY      β”‚
β”‚ ETH/USDT   β”‚ GBP/USD    β”‚ MSFT     β”‚ XAG (Silverβ”‚ QQQ      β”‚
β”‚ SOL/USDT   β”‚ USD/JPY    β”‚ TSLA     β”‚ WTI (Oil)  β”‚ DIA      β”‚
β”‚ BNB/USDT   β”‚ AUD/USD    β”‚ GOOGL    β”‚            β”‚          β”‚
β”‚ XRP/USDT   β”‚ USD/CAD    β”‚ AMZN     β”‚            β”‚          β”‚
β”‚ ADA/USDT   β”‚ USD/CHF    β”‚ NVDA     β”‚            β”‚          β”‚
β”‚ DOGE/USDT  β”‚ NZD/USD    β”‚ META     β”‚            β”‚          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  KuCoin    β”‚ TwelveData β”‚ Polygon  β”‚ TwelveData β”‚ Polygon  β”‚
β”‚    API     β”‚    API     β”‚   API    β”‚    API     β”‚   API    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ€– AI Signal Pipeline

User requests signal for BTCUSDT
            β”‚
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Fetch live market    β”‚
β”‚  data (price, OHLCV)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Calculate technical  β”‚
β”‚  indicators:          β”‚
β”‚  RSI Β· MACD Β· BB      β”‚
β”‚  EMA Β· ATR Β· Volume   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Send to AI provider  │────►│  OpenRouter      β”‚
β”‚  with full context    β”‚     β”‚  Gemma (Free)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚  fallback  ────►│ Anthropic Claude β”‚
            β”‚                 β”‚   (Premium)      β”‚
            β”‚                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚  fallback  ────►│  Rule-based      β”‚
            β”‚                 β”‚  (No key needed) β”‚
            β–Ό                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  AI Response:         β”‚
β”‚  Β· Direction: BUY     β”‚
β”‚  Β· Confidence: 78%    β”‚
β”‚  Β· Risk: Medium       β”‚
β”‚  Β· Full reasoning     β”‚
β”‚    in plain English   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Features

# Feature Description
1 πŸ€– Explainable AI Signals BUY/SELL/HOLD with full plain-English reasoning
2 πŸ“ˆ TradingView Charts Professional candlesticks, volume, 4 timeframes
3 πŸ• Multi-Timeframe Analysis 1D+1W+1M signals merged into one verdict
4 ⚑ 5 Backtest Strategies RSI+MACD, Bollinger, EMA, SuperTrend, Mean Rev
5 πŸ“š AI Trade Journal Auto coaching after every trade
6 πŸ“Š Portfolio Analytics Equity curve, Sharpe ratio, max drawdown
7 πŸ‘₯ Community Signals Share ideas, vote, see collective consensus
8 πŸ”” Price Alerts Price-above / price-below on any asset
9 πŸ“ Risk Manager Position sizing by capital + risk %
10 πŸ’¬ AI Market Chat Ask anything, AI answers with live data
11 🌑️ Sentiment Heatmap Market mood across all 27 assets
12 πŸ“° Live News Feed Real-time news filtered by asset
13 πŸ† Leaderboard Top traders ranked by signals + P&L
14 πŸ“± PWA β€” Offline Install on phone, works without internet
15 πŸ” Forgot Password Secure email reset link (1 hour expiry)
16 πŸ‘€ User Avatar Professional navbar with user initial
17 πŸ“ž Phone + Country Code Contact form with 20 country flags
18 πŸ›‘οΈ Admin Dashboard Real-time stats (admin only)

🌐 All Pages (21 Total)

/                    β†’ Landing page (public)
/login               β†’ Sign in
/register            β†’ Create account
/forgot-password     β†’ Request reset link
/reset-password      β†’ Set new password
/dashboard           β†’ Main app (protected)
/markets             β†’ All markets overview
/markets/crypto      β†’ Cryptocurrency
/markets/forex       β†’ Forex pairs
/markets/stocks      β†’ US Stocks
/markets/commodities β†’ Gold, Silver, Oil
/markets/indices     β†’ S&P, NASDAQ, Dow
/learn               β†’ Trading education
/news                β†’ Market news
/leaderboard         β†’ Top traders
/about               β†’ About page
/contact             β†’ Contact form
/privacy             β†’ Privacy policy
/terms               β†’ Terms of service
/admin               β†’ Admin panel
/offline             β†’ PWA offline page

πŸ› οΈ Tech Stack

Frontend

Next.js 14 (App Router)    TypeScript         Tailwind CSS
NextAuth.js (JWT)          TradingView v5     Recharts
Web3Forms (email)          Vercel Analytics   PWA

Backend

FastAPI (Python)    SQLAlchemy ORM     PostgreSQL (Neon)
Pydantic v2         bcrypt             python-jose (JWT)
httpx               secrets            smtplib

Infrastructure

Vercel     β†’ Frontend hosting (free)
Render     β†’ Backend API (free)
Neon       β†’ PostgreSQL cloud (free)
Web3Forms  β†’ Contact + reset emails (free)

πŸš€ Local Development

1. Clone

git clone https://github.com/khanzadigithubid/Trading-Copilot.git
cd Trading-Copilot

2. Backend

cd backend
python -m venv .venv

# Windows
.venv\Scripts\activate

# Mac/Linux
source .venv/bin/activate

pip install -r requirements.txt

3. Backend .env

DATABASE_URL=sqlite:///./trading_copilot.db
SECRET_KEY=your-32-char-secret-key
CORS_ORIGINS=http://localhost:3000

# Free AI (get key at openrouter.ai/keys)
OPENROUTER_API_KEY=sk-or-...
OPENROUTER_MODEL=google/gemma-4-26b-a4b-it:free

# Market Data
TWELVE_DATA_API_KEY=your-key
POLYGON_API_KEY=your-key
NEWS_API_KEY=your-key

# Admin access
ADMIN_EMAIL=[email protected]

# Password reset emails
WEB3FORMS_KEY=your-key
FRONTEND_URL=http://localhost:3000

4. Run Backend

uvicorn app.main:app --reload --port 8000
# API Docs: http://localhost:8000/docs

5. Frontend

cd frontend
npm install

6. Frontend .env.local

NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=any-random-32-char-string
NEXT_PUBLIC_API_URL=http://localhost:8000

7. Run Frontend

npm run dev
# App: http://localhost:3000

🌐 Deployment Guide

Backend β†’ Render

1. render.com β†’ New Web Service
2. Connect GitHub repo
3. Root Directory: backend
4. Build: pip install -r requirements.txt
5. Start: uvicorn app.main:app --host 0.0.0.0 --port $PORT
6. Add env vars β†’ Deploy

Frontend β†’ Vercel

1. vercel.com β†’ Import repo
2. Root Directory: frontend
3. Add env vars:
   NEXTAUTH_URL         = https://your-app.vercel.app
   NEXTAUTH_SECRET      = random-32-char-string
   NEXT_PUBLIC_API_URL  = https://your-backend.onrender.com
4. Deploy

πŸ“‘ API Reference

Method Endpoint Description
GET /health Health check
POST /auth/register Create account
POST /auth/login Login + get JWT
GET /auth/me Current user info
POST /auth/refresh Refresh JWT token
POST /auth/forgot-password Send reset email
POST /auth/reset-password Set new password
GET /assets List 27 assets
GET /assets/{symbol}/price Live price
GET /assets/{symbol}/history OHLCV data
GET /signals/{symbol} AI signal
GET /signals/{symbol}/mtf Multi-timeframe
POST /backtest/run Run backtest
POST /chat/query AI market chat
GET /portfolio/stats Analytics
GET /journal Trade journal
GET /sentiment Sentiment data
GET /news News feed
GET /leaderboard Top traders
GET /community/feed Community signals
POST /contact Contact form
GET /admin/stats Admin analytics
WS /ws/prices Live prices

πŸ“– Full interactive docs: https://trading-copilot-api-okr7.onrender.com/docs


πŸ“ Project Structure

Trading-Copilot/
β”‚
β”œβ”€β”€ πŸ“ backend/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”‚   β”œβ”€β”€ config.py         # All settings + env vars
β”‚   β”‚   β”‚   β”œβ”€β”€ database.py       # SQLAlchemy engine
β”‚   β”‚   β”‚   └── security.py       # JWT + bcrypt
β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”‚   β”œβ”€β”€ user.py           # User + reset token
β”‚   β”‚   β”‚   β”œβ”€β”€ trade.py          # Paper trades
β”‚   β”‚   β”‚   β”œβ”€β”€ alert.py          # Price alerts
β”‚   β”‚   β”‚   β”œβ”€β”€ signal.py         # Cached AI signals
β”‚   β”‚   β”‚   β”œβ”€β”€ asset.py          # 27 market assets
β”‚   β”‚   β”‚   β”œβ”€β”€ community_signal.py
β”‚   β”‚   β”‚   └── sentiment_log.py
β”‚   β”‚   β”œβ”€β”€ routers/              # 20+ API endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.py           # Login/register/reset
β”‚   β”‚   β”‚   β”œβ”€β”€ signals.py        # AI signals
β”‚   β”‚   β”‚   β”œβ”€β”€ trades.py         # Paper trading
β”‚   β”‚   β”‚   β”œβ”€β”€ portfolio.py      # Analytics
β”‚   β”‚   β”‚   β”œβ”€β”€ backtest.py       # Strategy testing
β”‚   β”‚   β”‚   β”œβ”€β”€ chat.py           # AI chat
β”‚   β”‚   β”‚   β”œβ”€β”€ alerts.py         # Price alerts
β”‚   β”‚   β”‚   β”œβ”€β”€ journal.py        # Trade journal
β”‚   β”‚   β”‚   β”œβ”€β”€ community.py      # Social signals
β”‚   β”‚   β”‚   β”œβ”€β”€ contact.py        # Contact form
β”‚   β”‚   β”‚   └── admin.py          # Admin stats
β”‚   β”‚   └── services/
β”‚   β”‚       β”œβ”€β”€ market_data/      # KuCoin/Polygon/TwelveData
β”‚   β”‚       β”œβ”€β”€ claude_client.py  # AI provider wrapper
β”‚   β”‚       β”œβ”€β”€ backtest_engine.py
β”‚   β”‚       └── risk_manager.py
β”‚   └── requirements.txt
β”‚
└── πŸ“ frontend/
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ app/                  # 21 pages
    β”‚   β”‚   β”œβ”€β”€ dashboard/        # Main trading app
    β”‚   β”‚   β”œβ”€β”€ markets/          # 5 market pages
    β”‚   β”‚   β”œβ”€β”€ forgot-password/  # Reset request
    β”‚   β”‚   β”œβ”€β”€ reset-password/   # Set new password
    β”‚   β”‚   β”œβ”€β”€ contact/          # Web3Forms contact
    β”‚   β”‚   └── ...
    β”‚   β”œβ”€β”€ components/           # 15+ React components
    β”‚   β”‚   β”œβ”€β”€ AssetDashboard    # 27 assets table
    β”‚   β”‚   β”œβ”€β”€ SignalPanel       # AI signals
    β”‚   β”‚   β”œβ”€β”€ CandlestickChart  # TradingView chart
    β”‚   β”‚   β”œβ”€β”€ PaperTradingPanel # Virtual trading
    β”‚   β”‚   β”œβ”€β”€ PortfolioPanel    # Analytics
    β”‚   β”‚   β”œβ”€β”€ BacktestPanel     # Backtester
    β”‚   β”‚   β”œβ”€β”€ ChatPanel         # AI chat
    β”‚   β”‚   β”œβ”€β”€ ChatWidget        # Floating bubble
    β”‚   β”‚   └── MobileNav         # Mobile hamburger
    β”‚   β”œβ”€β”€ lib/
    β”‚   β”‚   β”œβ”€β”€ auth.ts           # NextAuth config
    β”‚   β”‚   └── api.ts            # API fetch wrapper
    β”‚   └── types/
    β”‚       └── next-auth.d.ts    # Auth type defs
    └── public/                   # PWA icons + manifest

⚠️ Disclaimer

This platform is for educational purposes only.

  • ❌ Does NOT execute real trades
  • ❌ AI signals are NOT financial advice
  • ❌ Past performance does NOT guarantee future results
  • βœ… Paper trading uses virtual money only
  • βœ… Always do your own research

πŸ“„ License

MIT License β€” free to use, modify, and distribute with attribution.


πŸ‘©β€πŸ’» Built by Khanzadi

🌐 Live App Β Β·Β  πŸ’» GitHub Β Β·Β  πŸ“¬ Contact

If this project helped you, please give it a ⭐ on GitHub!

For educational purposes only Β· Not financial advice

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages