Tutorials

End-to-end guides that show how wraquant’s modules work together for real quantitative finance workflows. Each tutorial walks through a complete pipeline with runnable code and interpretation of results.

These tutorials assume you have wraquant installed with the relevant extras. See Getting Started for installation instructions.

Risk Analysis

Compute risk-adjusted performance metrics (Sharpe, Sortino, Treynor), estimate VaR and CVaR with multiple methods, stress test against historical crises (GFC, COVID), decompose portfolio risk with Euler decomposition, and generate a risk report.

Modules used: risk, vol, data, viz

Risk Analysis
Regime-Based Investing

Detect bull/bear market regimes with a Gaussian HMM, analyze per-regime statistics (mean, volatility, Sharpe), build a regime-conditional portfolio that adjusts allocation by regime probability, and backtest against buy-and-hold.

Modules used: regimes, opt, backtest, risk

Regime-Based Investing
Volatility Modeling

Fit GARCH, EGARCH, and GJR-GARCH models to daily returns. Compare models with BIC-based selection. Compute news impact curves to visualize asymmetric volatility response. Forecast volatility 10 days ahead and run rolling GARCH for out-of-sample evaluation.

Modules used: vol, risk, viz

Volatility Modeling
Portfolio Construction

Optimize portfolios with Mean-Variance (max Sharpe), risk parity, and Black-Litterman. Decompose risk contributions per asset. Adjust allocations for market regimes using regime-aware optimization. Compare portfolio strategies on a backtest.

Modules used: opt, risk, regimes, backtest

Portfolio Construction
Backtesting Strategies

Define a moving average crossover strategy, backtest with the event-driven engine, analyze performance with 15+ metrics, generate a full tearsheet, and run walk-forward validation to evaluate out-of-sample robustness.

Modules used: backtest, ta, risk, viz

Backtesting Strategies
ML Alpha Research

Engineer features from 263 TA indicators, label returns with triple-barrier labeling, train a gradient boosted model with purged K-fold cross-validation, walk-forward validate, evaluate with financial metrics (Sharpe, profit factor), and track experiments.

Modules used: ml, ta, backtest, risk, experiment

ML Alpha Research