Spaces:
Running
Running
metadata
title: AlgoQuant Backend API
emoji: π
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
license: mit
AlgoQuant Backend API π
Production-grade FastAPI backend for algorithmic cryptocurrency trading with AI-powered strategies.
Features
- π€ HMM-SVR Walk-Forward Strategy - Zero lookahead bias backtesting
- π Pairs Trading - Statistical arbitrage (ETH/BTC)
- πΌ Paper Trading - Simulated trading with $10,000 starting capital
- π Secure Auth - JWT authentication with bcrypt
- β‘ Real-Time Data - Binance Testnet + Yahoo Finance
API Documentation
Once deployed, access the interactive API docs at:
- Swagger UI:
https://your-space-name.hf.space/docs - ReDoc:
https://your-space-name.hf.space/redoc
Endpoints
Authentication
POST /signup- Create new user accountPOST /login- Get JWT access token
Trading
POST /backtest- Run strategy backtestingPOST /start-live-trading- Start simulated trading sessionPOST /stop-live-trading/{session_id}- Stop trading sessionGET /portfolio- Get user portfolio balanceGET /trading-sessions- List all trading sessionsGET /trades- Get trade history
Data
GET /price/{ticker}- Get current price for tickerGET /dashboard- Get dashboard metrics
Environment Variables
Required for production:
DATABASE_URL=postgresql://user:password@host:5432/dbname
SECRET_KEY=your-secret-key-here
Tech Stack
- FastAPI - Modern async web framework
- PostgreSQL - Production database
- SQLModel - SQL ORM with type safety
- scikit-learn - Machine learning
- hmmlearn - Hidden Markov Models
- yfinance - Free market data
Local Development
# Install dependencies
pip install -r requirements.txt
# Train HMM model
python train_hmm_model.py
# Run server
uvicorn main:app --reload --port 8000
License
MIT License - See LICENSE for details
Built with π§ for quantitative traders
Part of the AlgoQuant AI-Powered Trading Platform