Heurist Logo
Back to Skill Marketplace
tradermonty

macro-regime-detector

VerifiedMacroaccess level:low

Detect structural macro regime transitions (1-2 year horizon) using cross-asset ratio analysis. Analyze RSP/SPY concentration, yield curve, credit conditions, size factor, equity-bond relationship, and sector rotation to identify regime shifts between Concentration, Broadening, Contraction, Inflationary, and Transitional states. Run when user asks about macro regime, market regime change, structural rotation, or long-term market positioning.

Install

npx @heurist-network/skills add macro-regime-detector

Installs

12

Stars

283

Timeline

Updated Mar 8, 2026

Created Mar 7, 2026

Verification

Reviewed and verified

SHA256: 00166b8ff2dcc7cc...

Approved Mar 7, 2026 by admin

Access Level

low

Required Permissions

Requires API Keys

External APIs

Financial Modeling Prep

Files (27)

SKILL.md

references/historical_regimes.md

references/indicator_interpretation_guide.md

references/regime_detection_methodology.md

scripts/calculators/__init__.py

scripts/calculators/concentration_calculator.py

scripts/calculators/credit_conditions_calculator.py

scripts/calculators/equity_bond_calculator.py

scripts/calculators/sector_rotation_calculator.py

scripts/calculators/size_factor_calculator.py

scripts/calculators/utils.py

scripts/calculators/yield_curve_calculator.py

scripts/fmp_client.py

scripts/macro_regime_detector.py

scripts/report_generator.py

scripts/scorer.py

scripts/tests/conftest.py

scripts/tests/test_concentration.py

scripts/tests/test_credit_conditions.py

scripts/tests/test_equity_bond.py

scripts/tests/test_helpers.py

scripts/tests/test_report_generator.py

scripts/tests/test_scorer.py

scripts/tests/test_sector_rotation.py

scripts/tests/test_size_factor.py

scripts/tests/test_utils.py

scripts/tests/test_yield_curve.py

Summary

SKILL.md

Macro Regime Detector

Detect structural macro regime transitions using monthly-frequency cross-asset ratio analysis. This skill identifies 1-2 year regime shifts that inform strategic portfolio positioning.

When to Use

  • User asks about current macro regime or regime transitions
  • User wants to understand structural market rotations (concentration vs broadening)
  • User asks about long-term positioning based on yield curve, credit, or cross-asset signals
  • User references RSP/SPY ratio, IWM/SPY, HYG/LQD, or other cross-asset ratios
  • User wants to assess whether a regime change is underway

Workflow

  1. Load reference documents for methodology context:

    • references/regime_detection_methodology.md
    • references/indicator_interpretation_guide.md
  2. Execute the main analysis script:

    python3 skills/macro-regime-detector/scripts/macro_regime_detector.py
    

    This fetches 600 days of data for 9 ETFs + Treasury rates (10 API calls total).

  3. Read the generated Markdown report and present findings to user.

  4. Provide additional context using references/historical_regimes.md when user asks about historical parallels.

Prerequisites

  • FMP API Key (required): Set FMP_API_KEY environment variable or pass --api-key
  • Free tier (250 calls/day) is sufficient (script uses ~10 calls)

6 Components

#ComponentRatio/DataWeightWhat It Detects
1Market ConcentrationRSP/SPY25%Mega-cap concentration vs market broadening
2Yield Curve10Y-2Y spread20%Interest rate cycle transitions
3Credit ConditionsHYG/LQD15%Credit cycle risk appetite
4Size FactorIWM/SPY15%Small vs large cap rotation
5Equity-BondSPY/TLT + correlation15%Stock-bond relationship regime
6Sector RotationXLY/XLP10%Cyclical vs defensive appetite

5 Regime Classifications

  • Concentration: Mega-cap leadership, narrow market
  • Broadening: Expanding participation, small-cap/value rotation
  • Contraction: Credit tightening, defensive rotation, risk-off
  • Inflationary: Positive stock-bond correlation, traditional hedging fails
  • Transitional: Multiple signals but unclear pattern

Output

  • macro_regime_YYYY-MM-DD_HHMMSS.json — Structured data for programmatic use
  • macro_regime_YYYY-MM-DD_HHMMSS.md — Human-readable report with:
    1. Current Regime Assessment
    2. Transition Signal Dashboard
    3. Component Details
    4. Regime Classification Evidence
    5. Portfolio Posture Recommendations

Relationship to Other Skills

AspectMacro Regime DetectorMarket Top DetectorMarket Breadth Analyzer
Time Horizon1-2 years (structural)2-8 weeks (tactical)Current snapshot
Data GranularityMonthly (6M/12M SMA)Daily (25 business days)Daily CSV
Detection TargetRegime transitions10-20% correctionsBreadth health score
API Calls~10~330 (Free CSV)

Script Arguments

python3 macro_regime_detector.py [options]

Options:
  --api-key KEY       FMP API key (default: $FMP_API_KEY)
  --output-dir DIR    Output directory (default: current directory)
  --days N            Days of history to fetch (default: 600)