Skip to content
SkillScript-led1,511 tokens in use

Downtrend Duration Analyzer

Measures how long peak-to-trough downtrends lasted in FMP price history, grouped by sector and market cap tier, and builds an interactive HTML histogram.

7,426 stars on the repository MIT Licensetradermonty/claude-trading-skills · skills/downtrend-duration-analyzer

Skill label

measured from its files

What installing Downtrend Duration Analyzer costs

28tokens idle
1,511tokens in use
2,909tokens, up to

Idle is what sits in context while the skill is installed. In use is its instructions, loaded when it runs. Up to adds the files its instructions link. Counts are approximate, made offline with cl100k_base.

Model dependence Script-led

Script-ledMixedModel-led

Most of this skill is scripts, so it behaves much the same whichever model runs it.

This describes the skill's structure, how much of it is scripts. It does not say how well it works. Scripts: scripts/analyze_downtrends.py, scripts/downtrend_fmp_client.py, scripts/fmp_client.py, scripts/generate_histogram_html.py.

Touches

shelldetectednetworkdetectedwrites filesdetectedcredentialsdetected

Declared tags come from the skill's frontmatter; detected ones from its scripts, its code blocks and the commands it names in inline code. This is detected, not audited.

How it scores

Quality

How well the skill is written, counted from its own files: its frontmatter, its steps, examples, stated output and constraints, its size and whether every file it ships is one it names.How we score it →
Good
  • Frontmatter8/15
  • Structure23/25
  • Examples9/15
  • Output10/15
  • Size15/15
  • Resources7/15

Security

Starts at 100 and loses points for each thing in the skill's files that a reader should look at first.How we score it →
Good
  • Runs shell commands−5

    does this on the machine, and the frontmatter does not say so

    SKILL.md, line 42
  • Reads credentials−15

    does this on the machine, and the frontmatter does not say so

    scripts/analyze_downtrends.py, line 50
  • Writes files−8

    does this on the machine, and the frontmatter does not say so

    scripts/analyze_downtrends.py, line 398
  • Reaches the network−10

    does this on the machine, and the frontmatter does not say so

    scripts/fmp_client.py, line 32

Repository health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
Good
  • Development activity100
  • Maintenance52
  • Community68
  • Maturity36
  • Momentum40

Downtrend Duration Analyzer looks at historical daily prices for a set of US stocks, finds local peaks and troughs with a rolling window, and records the length in trading days and the depth in percent of each decline. It then summarizes the distributions by sector and by market cap tier (Mega, Large, Mid and Small) with median, mean and percentile statistics.

A second script turns the JSON results into an interactive HTML page with a duration histogram, sector and market cap filters and a summary table. The output describes past corrections and is not investment advice.

What You Get

  • A JSON report with every detected downtrend: symbol, sector, tier, peak and trough dates, duration and depth
  • A Markdown report with summary statistics and tables by market cap tier
  • An interactive HTML histogram with sector and market cap filters, percentile markers and tooltips
  • A methodology reference covering peak and trough detection and tier definitions

Common Use Cases

  • Estimating how long a typical pullback lasts in a sector
  • Comparing correction length between large caps and small caps
  • Choosing a holding period limit for a mean reversion idea
  • Checking the spread of outcomes with percentiles and not only the average

What Makes It Unique

The output is a distribution and not a single average: it reports the 25th, 75th and 90th percentiles beside the median and mean, split by sector and market cap tier. The results come with an interactive HTML page. The FMP client uses only the stable company-screener and historical price endpoints, skips malformed history and never fills in missing prices.

Under The Hood

The agent runs two Python scripts. The first calls the Financial Modeling Prep API over the network with the user’s API key (from the FMP_API_KEY environment variable or a command line option), pacing requests and retrying once on a rate limit, and writes JSON and Markdown files to an output folder (reports/ by default). The second reads the JSON and writes an HTML file; when that page is opened in a browser it loads the Plotly.js charting library from a public CDN. Both scripts create files on disk. The skill asks for the requests, pandas and numpy packages.

Join founders building with open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on SubstackJoin 750+ subscribers