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.2.tar.gz (2.1 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.2-py3-none-any.whl (68.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyquaver-0.1.2.tar.gz
  • Upload date:
  • Size: 2.1 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.2.tar.gz
Algorithm Hash digest
SHA256 1ca8957c6be1dad4afa907b243ebac72703ad691f6ef4d7cecb460a8d077e801
MD5 95e77ac7a718b2db73219a7dfac045ea
BLAKE2b-256 ead8a90c35fb286c74ad517dd254c1bb45d8fa9749a9a25dc4da8ecfa9cc889c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquaver-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: pyquaver-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 68.1 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c1e17216e8a733273e9c44dc312578bd6d35993f2e9be87f8e766919bebefe6b
MD5 a7e79c2ff91597495318938796086d01
BLAKE2b-256 060b64beaa3ded6dc361c571af0149e76ce4290a8e3c6b2a3ee12664d814cfdb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquaver-0.1.2-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