Decision-Risk & Robustness Simulator by Eiffel Labs
Project description
RiskLabs
Decision-Risk & Robustness Simulator by Eiffel Labs
RiskLabs is a Python library designed to help quantitative researchers and portfolio managers evaluate the robustness of their strategies. It goes beyond simple backtesting by subjecting strategies to various "flight path" scenarios, such as historical crashes, volatility spikes, and correlation breakdowns.
Features
- Scenario Analysis: Simulate strategies under stress conditions (e.g., 2008 Crash, COVID-19 Volatility).
- Robustness Metrics: Calculate specialized scores based on performance stability across regimes.
- Regime Detection: Analyze strategy behavior in Bull vs. Bear markets.
- HTML Reporting: Generate beautiful, standalone HTML dashboards with interactive charts.
- Privacy-First: Runs entirely locally. No data leaves your machine.
Installation
pip install risklabs
Quick Start
from risklabs.client import create_strategy, analyze
# 1. Define a Strategy
strategy = create_strategy(
name="My 60/40 Portfolio",
allocations=[
{"ticker": "SPY", "weight": 0.6},
{"ticker": "AGG", "weight": 0.4}
]
)
# 2. Run Robustness Analysis
print("Running simulations...")
report = analyze(strategy)
# 3. Generate Report
report.to_file("my_portfolio_report.html")
print("Report generated: my_portfolio_report.html")
How It Works
- Define Strategy: You specify target allocations (static weights for MVP).
- Fetch Data: The library automatically downloads historical data for the tickers using
yfinance. - Simulate Scenarios: The engine runs multiple simulations:
- Historical Baseline: Standard backtest.
- Crash Replay: Applies historical shock factors.
- Regime Stress: Modifies volatility and correlation matrices.
- Score & Report: Aggregates results into a "Robustness Score" and renders an HTML dashboard.
Architecture & Methodology
RiskLabs is designed as a modular pipeline to ensure rigorous stress testing:
- Client Layer (
risklabs.client):- The entry point for users. Accepts a concise human-readable Strategy definition and orchestrates the analysis.
- Simulation Engine (
risklabs.engine):- The core "brain" of the system. It doesn't just run a single backtest; it executes a battery of tests including Historical Replays (e.g., 2008 Crisis), Monte Carlo Perturbations (Fragility), and Parameter Sweeps (Sensitivity).
- Analyzers:
RegimeDetectionEngine: Classifies market history into 4 regimes (Bull/Bear x High/Low Vol).FragilityAnalyzer: Tests "what if my weights were slightly different?" to catch overfitting.DecisionEngine: Aggregates all metrics into a final Confidence Rating and Recommendation (APPROVE/REJECT).
- Reporting (
risklabs.reporting):- Compiles the rich data into an interactive, standalone HTML dashboard with no external dependencies.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file risklabs-0.2.1.tar.gz.
File metadata
- Download URL: risklabs-0.2.1.tar.gz
- Upload date:
- Size: 44.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2842d8aeb8cc7665e6a798274b10f2a1e19bec2bf8f04eb6124fa1c2b08ed8b3
|
|
| MD5 |
4bf312a7e89ef0482c6914d91fe4a95c
|
|
| BLAKE2b-256 |
15a6bc7b09fad6bcd6e174b4b388ab165906a1fa8b61ef88e2799f931317c846
|
File details
Details for the file risklabs-0.2.1-py3-none-any.whl.
File metadata
- Download URL: risklabs-0.2.1-py3-none-any.whl
- Upload date:
- Size: 23.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fc5a154b9b3407f5cc6ad1d1a7636b4aab83d396971701216366a90720c10dd
|
|
| MD5 |
89a4c91e1944634fe2e7b1c5727c66a7
|
|
| BLAKE2b-256 |
f837e9da9c053cb3d6ea658d95f905d32931c265d1cd7d75a10cb489b0f61a3a
|