Open-core backtesting framework for quantitative trading strategies
Project description
QuantCore
Open-core backtesting framework for quantitative trading strategies.
QuantCore lets you backtest trading strategies against historical OHLCV data with a clean Python API and CLI. The free tier includes three battle-tested strategies and essential performance metrics. Upgrade to Pro for advanced strategies, Monte Carlo simulation, tearsheet PDF reports, and parameter optimization.
Installation
pip install quantcore-lite
Quick Start
Python API
import pandas as pd
from quantcore import Backtest, MomentumStrategy
# Load your OHLCV data
data = pd.read_csv("market_data.csv", index_col=0, parse_dates=True)
# Run a backtest with the Momentum strategy
bt = Backtest(data, MomentumStrategy(lookback=20))
bt.run()
print(bt.summary())
bt.export_csv("results.csv")
CLI
quantcore backtest --data market_data.csv --strategy momentum
quantcore backtest --data market_data.csv --strategy mean_reversion --output results.csv
quantcore strategies
Strategies
Momentum
Buy when the rate of change over a lookback period is positive, sell when negative.
from quantcore import Backtest, MomentumStrategy
strategy = MomentumStrategy(lookback=20)
bt = Backtest(data, strategy)
bt.run()
print(bt.summary())
Mean Reversion
Buy when price falls below its rolling mean by a threshold, sell when it reverts above.
from quantcore import Backtest, MeanReversion
strategy = MeanReversion(window=20, threshold=1.5)
bt = Backtest(data, strategy)
bt.run()
print(bt.summary())
Moving Average Crossover
Buy on golden cross (short MA crosses above long MA), sell on death cross.
from quantcore import Backtest, MovingAverageCrossover
strategy = MovingAverageCrossover(short_window=20, long_window=50)
bt = Backtest(data, strategy)
bt.run()
print(bt.summary())
Performance Metrics
Every backtest reports:
| Metric | Description |
|---|---|
| Sharpe Ratio | Risk-adjusted return (annualized) |
| Max Drawdown | Largest peak-to-trough decline |
| CAGR | Compound annual growth rate |
| Win Rate | Percentage of profitable trades |
| Total Return | Overall portfolio return |
Free vs Pro Comparison
| Feature | Free | Pro |
|---|---|---|
| Momentum strategy | ✅ | ✅ |
| Mean Reversion strategy | ✅ | ✅ |
| Moving Average Crossover strategy | ✅ | ✅ |
| Performance metrics (Sharpe, CAGR, drawdown, win rate) | ✅ | ✅ |
| CSV export | ✅ | ✅ |
| CLI interface | ✅ | ✅ |
| RSI, Bollinger Bands, MACD strategies | ❌ | ✅ |
| Pairs Trading, Volatility Breakout, Turtle Trading | ❌ | ✅ |
| Mean Reversion Z-Score, Kalman Filter, Dual Momentum, Sector Rotation | ❌ | ✅ |
| Monte Carlo simulation (1000 runs, confidence intervals) | ❌ | ✅ |
| Tearsheet PDF generator | ❌ | ✅ |
| Parameter grid search optimizer | ❌ | ✅ |
⭐ Pro Version
Unlock 10 additional strategies, Monte Carlo simulation, tearsheet PDF reports, and parameter optimization.
Set your license key:
export QUANTCORE_LICENSE_KEY="your-license-key"
Then use Pro features:
quantcore backtest --data market_data.csv --strategy rsi --tearsheet report.pdf --monte-carlo
quantcore optimize --data market_data.csv --strategy bollinger_bands
Pro features are validated via Polar.sh license keys.
License
MIT — see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quantcore_lite-0.1.0.tar.gz.
File metadata
- Download URL: quantcore_lite-0.1.0.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53e6cd25bd74a9c1bdb1091c86b7088fc910b37c9dd3970f0cb18a83b6428f3f
|
|
| MD5 |
47c0048813c856fb725610aa2b08a635
|
|
| BLAKE2b-256 |
9d0fcf1864e269dc11e5a21fb6ed4f48b5c39fe67c3e4721f1e980ee4d2f370f
|
File details
Details for the file quantcore_lite-0.1.0-py3-none-any.whl.
File metadata
- Download URL: quantcore_lite-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0d7693472a2c2bf5b79275fb4373a3f4e3a1b068274695788ff894320a6b428
|
|
| MD5 |
d9c6824f110c0384bbb268288f530ef6
|
|
| BLAKE2b-256 |
1844bf677519c653c5bd89819bd4812d8242ed717e06048d4b78ea00a6ac51eb
|