Paper-first algorithmic trading desk for Indian retail equities (NSE / BSE).
JWT auth · broker adapters · RSI/EMA backtests · paper execution · risk gates · kill-switch
| Layer | Technology | Role |
|---|---|---|
| API | Python 3.12 · FastAPI · Uvicorn | Auth, strategies, backtest, orders, risk |
| ORM / migrations | SQLAlchemy 2 · Alembic | Schema + multi-tenant models |
| Database | PostgreSQL + TimescaleDB (SQLite local fallback) | Relational + ohlc_1m bars |
| Cache | Redis (optional) | Sessions / marks — degrades gracefully |
| Client | Flutter (Windows · Web · Mobile) | Desk UI: dashboard, strategies, backtest, orders |
| Brokers | Zerodha Kite · Angel One SmartAPI · MOCK | Adapter protocol; MOCK for local paper |
| Infra | Docker Compose | Postgres/Timescale + Redis + API |
| CI / Release | GitHub Actions | Tests on push · Releases + notes on version tags |
┌─────────────┐ JWT ┌──────────────────┐ adapters ┌────────────┐
│ Flutter │ ───────────► │ FastAPI /api/v1 │ ───────────────► │ Zerodha / │
│ desk UI │ ◄─────────── │ risk · paper │ ◄─────────────── │ Angel/MOCK │
└─────────────┘ JSON/SSE └────────┬─────────┘ └────────────┘
│
┌───────────┴───────────┐
│ Postgres/Timescale │
│ (+ Redis optional) │
└───────────────────────┘
cd backend
py -3 -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt
copy ..\.env.example .env
python -m app.scripts.seed_data
python -m uvicorn app.main:app --reload --port 8000After activation use
python, notpy -3— the Windows launcher skips the venv.
- Health: http://127.0.0.1:8000/health
- Swagger: http://127.0.0.1:8000/docs
- Landing: http://127.0.0.1:8000/
cd frontend
flutter pub get
flutter run -d windows --dart-define=API_BASE=http://127.0.0.1:8000copy .env.example .env
docker compose up --build- Register / login → JWT
- Connect MOCK broker (auto on Flutter register)
- Seed OHLC → run RSI / EMA backtest
- Create & start PAPER strategy (TP / SL)
- Place paper orders · hit kill-switch when needed
LIVE stays off until LIVE_TRADING_ENABLED=true and real broker keys are set.
Every push to master / main (except commits marked [skip release]) will:
- Bump the patch version in
VERSION+ Flutterpubspec.yaml - Tag
vX.Y.Zand push it - Build Android APK + Windows ZIP (EXE bundle)
- Publish a GitHub Release with auto-generated notes + installers
- Update
backend/app/data/client_release.jsonso older apps see a mandatory update
Set repository variable API_BASE (Settings → Variables) to your production API URL so release builds point at the right backend. Set GITHUB_REPO=owner/AutoTradeX in .env so the API can also resolve latest assets from GitHub.
Flutter calls GET /api/v1/app/update?client_version=… on launch. If the installed build is behind latest_version, the UI blocks with download buttons for APK / Windows ZIP until the user upgrades.
Local tip: keep client_release.json latest_version equal to the running app (0.1.0) so force-update does not fire during development. Set FORCE_CLIENT_UPDATE=false to disable the gate entirely.
cd backend
python -m pytest -q- Architecture
- Compliance notes (engineering posture — not legal advice)
- Changelog
Built paper-first. Real capital only after risk, compliance, and broker readiness.