Spaces:
Running
Running
File size: 2,067 Bytes
5c716c1 b1f38ad 5c716c1 b1f38ad 5c716c1 b1f38ad | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | ---
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 account
- `POST /login` - Get JWT access token
### Trading
- `POST /backtest` - Run strategy backtesting
- `POST /start-live-trading` - Start simulated trading session
- `POST /stop-live-trading/{session_id}` - Stop trading session
- `GET /portfolio` - Get user portfolio balance
- `GET /trading-sessions` - List all trading sessions
- `GET /trades` - Get trade history
### Data
- `GET /price/{ticker}` - Get current price for ticker
- `GET /dashboard` - Get dashboard metrics
## Environment Variables
Required for production:
```bash
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
```bash
# 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*
|