| Signal | Details |
|---|---|
| Product | Intraday options strategy platform with paper trading, backtesting, risk controls, and guarded live execution |
| What it demonstrates | Financial systems thinking, risk-aware engineering, simulation, API integration, and backend/frontend architecture |
| Differentiator | Live trading is intentionally gated behind explicit safety flags |
| Stack | Python, FastAPI, SQLite, React, Docker, Upstox API, vectorized backtesting |
Intraday options trading platform for Indian markets with a safe paper-trading default, guarded Upstox live execution, SQLite persistence, vectorized backtesting, morning reports, and a React dashboard.
- Paper trading by default with randomized slippage and idempotent order handling
- Upstox integration behind
DISABLE_LIVE_TRADINGand environment-based secrets - Data ingestion for historical candles, LTP polling, options chain snapshots, news, and screeners
- Modular strategy engine:
- Momentum breakout
- Opening-range fade / breakout-style intraday logic
- Mean reversion scalp
- Risk controls:
- Capital-aware sizing
- Per-trade loss cap
- Daily hard-stop at
₹1000 - Automatic square-off before market close
- Vectorized backtester with walk-forward and Monte Carlo resampling
- FastAPI + WebSocket backend and React dashboard
- Docker, GitHub Actions, and unit tests
algo-platform/
├─ backend/
├─ frontend/
├─ infra/
├─ docs/
└─ examples/
cp .env.example .envSet at minimum:
DISABLE_LIVE_TRADING=true
APP_ENV=development
DATABASE_URL=sqlite:///./backend/app/data/algo_platform.db
CAPITAL=20000
DAILY_LOSS_LIMIT=1000
PER_TRADE_LOSS_LIMIT=500docker compose up --buildBackend API starts on http://localhost:8000 and the frontend dev server on http://localhost:5173.
cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python -m unittest discover -s tests
python -m app.main run --mode paper --strategy momentum --start 2026-03-10 --end 2026-03-10 --config app/config.yml./examples/run_paper.shThis generates:
backend/runtime/morning_report.jsonbackend/runtime/trades.csvbackend/runtime/backtest_summary.json
- Create an Upstox developer app.
- Add your redirect URI in the Upstox console.
- Put credentials in
.env:UPSTOX_API_KEYUPSTOX_API_SECRETUPSTOX_ACCESS_TOKEN
- Keep
DISABLE_LIVE_TRADING=trueuntil you have validated paper mode. - Review docs/upstox_integration.md for the OAuth/token flow and live-trading safeguards.
python -m app.main run --mode live|paper|backtest --strategy momentum --start 2026-01-01 --end 2026-03-01 --config app/config.ymlModes:
paper: safe default, simulates fills using market data or synthetic candleslive: requires valid Upstox credentials andDISABLE_LIVE_TRADING=falsebacktest: runs historical simulation and exports metrics/trades
The backtester supports:
- Minute-bar simulation
- Slippage and commissions
- Market, limit, and stop logic
- Walk-forward evaluation
- Monte Carlo resampling
- CSV trade log export
Key metrics:
- Total return
- CAGR
- Sharpe ratio
- Sortino ratio
- Max drawdown
- Win rate
- Profit factor
- Max consecutive losses
- Daily PnL distribution
Default configuration:
- Capital:
₹20,000 - Max per-trade rupee loss:
₹500 - Max daily rupee loss:
₹1000 - No overnight positions
- Auto square-off near market close (
15:14 ISTby default)
Sizing formulas:
max_qty = floor((capital * max_exposure_pct) / (premium * lot_size))SL% = rupee_stop / (premium * lot_size * qty) * 100TP% = rupee_target / (premium * lot_size * qty) * 100
Daily pre-market tasks produce a JSON morning report including:
- Market cues
- News sentiment summary
- Screener candidates
- Optional shortlist for the day
cd backend
python -m unittest discover -s testsGitHub Actions installs dependencies, runs tests, and builds the Docker image on every push.
- Secrets are loaded only from environment variables
- API retries use exponential backoff
- Live-trading calls never run when
DISABLE_LIVE_TRADING=true - On API or network failures, the platform falls back to paper mode and surfaces alerts
- Logs redact sensitive credentials
This project is educational infrastructure for strategy research and controlled execution workflows. It does not guarantee profits or suitability for any market condition. You are responsible for validating strategies, brokerage behavior, taxes, compliance, and operational risk before using live capital.