Calculate portfolio risk metrics including VaR, CVaR, Sharpe

Risk metrics calculation

by wshobson · MIT license · ★ 39,857 on GitHub · updated Sep 21

Risk metrics calculation cover

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.

---
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.

## When to Use This Skill

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

Overview

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

Manual install (npx, ZIP)
Claude Codenpx skills add wshobson/agents --skill risk-metrics-calculation -g -a claude-code
Claude Code (manual)mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/wshobson/agents/tar.gz/4236bb91f839 \ | tar -xz -C ~/.claude/skills --strip-components=4 agents-4236bb91f839/plugins/quantitative-trading/skills/risk-metrics-calculation
Windows (PowerShell)New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/4dc492a428875f134483/risk-metrics-calculation.zip" -OutFile "$env:TEMP\risk-metrics-calculation.zip"; Expand-Archive "$env:TEMP\risk-metrics-calculation.zip" -DestinationPath "$HOME\.claude\skills" -Force
Claude.ai / desktopDownload the ZIP and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md2.0 KB
  • references/1 file · 16.5 KB
Read the files here
wshobson/4236bb92 files
SKILL.md
Show the full text61 lines

Risk Metrics Calculation

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

When to Use This Skill

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

Core Concepts

1. Risk Metric Categories
Category Metrics Use Case
Volatility Std Dev, Beta General risk
Tail Risk VaR, CVaR Extreme losses
Drawdown Max DD, Calmar Capital preservation
Risk-Adjusted Sharpe, Sortino Performance
2. Time Horizons
Intraday:   Minute/hourly VaR for day traders
Daily:      Standard risk reporting
Weekly:     Rebalancing decisions
Monthly:    Performance attribution
Annual:     Strategic allocation

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Best Practices

Do's
  • Use multiple metrics - No single metric captures all risk
  • Consider tail risk - VaR isn't enough, use CVaR
  • Rolling analysis - Risk changes over time
  • Stress test - Historical and hypothetical
  • Document assumptions - Distribution, lookback, etc.
Don'ts
  • Don't rely on VaR alone - Underestimates tail risk
  • Don't assume normality - Returns are fat-tailed
  • Don't ignore correlation - Increases in stress
  • Don't use short lookbacks - Miss regime changes
  • Don't forget transaction costs - Affects realized risk
1---
2name: risk-metrics-calculation
3description: 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.
4---
5 
6# Risk Metrics Calculation
7 
8Comprehensive risk measurement toolkit for portfolio management, including Value at Risk, Expected Shortfall, and drawdown analysis.
9 
10## When to Use This Skill
11 
12- Measuring portfolio risk
13- Implementing risk limits
14- Building risk dashboards
15- Calculating risk-adjusted returns
16- Setting position sizes
17- Regulatory reporting
18 
19## Core Concepts
20 
21### 1. Risk Metric Categories
22 
23| Category | Metrics | Use Case |
24| ----------------- | --------------- | -------------------- |
25| **Volatility** | Std Dev, Beta | General risk |
26| **Tail Risk** | VaR, CVaR | Extreme losses |
27| **Drawdown** | Max DD, Calmar | Capital preservation |
28| **Risk-Adjusted** | Sharpe, Sortino | Performance |
29 
30### 2. Time Horizons
31 
32```
33Intraday: Minute/hourly VaR for day traders
34Daily: Standard risk reporting
35Weekly: Rebalancing decisions
36Monthly: Performance attribution
37Annual: Strategic allocation
38```
39 
40## Detailed patterns and worked examples
41 
42Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient.
43 
44## Best Practices
45 
46### Do's
47 
48- **Use multiple metrics** - No single metric captures all risk
49- **Consider tail risk** - VaR isn't enough, use CVaR
50- **Rolling analysis** - Risk changes over time
51- **Stress test** - Historical and hypothetical
52- **Document assumptions** - Distribution, lookback, etc.
53 
54### Don'ts
55 
56- **Don't rely on VaR alone** - Underestimates tail risk
57- **Don't assume normality** - Returns are fat-tailed
58- **Don't ignore correlation** - Increases in stress
59- **Don't use short lookbacks** - Miss regime changes
60- **Don't forget transaction costs** - Affects realized risk
61 
View all files on GitHub →

Details

Updated
Sep 21, 2026
License
MIT
Stars on the repo
★ 39,857
Checked
Source
wshobson/agents ↗
Creator
wshobson · 179 listings
View creator

Similar skills

See all →
SkillDiagnose why a specific ad creative is winning or losingCreative performance analysisgmmh1/claude-paid-media-skills · by gmmh1Diagnose why a specific ad creative is winning or losing using the generalized hook-hold-click-convert funnel, applicable across any platform. Triggers on 'why is this ad underperforming', 'diagnose my creative', or 'where in the funnel is this ad failing'. Platform-agnostic diagnostic framework — platform-specific versions (meta-ads-creative-analytics) apply this with platform-native metrics.New listingPromptAct as a professional full-stack developer taskedProfessional Full-Stack Developer for Network Mapping & Monitoring Applicationf/prompts.chat · by Yohanes Farly RakinaungAct as a professional full-stack developer tasked with building a web application for mapping and monitoring networks using Mikrotik Netwatch API. Implement multi-user role-based management to handle devices, monitor their status, and manage user subscriptions.New listingSkillEstablishes a project's quality bar as a written contractConstraint driven developmentaddyosmani/agent-skills · by addyosmaniEstablishes a project's quality bar as a written contract and stops agents quietly lowering it. Interviews the user on which dimensions matter, supplies sane default thresholds when they have no number in mind, records everything in CONSTRAINTS.md, and watches the diff for a weakened bar — new @ts-ignore or eslint-disable suppressions, skipped or deleted tests, assertions stripped out, unimplemented stubs, thresholds edited down. Use when no quality bar is written down, when the user says "set up constraints" or "define our standards", when the user wants dimensions they care about — accessibility, web performance, coverage — set up as enforced constraints, when an agent keeps silencing checks or skipping tests to get to green, when you need a coverage or performance threshold and don't know what number to pick, or when an agent writes more code than anyone will read.★ 98.7k GitHub starsSkillInstruments code so production behavior is visibleObservability and instrumentationaddyosmani/agent-skills · by addyosmaniInstruments code so production behavior is visible and diagnosable. Use when adding logging, metrics, tracing, or alerting. Use when shipping any feature that runs in production and you need evidence it works. Use when production issues are reported but you can't tell what happened from the available data.★ 98.7k GitHub starsSkillOptimizes application performance across frontend, backendPerformance optimizationaddyosmani/agent-skills · by addyosmaniOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.★ 98.7k GitHub starsSkillDiscovers and invokes agent skillsUsing agent skillsaddyosmani/agent-skills · by addyosmaniDiscovers and invokes agent skills. Use when starting a session, or when you need to decide which skill or workflow applies to the piece of work at hand. This is the meta-skill that governs how all other skills are discovered and invoked.★ 98.7k GitHub stars

More from wshobson

SkillMaster C/.NET backend development patterns for buildingwshobson/agents · by wshobsonMaster C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.★ 39.9k GitHub starsSkillImplement WCAG 2.2 compliant interfaces with mobileAccessibility compliancewshobson/agents · by wshobsonImplement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.★ 39.9k GitHub starsSkillMaster Material Design 3 and Jetpack Compose patternsAndroid Mobile Designwshobson/agents · by wshobsonMaster Material Design 3 and Jetpack Compose patterns for building native Android apps. Use when designing Android interfaces, implementing Compose UI, or following Google's Material Design guidelines.★ 39.9k GitHub starsSkillMigrate from AngularJS to Angular using hybrid modeAngular migrationwshobson/agents · by wshobsonMigrate from AngularJS to Angular using hybrid mode, incremental component rewriting, and dependency injection updates. Use when upgrading AngularJS applications, planning framework migrations, or modernizing legacy Angular code.★ 39.9k GitHub starsSkillUnderstand anti-reversing, obfuscationAnti reversing techniqueswshobson/agents · by wshobsonUnderstand anti-reversing, obfuscation, and protection techniques encountered during software analysis. Use this skill when analyzing malware evasion techniques, when implementing anti-debugging protections for CTF challenges, when reverse engineering packed binaries, or when building security research tools that need to detect virtualized environments.★ 39.9k GitHub starsSkillBuild production Apache Airflow DAGs with best practicesApache Airflow DAG Patternswshobson/agents · by wshobsonBuild production Apache Airflow DAGs with best practices for operators, sensors, testing, and deployment. Use when creating data pipelines, orchestrating workflows, or scheduling batch jobs.★ 39.9k GitHub stars