← ClaudeAtlas

downtrend-duration-analyzerlisted

Analyze historical downtrend durations and generate interactive HTML histograms showing typical correction lengths by sector and market cap.
Serennity007/claude-trading-skills · ★ 0 · AI & Automation · score 70
Install: claude install-skill Serennity007/claude-trading-skills
# Downtrend Duration Analyzer ## Overview Analyze historical price data to identify downtrend periods (peak-to-trough) and build statistical distributions of correction durations. Generate interactive HTML visualizations with histograms segmented by sector and market cap to help traders understand typical recovery timeframes and set realistic expectations for mean reversion strategies. ## When to Use - Trader asks about typical correction lengths for a sector or market cap tier - User wants to understand historical drawdown recovery times - Building mean reversion or pullback strategies that need realistic holding period estimates - Comparing correction behavior across different market segments - Setting stop-loss timeouts or position holding period limits ## Prerequisites - Python 3.9+ - FMP API key (set `FMP_API_KEY` environment variable or use `--api-key`) - Required packages: `requests`, `pandas`, `numpy` (standard data analysis stack) ## Workflow ### Step 1: Fetch Historical Price Data Run the analysis script to fetch OHLC data for a universe of stocks and identify downtrend periods. ```bash python3 skills/downtrend-duration-analyzer/scripts/analyze_downtrends.py \ --sector "Technology" \ --lookback-years 5 \ --output-dir reports/ ``` ### Step 2: Analyze Downtrend Durations The script automatically: 1. Identifies local peaks and troughs using rolling window analysis 2. Calculates duration (trading days) and depth (% decline) for each downtrend 3. Segmen