home / skills / sickn33 / antigravity-awesome-skills / risk-metrics-calculation

risk-metrics-calculation skill

/skills/risk-metrics-calculation

This skill helps you measure portfolio risk with VaR, CVaR, Sharpe, drawdown analysis and risk-adjusted insights for dashboards and limits.

This is most likely a fork of the risk-metrics-calculation skill from openclaw
npx playbooks add skill sickn33/antigravity-awesome-skills --skill risk-metrics-calculation

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1.1 KB
---
name: risk-metrics-calculation
description: Calculate portfolio risk metrics including VaR, CVaR, Sharpe, Sortino, and drawdown analysis. Use when measuring portfolio risk, implementing risk limits, or building risk monitoring systems.
---

# Risk Metrics Calculation

Comprehensive risk measurement toolkit for portfolio management, including Value at Risk, Expected Shortfall, and drawdown analysis.

## Use this skill when

- Measuring portfolio risk
- Implementing risk limits
- Building risk dashboards
- Calculating risk-adjusted returns
- Setting position sizes
- Regulatory reporting

## Do not use this skill when

- The task is unrelated to risk metrics calculation
- You need a different domain or tool outside this scope

## Instructions

- Clarify goals, constraints, and required inputs.
- Apply relevant best practices and validate outcomes.
- Provide actionable steps and verification.
- If detailed examples are required, open `resources/implementation-playbook.md`.

## Resources

- `resources/implementation-playbook.md` for detailed patterns and examples.

Overview

This skill calculates core portfolio risk metrics—Value at Risk (VaR), Conditional VaR (CVaR/Expected Shortfall), Sharpe and Sortino ratios, and drawdown analysis—to quantify downside exposure and risk-adjusted performance. It is implemented in Python and designed for integration into risk dashboards, limit systems, and portfolio analytics pipelines. The outputs are numeric metrics and time-series summaries ready for reporting or automated checks.

How this skill works

Given portfolio returns, positions, or simulated P&L paths, the skill computes VaR and CVaR using historical, parametric (variance-covariance), or Monte Carlo methods. It also computes Sharpe and Sortino ratios from realized returns and performs drawdown detection (peak-to-trough, max drawdown, drawdown duration). Results include point estimates, confidence intervals where applicable, and diagnostic checks for model assumptions.

When to use it

  • Measuring tail risk for daily or intraday portfolios
  • Implementing and monitoring regulatory or internal risk limits
  • Building risk dashboards or automated alerting systems
  • Sizing positions based on targeted risk budgets
  • Comparing risk-adjusted performance across strategies

Best practices

  • Validate input returns for quality: handle missing data and outliers before calculation
  • Choose VaR method to match distributional assumptions (historical vs parametric vs Monte Carlo)
  • Report both VaR and CVaR to capture tail severity, not just quantile thresholds
  • Use rolling windows and stress scenarios to track metric stability over time
  • Complement point estimates with backtests and coverage tests to validate models

Example use cases

  • Compute 1-day 99% VaR and CVaR for a multi-asset portfolio using historical returns
  • Automate daily risk limit checks and trigger alerts when VaR breaches thresholds
  • Compare Sharpe and Sortino ratios across strategies to favor downside-protected returns
  • Generate a drawdown report (max drawdown, recovery time) for monthly performance reviews
  • Run Monte Carlo P&L simulations to estimate capital requirements under stress

FAQ

Which VaR method should I use?

Use historical VaR when you trust observed return history, parametric VaR for speed when returns are near-normal, and Monte Carlo when you need scenario flexibility or non-linear exposures.

How is Sortino different from Sharpe?

Sortino uses downside deviation (negative returns) instead of total volatility, so it penalizes harmful volatility and better reflects downside risk-adjusted performance.