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.0.tar.gz (336.0 kB 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.0-py3-none-any.whl (50.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyquaver-0.1.0.tar.gz
Algorithm Hash digest
SHA256 19aec6c33355a0fe345196869a68f24c9791413f66e9405875bfb8c7891c3ed1
MD5 9d78c1f2d9a64d1f06b0661786c4f293
BLAKE2b-256 59b173d5bd5dcc906d11448e82ca392698bfa4725243a2af54f715a7d577e7f4

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyquaver-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 50.6 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4bb1e5b2fc676f880bfc793a20a09a3d1514ffe70d18f29ebe4762bfc4e8c893
MD5 a6dcd15308371db2518b68d3db4c8ea9
BLAKE2b-256 d91f364a2edd4366d79ca5d9dfc3b8ec2d6364306fe5fc1dcf3f9555f0f21fd6

See more details on using hashes here.

Provenance

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