Skip to main content

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

pyquaver-0.1.1.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyquaver-0.1.1-py3-none-any.whl (60.7 kB view details)

Uploaded Python 3

File details

Details for the file pyquaver-0.1.1.tar.gz.

File metadata

  • Download URL: pyquaver-0.1.1.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyquaver-0.1.1.tar.gz
Algorithm Hash digest
SHA256 282a50810bec74632a13a966a445842d342354a3b1c97853445dd1af53eb30a0
MD5 f03bd542f53e65fe7b4884ceb7b784de
BLAKE2b-256 8fa49eb8093e13de1e81c39c23fb62a75bd373a35284d0bf05193e0d88615794

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquaver-0.1.1.tar.gz:

Publisher: publish.yml on maczg/quaver

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyquaver-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyquaver-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 60.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyquaver-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1f7fb4cf9eef7d3dd1b3313d019a88cb4f28ff9b323f08c70457809b36772b1c
MD5 6740c0c4e891c0891f717b18909e0adc
BLAKE2b-256 fb76e945df2523c771dfcd76dbd3cd2be8b4b9c15fbc4484f24a42dcd6007710

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquaver-0.1.1-py3-none-any.whl:

Publisher: publish.yml on maczg/quaver

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page