historical-risk

historical-risk is a skill for Claude Code from JoelLewis/finance_skills. It costs 110 tokens per session (2,107 once invoked), scanned A, original, MIT.

A guide to measuring investment risk from past market data, including price swings, peak-to-trough losses, and how long losses lasted. It also covers downside-focused measures and tracking error, which is how much an investment differs from its benchmark.

In plain words
What is it for?
Use it to calculate historical volatility, maximum drawdown, drawdown duration, historical Value at Risk, downside deviation, semi-variance, and tracking error.
Why use it?
It helps turn historical prices into consistent risk measures instead of relying on vague claims about volatility or losses.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the wealth-management plugin — 38 skills shipped together

Good fit Use it to calculate historical volatility, maximum drawdown, drawdown duration, historical Value at Risk, downside deviation, semi-variance, and tracking error.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/joellewis/finance_skills/historical-risk
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add JoelLewis/finance_skills --skill historical-risk
Clone the repo
git clone --depth 1 https://github.com/JoelLewis/finance_skills

Made for: Claude Code.

Or install wealth-management, the plugin that ships this one along with the rest of its 38 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for historical-risk

README.md
[![agentmods](https://agentmods.dev/badge/skills/joellewis/finance_skills/historical-risk/github.svg)](https://agentmods.dev/skills/joellewis/finance_skills/historical-risk)
Your own site
<a href="https://agentmods.dev/skills/joellewis/finance_skills/historical-risk"><img src="https://agentmods.dev/badge/skills/joellewis/finance_skills/historical-risk/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for historical-risk

Your own site · 80×15
<a href="https://agentmods.dev/skills/joellewis/finance_skills/historical-risk"><img src="https://agentmods.dev/badge/skills/joellewis/finance_skills/historical-risk.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 110 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,107 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 15 Sept 2026
  • Snyk pass 15 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00110 $0.02107
Opus 5.5 $0.00044 $0.00843
Sonnet 5.5 $0.00022 $0.00421
Haiku 4.5 $0.00011 $0.00211

Measured 3d ago against content hash fcf38cc8bf70, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

historical-risk scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/historical_risk.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/wealth-management/skills/historical-risk/SKILL.md · 175 lines

How it starts

The opening of the file, as written. The whole thing — 175 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Historical Risk Analysis

Core Concepts

Close-to-Close Volatility

The simplest and most common volatility estimator. Compute the standard deviation of log returns and annualize.

sigma_annual = sigma_daily * sqrt(N)

where N = number of trading periods per year (typically 252 for daily, 52 for weekly, 12 for monthly).

Log returns are preferred: r_t = ln(P_t / P_{t-1}).

Parkinson (High-Low) Estimator

Uses intraday high and low prices to capture intraday volatility that close-to-close misses. More efficient than close-to-close when the true process is continuous.

sigma^2_Park = (1 / (4 * n * ln(2))) * sum( ln(H_i / L_i)^2 )

This estimator is roughly 5x more efficient than close-to-close for a diffusion process, but is biased downward when there are jumps or when the range is discretized.

Yang-Zhang Estimator

Combines overnight (close-to-open), open-to-close, and Rogers-Satchell components. It is unbiased for processes with both drift and opening jumps.

sigma^2_YZ = sigma^2_overnight + k * sigma^2_open-to-close + (1 - k) * sigma^2_RS

where k is chosen to minimize estimator variance:

k = 0.34 / (1.34 + (n + 1) / (n - 1))

with n the number of observations, and sigma^2_RS is the Rogers-Satchell estimator that uses all four OHLC prices within each period.

Drawdown Analysis

Drawdown at time t measures the decline from the running peak:

DD_t = (Peak_t - Value_t) / Peak_t

where Peak_t = max(Value_s) for all s <= t.

  • Maximum Drawdown (MDD): MDD = max(DD_t) over the evaluation period.
  • Drawdown Duration: The number of periods from a peak until a new peak is reached.
  • Recovery Time: The number of periods from the trough back to the prior peak level.

Historical VaR

The non-parametric (empirical) Value-at-Risk is simply the alpha-percentile of the historical return distribution. No distributional assumptions are made.

VaR_alpha = -Percentile(R, alpha)

For example, 95% VaR uses the 5th percentile of returns. The negative sign is a convention so that VaR is expressed as a positive loss number.

Read the full file on GitHub · 175 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 175 lines · 110 tokens per session scan A fcf38cc8bf70

Subscribe to this mod's changes

historical-risk is a skill published in the GitHub repository JoelLewis/finance_skills (272 stars, last pushed 3d ago), licensed MIT. It adds 110 tokens to every session and 2,107 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-27.

Related

historical-risk compared with skills from other repositories

historical-risk next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
historical-riskJoelLewis/finance_skillsSkill2723d agoMITA110Claude Code
Freelance EmpireLeoYeAI/openclaw-master-skillsSkill2.2k8d agoMITA71Claude Code, Codex
agent-otc-tradeLeoYeAI/openclaw-master-skillsSkill2.2k8d agoMITA80Claude Code
agentic-streetLeoYeAI/openclaw-master-skillsSkill2.2k8d agoMITA91Claude Code, Codex
alpha-vantageforyourhealth111-pixel/Vibe-SkillsSkill3.9k21d agoApache-2.0A126Claude Code, Codex
prompt-proximity-architectureelvisun/newsjackSkill1.7k4d agoMITA67Claude Code
syndicromainsimon/paperasseSkill2.6k18d agoMITA204Claude Code