A professional algorithmic trading platform built with FastAPI + React + TypeScript.
- π Real-time Market Data - Live quotes and WebSocket streaming
- πΌ Portfolio Management - Track positions, P&L, and performance
- π Advanced Charting - Professional charts with Recharts
- π€ Strategy Automation - Deploy and manage trading algorithms
- π Backtesting - Test strategies on historical data
- π¨ Bloomberg-Inspired UI - Clean, professional dark theme
- β‘ Fast & Modern - FastAPI backend, React frontend with Vite
- Framework: FastAPI (Python 3.10+)
- Real-time: WebSocket for live data streaming
- Trading: Alpaca API integration
- Data: yfinance for market data
- Framework: React 18 + TypeScript
- Build Tool: Vite (ultra-fast)
- Styling: TailwindCSS (Bloomberg-inspired theme)
- Charts: Recharts for visualizations
- State: React Query for server state
- Routing: React Router
- Python 3.10+
- Node.js 18+ and npm
- Alpaca API keys (paper or live)
cd "/Volumes/File System/Algorithmic Trading"
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install backend dependencies
pip install -r requirements-backend.txt
# Install frontend dependencies
cd frontend
npm install
cd ..# Copy environment template
cp .env.example .env
# Edit .env and add your Alpaca API keys
nano .envOption A: Run Both (Recommended)
# Terminal 1 - Backend
./start_backend.sh
# Terminal 2 - Frontend
cd frontend && npm run devOption B: Development Mode
# Backend with auto-reload
cd backend && python -m uvicorn main:app --reload
# Frontend with hot reload
cd frontend && npm run dev- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/api/docs
- ReDoc: http://localhost:8000/api/redoc
AlphaFlow/
βββ backend/ # FastAPI Backend
β βββ main.py # Main FastAPI app
β βββ api/ # API endpoints
β β βββ trading.py # Order management
β β βββ market_data.py # Market data & quotes
β β βββ backtest.py # Backtesting
β β βββ portfolio.py # Portfolio metrics
β β βββ strategies.py # Strategy management
β βββ core/ # Core utilities
β βββ websocket_manager.py
β
βββ frontend/ # React Frontend
β βββ src/
β β βββ pages/ # Page components
β β βββ components/ # Reusable components
β β βββ api/ # API client
β β βββ App.tsx # Main app
β βββ package.json
β βββ vite.config.ts
β
βββ core/ # Shared trading logic
β βββ backtester.py # Backtest engine
β βββ indicators.py # Technical indicators
β βββ strategies.py # Trading strategies
β βββ ...
β
βββ requirements-backend.txt
βββ start_backend.sh
βββ README.md
- Dark Theme: Professional dark color scheme
- Clean Typography: SF Pro Display + SF Mono
- Real-time Updates: Live data with color flash animations
- Responsive Tables: Professional data grids
- Modern Charts: Interactive visualizations
- Dashboard - Portfolio overview, watchlist, equity curve
- Trading - Order placement and management
- Analytics - Performance metrics and analytics
- Backtest - Strategy backtesting interface
- Strategies - Deploy and manage algorithms
- Settings - Configuration and preferences
POST /api/trading/orders- Place orderGET /api/trading/orders- Get ordersDELETE /api/trading/orders/{id}- Cancel orderGET /api/trading/positions- Get positions
GET /api/market/quote/{symbol}- Get quoteGET /api/market/quotes- Get multiple quotesGET /api/market/history/{symbol}- Get historical dataGET /api/market/search- Search symbols
POST /api/backtest/run- Start backtestGET /api/backtest/status/{id}- Get statusGET /api/backtest/results/{id}- Get results
GET /api/portfolio/summary- Portfolio summaryGET /api/portfolio/performance- Performance metricsGET /api/portfolio/history- Equity curve
# Auto-reload on code changes
python -m uvicorn backend.main:app --reload --port 8000
# Run tests
pytest tests/cd frontend
# Development server with hot reload
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview# Using Gunicorn
gunicorn backend.main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000
# Using Docker
docker build -t alphaflow-backend .
docker run -p 8000:8000 alphaflow-backendcd frontend
npm run build
# Serve dist/ folder with nginx, Vercel, or Netlify- FastAPI - Modern, fast web framework
- Uvicorn - ASGI server
- WebSockets - Real-time communication
- Alpaca API - Trading execution
- yfinance - Market data
- pandas - Data manipulation
- scikit-learn - Machine learning
- React 18 - UI framework
- TypeScript - Type safety
- Vite - Build tool
- TailwindCSS - Styling
- React Query - Server state
- React Router - Navigation
- Recharts - Charts
- Lucide React - Icons
- Axios - HTTP client
- API keys stored in
.env(never committed) - CORS configured for frontend origin
- Input validation with Pydantic
- Type safety with TypeScript
MIT License - See LICENSE file
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
For issues and questions:
- Open an issue on GitHub
- Check API documentation at
/api/docs
Made with FastAPI + React | Version 7.0.0 | Professional Trading Platform