Standalone PyPI library for quantitative trading signal generation and backtesting
Project description
quaver
Standalone Python library for quantitative trading signal generation and walk-forward backtesting.
Installation
pip install pyquaver
With optional extras:
# Interactive notebooks with yfinance data
pip install pyquaver[notebooks]
# Development tools (pytest, ruff, mypy)
pip install pyquaver[dev]
# Sphinx documentation
pip install pyquaver[docs]
Quick Start
Single-asset backtest
import pandas as pd
from quaver.backtest import run_backtest
# Load your OHLCV data (must have columns: ts, open, high, low, close, volume)
candles = pd.read_csv("data.csv")
result = run_backtest(
engine_name="mean_reversion",
parameters={"fast_period": 20, "slow_period": 50, "threshold": 0.02},
candles=candles,
instrument_id="AAPL",
initial_capital=10_000.0,
)
print(result.summary())
Multi-asset pairs backtest
from quaver.backtest import run_multi_asset_backtest
results = run_multi_asset_backtest(
engine_name="pairs_mean_reversion",
parameters={
"instrument_a": "AAPL",
"instrument_b": "MSFT",
"spread_window": 60,
"entry_z": 2.0,
"exit_z": 0.5,
},
candles_map={"AAPL": candles_aapl, "MSFT": candles_msft},
initial_capital=10_000.0,
allow_shorting=True,
)
for iid, r in results.items():
print(f"{iid}: {r.summary()}")
Discover strategies
from quaver.strategies.registry import StrategyRegistry
import quaver.strategies # auto-registers all built-in engines
print(StrategyRegistry.list_engines())
# ['mean_reversion', 'pairs_mean_reversion', 'regime_mean_reversion', 'vsa_stopping_volume']
Built-in Strategies
| Strategy | Type | Description |
|---|---|---|
mean_reversion |
single | Dual moving-average mean reversion |
regime_mean_reversion |
single | Regime-based probabilistic mean reversion |
vsa_stopping_volume |
single | VSA stopping-volume reversal pattern |
pairs_mean_reversion |
multi | Statistical arbitrage pairs trading |
Requirements
- Python >= 3.12
- numpy >= 2.4.2
- pandas >= 3.0.1
License
MIT
Project details
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 pyquaver-0.1.3.tar.gz.
File metadata
- Download URL: pyquaver-0.1.3.tar.gz
- Upload date:
- Size: 2.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8da570e0cf28169ad47f2be5e7cb0affdf3a6caba8065b01d2d4d1c4cadbe69b
|
|
| MD5 |
8add17b27d99cf14b1ba34a8f2a6ea6b
|
|
| BLAKE2b-256 |
adbff17d1101f0b314508718bc737c852515476a1c4c60a6f42b3a2c392287a2
|
Provenance
The following attestation bundles were made for pyquaver-0.1.3.tar.gz:
Publisher:
publish.yml on maczg/quaver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyquaver-0.1.3.tar.gz -
Subject digest:
8da570e0cf28169ad47f2be5e7cb0affdf3a6caba8065b01d2d4d1c4cadbe69b - Sigstore transparency entry: 1411346656
- Sigstore integration time:
-
Permalink:
maczg/quaver@2d372e87d463e278ec0dd8bb0abe736f7afa969c -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/maczg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2d372e87d463e278ec0dd8bb0abe736f7afa969c -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyquaver-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pyquaver-0.1.3-py3-none-any.whl
- Upload date:
- Size: 71.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccf64df8d03b9b5bf28fd872eb358ce0d297b05d69c16f8ef650c2482df4fa35
|
|
| MD5 |
ffea86b8dde849077bafb387899dec84
|
|
| BLAKE2b-256 |
ff8a4763535236a46e90138b34aea0231dc8c4e19b9343a9f6a13ab88383a20a
|
Provenance
The following attestation bundles were made for pyquaver-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on maczg/quaver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyquaver-0.1.3-py3-none-any.whl -
Subject digest:
ccf64df8d03b9b5bf28fd872eb358ce0d297b05d69c16f8ef650c2482df4fa35 - Sigstore transparency entry: 1411346805
- Sigstore integration time:
-
Permalink:
maczg/quaver@2d372e87d463e278ec0dd8bb0abe736f7afa969c -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/maczg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2d372e87d463e278ec0dd8bb0abe736f7afa969c -
Trigger Event:
push
-
Statement type: