Skip to main content

Decision-Risk & Robustness Simulator

Project description

RiskLabs

Decision-Risk & Robustness Simulator

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

  1. Define Strategy: You specify target allocations (static weights for MVP).
  2. Fetch Data: The library automatically downloads historical data for the tickers using yfinance.
  3. Simulate Scenarios: The engine runs multiple simulations:
    • Historical Baseline: Standard backtest.
    • Crash Replay: Applies historical shock factors.
    • Regime Stress: Modifies volatility and correlation matrices.
  4. Score & Report: Aggregates results into a "Robustness Score" and renders an HTML dashboard.

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

risklabs-0.1.1.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

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

risklabs-0.1.1-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file risklabs-0.1.1.tar.gz.

File metadata

  • Download URL: risklabs-0.1.1.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for risklabs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 268be327f6b4d4bd330d5280624dbc45abe55d9d6f39ee4d96948ff4ba4f6bcf
MD5 9ee843487e5ac0251dfad7671ce534cd
BLAKE2b-256 1231d2ec2902de28d2407973a34b8132e3d2a94cdf2d1c1b8fb642d1a025dafe

See more details on using hashes here.

File details

Details for the file risklabs-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: risklabs-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for risklabs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f15a14bdaf69301784602afa86c6e164d2af8718225b538405ae9bedd8021da6
MD5 14a7c9079888a68b29e8b94089d48dc1
BLAKE2b-256 ca42e3345d4e0beb9d2110368401dab0dea8bd3d4d423134a9a5c896176d90ed

See more details on using hashes here.

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