Skip to main content

The ultimate quant finance toolkit for Python

Project description

wraquant

Tests Coverage Docs PyPI Python License

The ultimate quantitative finance toolkit for Python.

1,000+ functions | 3,200+ tests | 24 modules | 265 TA indicators

Features

  • Risk Management -- VaR/CVaR, GARCH-VaR, beta estimation, factor risk, portfolio analytics, tail risk, stress testing, copulas, credit risk
  • Regime Detection -- Gaussian HMM, Markov-switching, Kalman filter/smoother/UKF, regime scoring, labels, regime-aware portfolios
  • Volatility Modeling -- Full GARCH family (EGARCH, GJR, FIGARCH, HARCH, APARCH), Hawkes processes, stochastic vol, realized vol estimators
  • Technical Analysis -- 265 indicators across 19 modules (momentum, overlap, volume, trend, volatility, patterns, cycles, Fibonacci, support/resistance, exotic, and more)
  • Machine Learning -- LSTM/GRU/Transformer (PyTorch), sklearn pipelines, walk-forward validation, SHAP importance, online regression
  • Derivatives Pricing -- Black-Scholes, FBSDE solvers, characteristic function pricing (Heston, VG, NIG, CGMY), SABR, rough Bergomi, CIR, Vasicek
  • Portfolio Optimization -- Mean-variance, risk parity, Black-Litterman, HRP, convex/linear/nonlinear optimization
  • Backtesting -- Vectorized engine, 15+ performance metrics, walk-forward optimization, comprehensive tearsheets, regime-conditional sizing
  • Time Series -- Auto-forecasting, SSA/EMD decomposition, ARIMA diagnostics, stochastic processes (OU, jump-diffusion), anomaly detection
  • Statistics -- Robust stats, advanced distributions, distance correlation, copula selection, factor analysis, cointegration
  • Econometrics -- Panel data, IV/2SLS, VAR/VECM, event studies, structural breaks
  • Causal Inference -- Granger causality, IV with diagnostics, event studies, synthetic control, causal forests, mediation, RDD
  • Bayesian -- Conjugate regression, stochastic vol MCMC, HMC, model comparison (WAIC/LOO), changepoint detection
  • Visualization -- Interactive Plotly dashboards (portfolio, regime, risk, technical), 3D vol surfaces, correlation networks
  • And more -- Forex, microstructure, execution algorithms, Levy processes, network analysis, parallel computing

Quick Start

pip install wraquant
# Or with optional groups:
pip install wraquant[market-data,viz,risk,ml]
import wraquant as wq

# Quick comprehensive analysis
report = wq.analyze(returns)

# Detect market regimes
regimes = wq.detect_regimes(returns, method="hmm", n_regimes=2)

# GARCH volatility forecasting
from wraquant.vol import garch_fit, garch_forecast
model = garch_fit(returns, p=1, q=1, dist="t")
forecast = garch_forecast(returns, horizon=10)

# Portfolio optimization with regime awareness
from wraquant.recipes import portfolio_construction_pipeline
portfolio = portfolio_construction_pipeline(returns_df, regime_aware=True)

# 265 technical indicators
from wraquant.ta import rsi, macd, bollinger_bands
signals = rsi(prices, period=14)

Module Overview

Module Functions Description
risk 95 Risk management, VaR, beta, factor models, stress testing
stats 79 Statistical analysis, robust stats, distributions, correlation
ta 265 Technical analysis indicators (19 sub-modules)
math 55 Levy processes, networks, optimal stopping
ts 51 Time series forecasting, decomposition, anomaly detection
price 50 Derivatives pricing, FBSDEs, stochastic models
viz 46 Plotly dashboards and interactive charts
ml 43 Machine learning, deep learning, pipelines
regimes 38 Regime detection, scoring, Kalman filters
backtest 37 Backtesting engine, metrics, tearsheets
vol 28 GARCH family, Hawkes, stochastic volatility
bayes 28 Bayesian inference, MCMC, model comparison

Interactive Dashboard

wraquant includes an optional Streamlit dashboard for interactive analysis:

pip install wraquant[dashboard]
from wraquant.dashboard import launch
launch()
# Or: python -m wraquant.dashboard

The dashboard provides six pages:

  • Experiment Browser -- Browse and compare experiment results from the Lab API
  • Strategy Analysis -- Upload returns CSV for comprehensive analysis (metrics, risk, regimes, distribution)
  • Risk Monitor -- VaR/CVaR, rolling volatility, GARCH VaR, stress testing
  • Regime Viewer -- Interactive regime detection (HMM/GMM/changepoint) with overlay plots
  • Portfolio Optimizer -- Multi-asset optimization (MVO, risk parity) with risk decomposition
  • TA Screener -- Apply 265 technical indicators to OHLCV data with interactive charts

Documentation

Full API documentation: wraquant.readthedocs.io

Development

pdm install -G dev
pdm run test          # Run tests
pdm run test-cov      # Tests with coverage
pdm run lint          # Lint with trunk
pdm run fmt           # Format
pdm run changelog     # Generate changelog
pdm run docs          # Build docs

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

wraquant-0.1.0.tar.gz (984.3 kB view details)

Uploaded Source

Built Distribution

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

wraquant-0.1.0-py3-none-any.whl (892.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for wraquant-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c3f53d0b21be89fe6d9273ad28a82105b482588177e4d8ff1ccb2b5c2e7996d9
MD5 c0c04ac96b88c983c55d2a7241e3983a
BLAKE2b-256 f8456fdffc69d992940be4858d433077e88c42dc06c566667afde4bf1de0eb4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for wraquant-0.1.0.tar.gz:

Publisher: publish.yml on pr1m8/wraquant

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

File details

Details for the file wraquant-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for wraquant-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f07dc98d6a05ee063b60fa75f63daa625f377f2eb9229e5f2d7df8225de532e
MD5 c118e5abc4cd3b0d7c471cb6385f5bb3
BLAKE2b-256 9eb192bd4451428b48b5009d5199ac6d893ea7014e5fdd2820847423014ae1ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for wraquant-0.1.0-py3-none-any.whl:

Publisher: publish.yml on pr1m8/wraquant

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