Skip to content

Prithvi824/Backtest-IQ

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

StratMe Demo

Algorithmic trading backtest platform. Select a strategy, configure a date range, and watch live backtest results stream in real time over WebSocket.

┌─────────────────────────────────────────────────────────┐
│  ◈ StratMe                           ● CONNECTED        │
├──────────────┬──────────────────────────────────────────┤
│ STRATEGIES   │  ▸ EMA Trend Follow                      │
│              │  Symbol [ BTCUSDT ]  Interval [ 1h ]     │
│ ▐ EMA Trend  │  Start  [ 2024-01-01 ]                   │
│ ▐ RSI Bounce │  End    [ 2024-12-31 ]                   │
│ ▐ Supertrend │                                          │
│ ▐ ADX + EMA  │  [ ▶ RUN BACKTEST ]                      │
│              │                                          │
│              │  ● RUNNING ──────────── 72%              │
│              │  ████████████████░░░░░                   │
│              │                                          │
│              │  PERFORMANCE   RISK   TRADE DETAILS      │
│              │  48 trades     Sharpe  1.82              │
│              │  +62.5% win    Max DD  -4.2%             │
│              │  +₹124,500 ▲   PF      2.1x             │
└──────────────┴──────────────────────────────────────────┘

Repository Structure

stratme-demo/
├── backend/    # FastAPI + Celery + Redis — backtest engine and REST/WebSocket API
└── frontend/   # Vite + React 18 + TypeScript — trading terminal UI

Quick Start

Option 1 — Docker (recommended)

Run backend and frontend independently using their own docker compose files.

Backend:

cd backend
cp .env.example .env
docker compose up --build
# API: http://localhost:8000  |  Docs: http://localhost:8000/docs

Frontend:

cd frontend
cp .env.example .env          # VITE_API_BASE_URL, VITE_WS_BASE_URL
docker compose up --build
# App: http://localhost:5173

Option 2 — Local Development

Backend:

cd backend
uv sync
cp .env.example .env
docker run -d -p 6379:6379 redis:7-alpine   # or use existing Redis
uvicorn app.api.app:app --reload &
celery -A app.infrastructure.celery_app.celery_app worker --loglevel=info

Frontend:

cd frontend
npm install
cp .env.example .env
npm run dev
# http://localhost:5173

How It Works

  1. Strategy selection — the frontend fetches the fixed strategy list from GET /strategies/
  2. Form submissionPOST /backtest/create queues a Celery task and returns a backtest_id
  3. WebSocket — the frontend connects to WS /ws/{backtest_id} and receives live progress events (0 → 100%)
  4. Results — on completed, the full PaperTradeStats payload is rendered as stat cards and a sortable trade table

Detailed Docs

  • Backend README — API reference, architecture, environment variables
  • Frontend README — component structure, environment variables, Docker details

About

Algorithmic trading backtest platform — FastAPI + Celery + Redis backend with a React 18 + TypeScript terminal UI, streaming live results over WebSocket

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages