This repository contains the backend engine of a modular trading framework built in Python. It handles backtesting, market data processing, and strategy execution, designed to integrate seamlessly with a separate frontend dashboard for visualization and user interaction.
👉 Frontend Repository: Backtest Dashboard (React/Next.js)
👉 Results Viewer: Backtest Results Viewer (React/Next.js)
- Python: 3.10+
- Libraries: Pandas, NumPy, PyYAML, Plotly, Pillow
- API: FastAPI (REST), WebSocket for real-time updates
- Server: Uvicorn (ASGI)
- 🔁 Backtesting Engine: Realistic order simulation with robust risk management.
- 📊 Performance Analytics: Compute trade statistics and generate visual reports.
- 💾 Market Data Module: Flexible data loader supporting CSV.
- 🧩 Strategy Plugin System: Easily extendable with new strategies.
- 📸 Screenshot Capture System: Automatically generates snapshots of trade entries, including indicators and analysis, for later review in the Results Viewer.
- 🪵 Logging System: color-formatted runtime logs with adjustable verbosity.
- 🧠 Walk-Forward Testing: 🚧 Currently under development – Evaluate strategies across multiple time periods.
- 🌐 API Integration: Communicates with the frontend via REST and WebSocket interfaces.
Backtesting/
├─ Engine.py # Core backtesting logic
├─ MarketData/ # Data loading and formatting
├─ OrderManager/ # Order handling and validation
├─ Statistics/ # Performance metrics
└─ ChartRenderer/ # Visualization utilities
Strategies/
├─ Template.py # Template strategy
└─ configs/ # YAML configs for strategies
main.py # Backend entry point
config.yaml # Global configuration
chart_config.yaml # Chart settings for screenshots
- Python 3.10+
- pip for installing dependencies
pip install -r requirements.txtuvicorn main:app --reload --log-level critical- The backend exposes REST endpoints and WebSocket streams consumed by the Frontend Dashboard.
- The frontend visualizes live or backtested results in real-time.
- Communication is handled via REST API and WebSocket updates.
To create a custom strategy:
- Add a new Python file under
Strategies/(useTemplate.pyas a reference). - Create a corresponding YAML config file in
Strategies/configs/. - Launch the backend and view results in the connected frontend.
This project is licensed under the MIT License. See the LICENSE file for details.

