003-skills/.claude/skills/nixtla-market-risk-analyzer/SKILL.md
Analyze market risk with VaR, volatility, and position sizing using forecast data. Use when assessing investment risk. Trigger with 'analyze market risk' or 'calculate VaR'.
npx skillsauth add intent-solutions-io/plugins-nixtla nixtla-market-risk-analyzerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Calculates key market risk metrics and recommends optimal position sizes using historical data analysis.
This skill analyzes market risk using historical price data to calculate Value at Risk (VaR), volatility metrics, maximum drawdown, Sharpe ratios, and optimal position sizing. Provides actionable insights for managing investment risk and optimizing portfolio allocation. Uses four specialized Python scripts for data preparation, risk analysis, position sizing, and report generation.
Tools: Read, Write, Bash, Glob, Grep
Environment: Optional NIXTLA_TIMEGPT_API_KEY for volatility forecasting (not required for core analysis)
Packages:
pip install pandas numpy scipy matplotlib
# Optional for forecasting:
pip install nixtla
Input Data Format: CSV file with columns:
ds, date, or timestampy, price, or closeExecute the data preparation script to load prices and calculate returns:
python {baseDir}/scripts/prepare_data.py prices.csv --method log --output returns.csv
Script: {baseDir}/scripts/prepare_data.py
returns.csvRun comprehensive risk analysis on the price data:
python {baseDir}/scripts/risk_metrics.py prices.csv --output risk_metrics.json --risk-free-rate 0.05
Script: {baseDir}/scripts/risk_metrics.py
risk_metrics.jsonKey Metrics:
Determine optimal position sizes using multiple methodologies:
python {baseDir}/scripts/position_sizing.py \
--account-size 100000 \
--risk-per-trade 0.02 \
--stop-loss 0.05 \
--target-volatility 0.15 \
--asset-volatility 0.25 \
--var-95 -0.02 \
--max-var-loss 0.03 \
--output position_sizing.json
Script: {baseDir}/scripts/position_sizing.py
position_sizing.json with recommended conservative positionCreate comprehensive markdown report with visualizations:
python {baseDir}/scripts/generate_report.py prices.csv \
--risk-metrics risk_metrics.json \
--position-sizing position_sizing.json \
--output risk_report.md \
--output-dir .
Script: {baseDir}/scripts/generate_report.py
drawdown.png: Price history and drawdown chartvolatility.png: Rolling volatility over timevar.png: Return distribution with VaR levelsrisk_report.md, PNG chartsGenerated Files:
returns.csv: Calculated returns seriesrisk_metrics.json: Complete risk metricsposition_sizing.json: Position sizing recommendationsrisk_report.md: Comprehensive markdown reportdrawdown.png: Price and drawdown visualizationvolatility.png: Rolling volatility chartvar.png: Return distribution with VaR markersKey Report Sections:
Error: No date column found
Solution: Ensure CSV has column named ds, date, or timestamp
Error: No price column found
Solution: Ensure CSV has column named y, price, or close
Error: Insufficient data for analysis
Solution: Provide at least 30 price points for reliable statistical analysis
Error: Module not found: matplotlib
Solution: Install visualization dependencies: pip install matplotlib
Error: NIXTLA_TIMEGPT_API_KEY not set
Solution: Only needed for optional volatility forecasting. Core analysis works without it.
# Complete workflow for stock analysis
python {baseDir}/scripts/prepare_data.py AAPL_prices.csv
python {baseDir}/scripts/risk_metrics.py AAPL_prices.csv
python {baseDir}/scripts/position_sizing.py --account-size 100000 --asset-volatility 0.28
python {baseDir}/scripts/generate_report.py AAPL_prices.csv
# Expected output:
# VaR (95%): -2.15%
# Max Drawdown: -35.2%
# Sharpe Ratio: 0.95
# Recommended Position: $45,000 (45% of account)
# High volatility asset with conservative sizing
python {baseDir}/scripts/risk_metrics.py contract_prices.csv --output contract_risk.json
python {baseDir}/scripts/position_sizing.py \
--account-size 50000 \
--risk-per-trade 0.01 \
--asset-volatility 0.45 \
--output contract_sizing.json
# Expected output:
# VaR (95%): -8.5%
# Volatility Regime: HIGH
# Recommended Position: $12,000 (24% of account)
# Conservative parameters for volatile market
python {baseDir}/scripts/position_sizing.py \
--account-size 200000 \
--risk-per-trade 0.01 \
--stop-loss 0.03 \
--target-volatility 0.10 \
--max-var-loss 0.02
# Aggressive parameters for stable market
python {baseDir}/scripts/position_sizing.py \
--account-size 200000 \
--risk-per-trade 0.03 \
--stop-loss 0.07 \
--target-volatility 0.20 \
--max-var-loss 0.05
Statistical Methods:
Position Sizing Theory:
Best Practices:
References:
testing
This skill enables Claude to manage isolated test environments using Docker Compose, Testcontainers, and environment variables. It is used to create consistent, reproducible testing environments for software projects. Claude should use this skill when the user needs to set up a test environment with specific configurations, manage Docker Compose files for test infrastructure, set up programmatic container management with Testcontainers, manage environment variables for tests, or ensure cleanup after tests. Trigger terms include "test environment", "docker compose", "testcontainers", "environment variables", "isolated environment", "env-setup", and "test setup".
tools
This skill uses the test-doubles-generator plugin to automatically create mocks, stubs, spies, and fakes for unit testing. It analyzes dependencies in the code and generates appropriate test doubles based on the chosen testing framework, such as Jest, Sinon, or others. Use this skill when you need to generate test doubles, mocks, stubs, spies, or fakes to isolate units of code during testing. Trigger this skill by requesting test double generation or using the `/gen-doubles` or `/gd` command.
tools
This skill enables Claude to generate realistic test data for software development. It uses the test-data-generator plugin to create users, products, orders, and custom schemas for comprehensive testing. Use this skill when you need to populate databases, simulate user behavior, or create fixtures for automated tests. Trigger phrases include "generate test data", "create fake users", "populate database", "generate product data", "create test orders", or "generate data based on schema". This skill is especially useful for populating testing environments or creating sample data for demonstrations.
development
This skill analyzes code coverage metrics to identify untested code and generate comprehensive coverage reports. It is triggered when the user requests analysis of code coverage, identification of coverage gaps, or generation of coverage reports. The skill is best used to improve code quality by ensuring adequate test coverage and identifying areas for improvement. Use trigger terms like "analyze coverage", "code coverage report", "untested code", or the shortcut "cov".