Get the FREE Ultimate OpenClaw Setup Guide →

risk-assessment

npx machina-cli add skill staskh/trading_skills/risk-assessment --openclaw
Files (1)
SKILL.md
1.2 KB

Risk Assessment

Calculate risk metrics for stocks and positions.

Instructions

Note: If uv is not installed or pyproject.toml is not found, replace uv run python with python in all commands below.

uv run python scripts/risk.py SYMBOL [--period PERIOD] [--position-size SIZE]

Arguments

  • SYMBOL - Ticker symbol
  • --period - Analysis period: 1mo, 3mo, 6mo, 1y (default: 1y)
  • --position-size - Dollar amount for position-specific metrics (optional)

Output

Returns JSON with:

  • volatility - Historical volatility (annualized)
  • beta - Beta vs SPY
  • var_95 - 95% Value at Risk (daily)
  • var_99 - 99% Value at Risk (daily)
  • max_drawdown - Maximum drawdown in period
  • sharpe_ratio - Risk-adjusted return
  • position_risk - If position-size provided, dollar VaR

Explain what the risk metrics mean and suggest position sizing if relevant.

Dependencies

  • numpy
  • yfinance

Source

git clone https://github.com/staskh/trading_skills/blob/main/.claude/skills/risk-assessment/SKILL.mdView on GitHub

Overview

Risk Assessment analyzes essential metrics for stocks and positions. It reports volatility, beta versus SPY, 95% and 99% VaR, max drawdown, and Sharpe ratio, with optional dollar VaR when a position size is provided.

How This Skill Works

The tool runs a risk.py script with a SYMBOL and optional flags to compute metrics. It outputs a JSON object containing volatility, beta, var_95, var_99, max_drawdown, sharpe_ratio, and position_risk if a size is provided, using numpy and yfinance under the hood.

When to Use It

  • Assess a stock's historical volatility to gauge risk level.
  • Evaluate beta against SPY to understand market sensitivity.
  • Get daily VaR estimates (95% and 99%) for risk budgeting.
  • Estimate maximum drawdown over a selected period to plan exits.
  • Compute position_risk when comparing different dollar-sized allocations.

Quick Start

  1. Step 1: Choose SYMBOL and optional period and position-size.
  2. Step 2: Run the tool: uv run python scripts/risk.py SYMBOL [--period PERIOD] [--position-size SIZE].
  3. Step 3: Review the JSON output and interpret volatility, beta, VaR, and drawdown.

Best Practices

  • Choose a period (1mo, 3mo, 6mo, 1y) that matches your horizon.
  • Provide a realistic position-size to obtain dollar VaR.
  • Use VaR alongside volatility and Sharpe ratio for context.
  • Compare metrics to a benchmark like SPY to gauge relative risk.
  • Treat VaR as probabilistic, not a guaranteed loss.

Example Use Cases

  • Compute 1y volatility and beta for AAPL with a $50k position to inform sizing.
  • Estimate 3mo VaR and max drawdown for MSFT to assess downside risk.
  • Determine beta vs SPY for a new energy stock before adding to a portfolio.
  • Run risk assessment for a diversified tech basket to compare risk profiles.
  • Use 1y VaR and Sharpe ratio to decide allocation between two equities.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers