QuantZ is a comprehensive, high-performance platform for quantitative analysis, algorithmic strategy development, and backtesting. It combines a fast C++ computation core with a user-friendly, web-based visual strategy builder, enabling users to design, test, and analyze trading strategies without writing code.
The platform features a drag-and-drop interface where trading logic is constructed using a Directed Acyclic Graph (DAG). Strategies are built by connecting nodes representing technical indicators, logical operators, and trading actions (Buy/Sell).
- Visual Strategy Builder: An intuitive, web-based DAG editor using React Flow to build complex trading strategies by connecting nodes.
- High-Performance C++ Core: Critical mathematical and indicator calculations are implemented in C++ and accelerated using SIMD (AVX/SSE) instructions for maximum performance.
- Python/Flask Backend: A robust Python backend powered by Flask serves the API, manages data with Pandas, and orchestrates the backtesting engine.
- Pybind11 Integration: Seamlessly exposes the high-speed C++ computation functions to the Python environment.
- Comprehensive Backtesting: Run historical simulations on uploaded CSV data. The engine calculates detailed performance metrics, including total return, Sharpe ratio, max drawdown, and win rate, along with a full trade log and equity curve.
- Interactive Charting: Visualize historical price data with interactive candlestick charts powered by Plotly. Overlays for technical indicators generated from the strategy are displayed directly on the chart.
- Extensive Indicator Library: Includes a wide range of common technical indicators:
- Simple Moving Average (SMA)
- Exponential Moving Average (EMA)
- Weighted Moving Average (WMA) with various weighting schemes (Linear, Harmonic, Triangular, etc.)
- Volume-Weighted Moving Average (VWMA)
- Moving Average Convergence/Divergence (MACD)
- Relative Strength Index (RSI)
- Bollinger Bands
- Average True Range (ATR)
- Momentum
QuantZ is built on a multi-tiered architecture designed for performance and usability:
- Core (C++ & SIMD): At the lowest level,
simd_mathprovides SIMD-accelerated mathematical functions, andindicatorscontains the efficient C++ implementations of technical indicators. - API & Backtesting Layer (Python): A Flask API serves as the bridge. It handles data processing using Pandas, uses
pybind11to call the C++ core for fast computations, and runs thebacktest.pyengine to evaluate strategies defined by the DAG. - Frontend (React): A modern, responsive user interface built with React, Vite, and React Flow. It provides the visual strategy builder, charting, and backtesting dashboard that communicates with the Python backend via a REST API.
- Core: C, C++20, SIMD Intrinsics (AVX, SSE)
- Backend: Python, Flask, Pandas, Pybind11, Gunicorn
- Frontend: React, Vite, React Flow, Plotly.js
- Build Tools: setuptools (Python), GCC/G++, npm
- GCC & G++
- Python 3.x and Pip
- Node.js and npm
First, clone the repository:
git clone https://github.com/Dark-CodeX/QuantZ.git
cd QuantZInstall the required Python packages:
pip install -r src/python/requirements.txtBuild the C++ extension module. This compiles the core C/C++ files into a shared library that Python can import.
cd src
python setup.py build_ext --inplaceMove the compiled library into the Python application directory:
# The exact filename may vary based on your OS and Python version
mv quantzlib.*.so ./python/Finally, run the Flask backend server:
# From the src/ directory
gunicorn --chdir ./python -w 4 -b 0.0.0.0:10000 api:appThe backend will be running on http://localhost:10000.
In a new terminal, navigate to the web directory and install the dependencies:
cd src/web
npm installRun the frontend development server:
npm run devThe frontend will be accessible at http://localhost:5173 (or another port specified by Vite).
- Launch: Once both the backend and frontend servers are running, open your web browser to the frontend URL.
- New Workbook: From the home screen, click "New workbook" to upload a CSV file containing historical market data. The CSV should include columns for
Date,Open,High,Low,Close, andVolume. - Strategy Builder: You will be taken to the main interface with the "Strategy" tab active.
- Drag nodes (Indicators, Operators, Logic, Actions, Control) from the left panel onto the canvas.
- Connect the nodes to define the data flow and logic of your strategy. For example:
Start -> SMA -> More Than (>) -> TRUE -> Buy. - Double-click a node to open its settings panel. Configure parameters like indicator periods or operator values. Submitting indicator settings will automatically plot them on the chart.
- Chart: Switch to the "Chart" tab to view the candlestick chart of your data, with any configured indicators overlaid.
- Backtest:
- Navigate to the "Backtest" tab.
- Set the initial capital, position size, commission/slippage, and date range for the simulation.
- Click "Run" to execute the backtest.
- Analyze Results: The backtest results will be displayed, including:
- An interactive equity curve chart.
- Key performance metrics.
- A detailed table of all trades executed during the simulation.
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for more details.