risk-metrics-calculation

Calculate portfolio risk metrics like VaR, CVaR, and drawdowns using Python.

Updated Dec 23, 2025
One-click install
npx skills add https://github.com/drgaciw/academic-compliance-hub-glm --skill risk-metrics-calculation-drgaciw
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: risk-metrics-calculation
Source: https://github.com/drgaciw/academic-compliance-hub-glm/tree/main/agents/plugins/quantitative-trading/skills/risk-metrics-calculation
Command: npx skills add https://github.com/drgaciw/academic-compliance-hub-glm --skill risk-metrics-calculation-drgaciw

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a comprehensive toolkit for calculating and analyzing various portfolio risk metrics, enabling users to understand and manage financial risk effectively.

Core Features & Use Cases

  • Risk Metric Calculation: Computes metrics like VaR, CVaR, Sharpe Ratio, Sortino Ratio, and drawdown analysis.
  • Portfolio Risk Analysis: Assesses risk at the portfolio level, including marginal risk contribution and diversification.
  • Stress Testing: Simulates historical and hypothetical crisis scenarios to evaluate portfolio resilience.
  • Use Case: A portfolio manager needs to assess the downside risk of their portfolio during a market downturn. This Skill can calculate the Value at Risk (VaR) and Conditional Value at Risk (CVaR) for a specified confidence level.

Quick Start

Calculate the 95% historical Value at Risk for the provided daily returns series.

Frequently Asked Questions about risk-metrics-calculation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I calculate Value at Risk and Conditional VaR for a portfolio?

To calculate portfolio risk metrics like Value at Risk (VaR) and Conditional VaR (CVaR), you provide a daily returns series and specify a confidence level. The Skill computes these metrics using Python libraries like NumPy, Pandas, and SciPy for statistical analysis.

Can I run stress testing on historical crisis scenarios for my portfolio?

Yes, you can run stress testing on your portfolio by simulating both historical and hypothetical crisis scenarios. This evaluates your portfolio's resilience and downside risk during market downturns using the provided returns data.

What is the difference between Sharpe Ratio and Sortino Ratio in portfolio risk analysis?

In portfolio risk analysis, the Sharpe Ratio measures risk-adjusted return using total volatility, while the Sortino Ratio isolates downside volatility. This Skill calculates both metrics, alongside drawdown analysis, to assess performance.

How do I assess marginal risk contribution and diversification at the portfolio level?

You assess portfolio-level risk by analyzing the marginal risk contribution of individual assets and overall diversification. The Skill evaluates risk at both the individual asset and aggregated portfolio levels to quantify exposure.

Do I need Python libraries like NumPy and Pandas to compute rolling window volatility?

Yes, computing rolling window volatility and other financial metrics relies on Python libraries including NumPy, Pandas, and SciPy. These dependencies handle the statistical computations required for accurate risk assessment.