Claude Skill

us-gov-shutdown-tracker

Track and analyze US government shutdown liquidity impacts by monitoring TGA (Treasury General Account), bank reserves, EFFR, and SOFR data from FRED API. Use when user wants to (1) analyze current or past government shutdown effects on financial markets, (2) track liquidity cond

LLM Mart · 0 points · 11 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download mann1988-awesome-claude-skills-us-gov-shutdown-tracker-6d04730.zip · 1946 KB
Part of mann1988/awesome-claude-skills — 3 skills

Install

skills CLI npx skills add https://github.com/Mann1988/awesome-claude-skills/tree/main/us-gov-shutdown-tracker
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install mann1988-awesome-claude-skills@llmmart
Git git clone https://github.com/Mann1988/awesome-claude-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole mann1988/awesome-claude-skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

US Government Shutdown Liquidity Tracker

Onboarding Guidance

When this skill is first used or when the user seems unsure how to use it or ask you to make something amazing with it, guide them to ask Claude this specific question:

"美国政府停摆结束了吗? 对流动性的影响如何?"

Do NOT suggest other questions or broad explorations. Keep the focus tightly on shutdown status and liquidity impact assessment. The skill is designed for this precise use case.

Overview

This skill analyzes how US government shutdowns create "stealth tightening" effects in money markets through the Treasury General Account (TGA) mechanism. When federal spending stops but tax revenues continue, TGA accumulates and mechanically drains bank reserves, potentially raising market funding costs beyond the Federal Reserve's policy intent.

When to Use This Skill

  • User asks to track liquidity during a government shutdown
  • User wants to assess whether shutdown effects are "easing" or "tightening"
  • User mentions TGA, SOFR premium, or "stealth tightening" (变相加息)
  • User requests comparison with historical shutdown episodes (2013, 2018-19)
  • User wants a quick liquidity health check

Optimal timing: Wednesday evenings or Thursday mornings (after weekly TGA/reserves data release)

Quick Start

Basic Usage (Current Shutdown Analysis)

python scripts/analyze_shutdown.py --output results.json
python scripts/visualize.py results.json --output chart.png

This analyzes the 2025 shutdown (Oct 1 - present) with default settings.

Custom Date Range

python scripts/analyze_shutdown.py \
  --start-date 2018-12-22 \
  --baseline-date 2018-12-15 \
  --end-date 2019-01-25 \
  --output results_2018.json

Output Format

The analysis produces:

  1. JSON data file containing:

    • Raw daily data (EFFR, SOFR)
    • Weekly data (TGA, reserves)
    • Key time points (baseline, shutdown start, TGA peak, latest)
    • Liquidity status assessment (EASING/TIGHTENING/STABLE/MIXED)
  2. Visualization chart (PNG) with three panels:

    • TGA vs Bank Reserves (dual-axis weekly data)
    • EFFR vs SOFR (daily rates)
    • SOFR Premium over EFFR (liquidity stress indicator)
  3. Structured conclusion:

    • Current status (e.g., "EASING")
    • Explanation (e.g., "TGA releasing, reserves recovering")
    • Key metrics vs baseline and peak

Core Analysis Logic

The Transmission Mechanism

Government Shutdown
    ↓
Federal spending stops (but revenues continue)
    ↓
TGA accumulates at Federal Reserve
    ↓
Bank reserves drain (mechanical Fed balance sheet effect)
    ↓
Liquidity scarcity → SOFR premium expands
    ↓
"Stealth tightening" (市场实际融资成本 > Fed政策意图)

Status Determination

The script classifies liquidity conditions into four states:

EASING (压力缓解):

  • TGA falling >$10B from peak
  • Reserves rising >$10B from trough
  • Indicates: Shutdown ending or fiscal spending resumed

TIGHTENING (压力加剧):

  • TGA rising >5% from baseline
  • Reserves falling >2% from baseline
  • Indicates: Shutdown's stealth tightening effect persists

STABLE (相对稳定):

  • TGA/reserves changing <$20B from peak
  • Indicates: Liquidity conditions steady

MIXED (复杂信号):

  • Conflicting signals require continued monitoring

Key Metrics

SOFR Premium = SOFR - EFFR (in basis points)

Interpretation guide:

  • 0-5 bps: Normal conditions
  • 5-15 bps: Moderate stress
  • 15-30 bps: Significant stealth tightening
  • >30 bps: Acute crisis (may trigger Fed intervention)

Historical Context

For detailed historical analysis, see references/historical_cases.md.

Summary:

Shutdown Reserve Environment Peak SOFR Premium Stealth Tightening?
2013 QE (~$2.3T) ~0 bps ❌ No
2018-19 QT (~$1.6T) 75 bps ✅ Yes
2025 Post-QT (~$2.8T) 36 bps (post-cut) ✅ Acute

Critical insight: The transmission efficiency depends on reserve abundance. In QE environments with ample reserves, shutdowns don't affect markets. In QT or high-rate environments with scarce reserves, shutdowns create measurable tightening.

Data Sources

All data sourced from Federal Reserve Economic Data (FRED) API:

  • TGA (WTREGEN): Treasury General Account balance, weekly
  • Bank Reserves (WRESBAL): Total reserves, weekly
  • EFFR (EFFR): Effective Federal Funds Rate, daily
  • SOFR (SOFR): Secured Overnight Financing Rate, daily

For technical details on data series, update schedules, and interpretation, see references/data_sources.md.

Important: TGA and reserves update weekly on Wednesdays. For most current analysis, run this skill on Wednesday evenings or Thursday mornings.

Workflow for User Requests

Scenario 1: "What's the latest on the shutdown liquidity situation?"

  1. Run analyze_shutdown.py with defaults (2025-10-01 start)
  2. Generate visualization
  3. Present:
    • Current status (EASING/TIGHTENING/etc.)
    • Latest metrics (TGA, reserves, SOFR premium)
    • Brief comparison to peak stress point
    • Conclusion statement

Scenario 2: "Compare this to the 2018 shutdown"

  1. Run analysis for both periods:
    • 2025: Oct 1 - present
    • 2018-19: Dec 22, 2018 - Jan 25, 2019
  2. Generate both charts
  3. Present side-by-side comparison:
    • TGA accumulation magnitude
    • Peak SOFR premium
    • Fed intervention (if any)
    • Monetary environment context
  4. Reference historical_cases.md for detailed context

Scenario 3: "Is the situation getting better or worse?"

  1. Run analysis
  2. Focus on:
    • Trend from TGA peak to latest (is TGA releasing?)
    • Reserves recovery from trough
    • SOFR premium vs baseline
  3. Present trend assessment with clear directional language
  4. Optionally show week-over-week changes

Output Presentation Best Practices

  1. Lead with conclusion: State status (EASING/TIGHTENING) upfront
  2. Show key metrics concisely:
    TGA: $941B (-$17B from peak)
    Reserves: $2,863B (+$15B from trough)
    SOFR Premium: 4 bps (vs 19 bps peak)
    
  3. Visualize: Always include chart for complex cases
  4. Contextualize: Reference historical episodes when relevant
  5. Avoid jargon overload: Explain "stealth tightening" simply if user seems unfamiliar

Advanced Usage

Custom Baseline

When analyzing a specific episode, set an appropriate pre-shutdown baseline:

python scripts/analyze_shutdown.py \
  --start-date 2025-10-01 \
  --baseline-date 2025-09-24 \
  --end-date 2025-11-07

The baseline should be ~1 week before shutdown starts (to capture "normal" conditions).

Monitoring Routine

For ongoing tracking:

  1. Weekly check (Wednesdays/Thursdays):

    • Run analysis
    • Note status changes
    • Update user if significant shift
  2. Event-triggered checks:

    • Shutdown announcement → Start tracking
    • SOFR premium spikes (>15 bps) → Generate alert
    • Fed intervention (SRF usage) → Document
    • Shutdown resolution → Final analysis

Limitations and Caveats

  1. Weekly data frequency: TGA/reserves only update weekly, limiting real-time precision
  2. Month/quarter-end effects: SOFR naturally spikes at period-ends (unrelated to shutdowns)
  3. Other liquidity factors: QT, regulatory changes, seasonal patterns also affect reserves
  4. Attribution challenge: Hard to isolate shutdown effect from concurrent events
  5. No predictive power: This skill describes current conditions, doesn't forecast

Troubleshooting

No recent data?

  • Check if today is before next Wednesday data release
  • Most recent weekly data is typically ~1 week lagged

SOFR premium calculation fails?

  • Verify both EFFR and SOFR have data for the date range
  • SOFR introduced April 2018; unavailable before

Chart rendering issues?

  • Ensure matplotlib is installed
  • Check date range has sufficient data points (need >2 weekly observations)

References

See bundled documentation:

  • references/historical_cases.md - Detailed analysis of 2013, 2018-19, 2025 shutdowns
  • references/data_sources.md - FRED API technical reference

External resources:

Files (awesome-claude-skills)
  • references
    • awesome-skills-claude-3.3.zip 570.7 KB · in bundle
    • data_sources.md 4.7 KB
      # FRED API Data Sources
      
      ## Overview
      
      The Federal Reserve Economic Data (FRED) API provides reliable economic time series data. This skill uses four key series to track government shutdown liquidity impacts.
      
      ## Series Configuration
      
      | Indicator | Series ID | Frequency | Description |
      |-----------|-----------|-----------|-------------|
      | **TGA** | WTREGEN | Weekly (Wed) | Treasury General Account balance at Federal Reserve |
      | **Bank Reserves** | WRESBAL | Weekly (Wed) | Total bank reserves held at Federal Reserve |
      | **EFFR** | EFFR | Daily | Effective Federal Funds Rate (Fed's policy rate proxy) |
      | **SOFR** | SOFR | Daily | Secured Overnight Financing Rate (actual market funding cost) |
      
      ## API Access
      
      **Endpoint**: `https://api.stlouisfed.org/fred/series/observations`
      
      **Required Parameters**:
      - `series_id`: One of the series codes above
      - `api_key`: Authentication key
      - `file_type`: `json` (recommended) or `csv`
      - `observation_start`: Start date (YYYY-MM-DD)
      - `observation_end`: End date (YYYY-MM-DD)
      
      **Example Request**:
      ```
      https://api.stlouisfed.org/fred/series/observations?series_id=WTREGEN&api_key=YOUR_KEY&file_type=json&observation_start=2025-10-01&observation_end=2025-11-07
      ```
      
      ## Data Update Schedule
      
      - **Weekly data (TGA, Reserves)**: Published every Wednesday after market close
        - Reflects data as of previous Wednesday
        - Best time to run analysis: **Wednesday evenings or Thursday mornings**
        
      - **Daily data (EFFR, SOFR)**: Published next business day
        - SOFR: Published ~8:00 AM ET by NY Fed
        - EFFR: Published ~9:00 AM ET by NY Fed
      
      ## Key Interpretation Notes
      
      ### TGA (Treasury General Account)
      
      The government's "checking account" at the Fed. 
      
      - **Rising TGA during shutdown** → Revenue inflow continues while spending stops
      - **Falling TGA after shutdown** → Fiscal spending resumes, funds return to economy
      - **Mechanical relationship**: TGA ↑ implies Bank Reserves ↓ (and vice versa)
      
      ### Bank Reserves
      
      Total reserves commercial banks hold at the Federal Reserve.
      
      - **Ample reserves** (QE era): >$2.5T → TGA shocks absorbed, no market impact
      - **Scarce reserves** (QT era): <$2T → TGA shocks transmit to funding rates
      - **Current critical zone**: ~$2.8T → High sensitivity to TGA fluctuations
      
      ### EFFR (Effective Federal Funds Rate)
      
      Volume-weighted median rate on overnight fed funds transactions.
      
      - Fed's primary policy rate target (currently set via IORB - Interest on Reserve Balances)
      - In well-functioning markets: EFFR ≈ IORB (Fed's control rate)
      - **EFFR stability** indicates Fed retains policy control
      
      ### SOFR (Secured Overnight Financing Rate)
      
      Rate on overnight Treasury repo transactions (collateralized lending).
      
      - Broader market indicator (~$1T daily volume)
      - More sensitive to liquidity conditions than EFFR
      - **SOFR > EFFR** (positive premium) indicates funding market stress
      
      ### SOFR Premium
      
      **Definition**: `SOFR - EFFR` (measured in basis points)
      
      **Interpretation**:
      - **0-5 bps**: Normal market conditions
      - **5-15 bps**: Moderate liquidity stress
      - **15-30 bps**: Significant stress (stealth tightening effect)
      - **>30 bps**: Acute crisis (requires Fed intervention)
      
      **Historical context**:
      - 2013 shutdown: ~0 bps (no effect)
      - 2018-19 shutdown: Up to 75 bps (significant tightening)
      - 2025 shutdown: Up to 36 bps post-rate-cut (acute stress requiring SRF)
      
      ## Data Quirks and Limitations
      
      1. **Weekly data gaps**: TGA and Reserves only update weekly, making daily tracking impossible
      2. **Holiday effects**: EFFR/SOFR not published on Fed holidays or weekends
      3. **Month/quarter-end spikes**: SOFR often spikes at period-ends due to balance sheet constraints (separate from shutdown effects)
      4. **Revision policy**: Data rarely revised, but check FRED for any updates
      5. **SRF not in FRED**: Standing Repo Facility usage must be checked separately on NY Fed website
      
      ## Additional Context Data (Not Currently Used)
      
      Potentially useful for deeper analysis:
      
      - **IORB** (IORB): Interest rate on reserve balances (Fed's control rate)
      - **ON RRP** (RRPONTSYD): Overnight Reverse Repo volume
      - **10Y Treasury** (DGS10): For term spread analysis
      - **Debt subject to limit** (GFDEBTN): For debt ceiling context
      
      ## Rate Limits
      
      - FRED API: Generally very permissive
      - No formal rate limit documented
      - Recommended: <100 requests per minute to be safe
      - Current skill usage: 4 series × 1 request = 4 requests per run (well within limits)
      
      ## Error Handling
      
      Common API errors:
      - `400 Bad Request`: Check date format (must be YYYY-MM-DD)
      - `404 Not Found`: Invalid series_id
      - `500 Internal Server Error`: FRED service issue, retry after delay
      
      ## References
      
      - FRED API Documentation: https://fred.stlouisfed.org/docs/api/fred/
      - Series catalog: https://fred.stlouisfed.org/
      - NY Fed SOFR page: https://www.newyorkfed.org/markets/reference-rates/sofr
      
    • historical_cases.md 6.3 KB
      # Historical Government Shutdown Cases
      
      This document provides reference data for past government shutdowns to contextualize current liquidity analysis.
      
      ## Overview of "Stealth Tightening" Hypothesis
      
      Government shutdowns can create a **"stealth tightening"** effect (变相加息) through the following mechanism:
      
      1. **Shutdown begins** → Federal spending restricted
      2. **TGA accumulates** → Tax revenues continue but expenditures halt
      3. **Bank reserves drain** → TGA accumulation mechanically withdraws reserves from banking system
      4. **Funding costs rise** → SOFR premium over EFFR expands as liquidity becomes scarce
      5. **Effective tightening** → Market experiences de facto interest rate increase beyond Fed's policy intent
      
      **Critical moderating factor**: The transmission efficiency depends heavily on the monetary policy framework and existing reserve levels.
      
      ## Case 1: 2013 Shutdown (October 1-17, 2013)
      
      ### Macro Context: QE Era - Ample Reserves Buffer
      
      - **Duration**: 16 days
      - **Monetary environment**: Peak Quantitative Easing (QE3)
      - **Bank reserves**: ~$2.3 trillion (extremely ample)
      - **Policy rate**: Near-zero (EFFR ~0.08%)
      
      ### Data Summary
      
      | Date | TGA ($B) | Reserves ($B) | EFFR (%) | SOFR (%) | Premium (bps) |
      |------|----------|---------------|----------|----------|---------------|
      | 09/30 (Pre-shutdown) | 44.99 | 2278.60 | 0.06 | N/A | N/A |
      | 10/16 (End) | 35.30 | 2370.94 | 0.11 | N/A | N/A |
      
      ### Key Finding
      
      **NO stealth tightening effect observed.**
      
      - TGA remained extremely low (~$35B) throughout shutdown
      - EFFR stable at 0.07-0.11%
      - Massive reserve buffer (~$2.3T) absorbed any minor TGA fluctuations
      - Market functioned normally with no liquidity stress
      
      **Conclusion**: In ultra-ample reserve regimes, fiscal frictions do not transmit to money markets.
      
      ---
      
      ## Case 2: 2018-2019 Shutdown (December 22, 2018 - January 25, 2019)
      
      ### Macro Context: Early QT - Reserve Scarcity Emerging
      
      - **Duration**: 35 days (longest in US history at the time)
      - **Monetary environment**: Active Quantitative Tightening (QT)
      - **Bank reserves**: Declining from ~$1.7T to ~$1.6T
      - **Policy rate**: 2.25-2.50% target range
      
      ### Data Summary
      
      | Date | TGA ($B) | Reserves ($B) | EFFR (%) | SOFR (%) | Premium (bps) |
      |------|----------|---------------|----------|----------|---------------|
      | 12/19 (Pre-shutdown) | 350.71 | 1699.14 | 2.20 | 2.30 | 10 |
      | 12/26 (Early) | 374.09 | 1661.22 | 2.40 | 2.44 | 4 |
      | 12/31 (Year-end) | N/A | N/A | 2.40 | **3.00** | **60** |
      | 01/02 (Peak stress) | 379.90 | 1621.86 | 2.40 | **3.15** | **75** |
      | 01/23 (Near end) | 389.63 | 1621.88 | 2.40 | 2.40 | 0 |
      
      ### Key Finding
      
      **Clear stealth tightening effect observed.**
      
      - TGA accumulated **+$40B** during shutdown
      - Reserves drained to **$1.62T** (multi-year low)
      - **SOFR spiked to 3.15%** on January 2, 2019
        - 75 bps premium over EFFR
        - Market funding costs far exceeded Fed's policy intent
      - Year-end timing amplified stress (seasonal liquidity demand)
      
      **Conclusion**: In QT environment with declining reserves, TGA accumulation directly transmitted to money market stress, validating the stealth tightening hypothesis.
      
      ---
      
      ## Case 3: 2025 Shutdown (October 1, 2025 - Ongoing)
      
      ### Macro Context: High Rates + Late QT - Acute Sensitivity
      
      - **Duration**: Ongoing (as of November 2025)
      - **Monetary environment**: Post-QT, high policy rates (~4%)
      - **Bank reserves**: ~$2.8T (four-year low)
      - **Policy rate**: 4%+ (IORB)
      
      ### Data Summary (Key Dates)
      
      | Date | TGA ($B) | Reserves ($B) | EFFR (%) | SOFR (%) | Premium (bps) | Fed Action |
      |------|----------|---------------|----------|----------|---------------|------------|
      | 09/24 (Baseline) | 804.86 | 3002.22 | 4.09 | 4.13 | 4 | None |
      | 10/01 (Start) | 805.14 | 2966.09 | 4.09 | 4.20 | 11 | None |
      | 10/15 (Stress peak) | 809.59 | 3019.03 | 4.10 | 4.29 | **19** | None |
      | 10/29 (TGA peak) | **957.99** | **2848.02** | 4.12 | 4.27 | 15 | None |
      | 10/30 (Post-cut) | N/A | N/A | 3.87 | 4.04 | 17 | **Rate cut -25bps** |
      | 10/31 (Crisis) | N/A | N/A | 3.86 | 4.22 | **36** | **SRF $29.4B** |
      | 11/05 (Latest) | 940.98 | 2862.57 | 3.87 | 3.91 | 4 | None |
      
      ### Key Finding
      
      **Acute stealth tightening observed, followed by reversal.**
      
      **Phase 1: Tightening (Oct 1-29)**
      - TGA surged **+$153B** (+19%)
      - Reserves fell to **$2.85T** (four-year low, -5.1%)
      - SOFR premium peaked at **19 bps** (Oct 15)
      
      **Phase 2: Peak Crisis (Oct 29-31)**
      - Fed cut rates **25 bps** on Oct 29
      - Despite rate cut, SOFR jumped to **4.22%** on Oct 31
        - **36 bps premium** over new 3.9% IORB
        - Highest premium since March 2020
      - Fed forced to inject **$29.4B via Standing Repo Facility (SRF)**
      
      **Phase 3: Easing (Nov 1-5)**
      - TGA releasing: **-$17B from peak** (-1.8%)
      - Reserves recovering: **+$14.5B from trough**
      - SOFR premium normalized: **4 bps** (back to pre-shutdown level)
      - **Status**: Liquidity stress significantly easing
      
      **Conclusion**: 
      1. High policy rates + low reserves = maximum transmission efficiency
      2. Fiscal friction directly impaired Fed's rate control (forced SRF intervention)
      3. TGA release creating "invisible QE" effect as shutdown ends
      4. Validates stealth tightening hypothesis with quantifiable impact
      
      ---
      
      ## Cross-Cycle Comparison
      
      | Metric | 2013 (QE) | 2018-19 (QT) | 2025 (High Rates) |
      |--------|-----------|--------------|-------------------|
      | **Reserve environment** | Ample (2.3T) | Declining (1.6T) | Tight (2.8T) |
      | **Policy rate** | Near-zero | 2.25-2.50% | 4%+ |
      | **TGA accumulation** | Minimal | Moderate (+40B) | Large (+153B) |
      | **Peak SOFR premium** | ~0 bps | 75 bps | 36 bps (post-cut) |
      | **Fed intervention** | None | None | SRF $29.4B |
      | **Stealth tightening** | ❌ No effect | ✅ Significant | ✅ Acute crisis |
      
      ## Key Takeaways
      
      1. **Monetary framework matters most**: Reserve abundance determines whether fiscal shocks transmit to markets
      2. **QT amplifies fiscal risks**: Low reserves make TGA fluctuations systemically important
      3. **Policy rate height irrelevant to transmission**: High rates don't prevent stealth tightening; reserve scarcity is the critical factor
      4. **2025 = Most severe case**: Forced Fed intervention proves fiscal dominance over monetary policy control
      5. **Predictive value**: When reserves fall below "sufficient" threshold (~$2.5-3T?), government shutdowns create acute financial stability risks
      
      ## References
      
      See main PDF report for detailed citations and methodology.
      
  • scripts
    • analyze_shutdown.py 7 KB
      #!/usr/bin/env python3
      """
      US Government Shutdown Liquidity Analysis Script
      
      Fetches TGA, Bank Reserves, EFFR, and SOFR data from FRED API
      and analyzes the liquidity impact of government shutdowns.
      """
      
      import requests
      import pandas as pd
      import json
      import sys
      from datetime import datetime, timedelta
      
      # FRED API Configuration
      API_KEY = "b36495528d4933449ac821a9fa35852d"
      BASE_URL = "https://api.stlouisfed.org/fred/series/observations"
      
      SERIES_CONFIG = {
          'TGA': 'WTREGEN',
          'Bank_Reserves': 'WRESBAL',
          'EFFR': 'EFFR', 
          'SOFR': 'SOFR'
      }
      
      def fetch_fred_data(series_id, start_date, end_date):
          """Fetch data from FRED API"""
          url = f"{BASE_URL}?series_id={series_id}&api_key={API_KEY}&file_type=json&observation_start={start_date}&observation_end={end_date}"
          
          try:
              response = requests.get(url, timeout=15)
              response.raise_for_status()
              data = response.json()
              
              if 'observations' in data:
                  df = pd.DataFrame(data['observations'])
                  df['date'] = pd.to_datetime(df['date'])
                  df['value'] = pd.to_numeric(df['value'], errors='coerce')
                  return df[['date', 'value']].dropna()
              return None
          except Exception as e:
              print(f"Error fetching {series_id}: {str(e)}", file=sys.stderr)
              return None
      
      def analyze_shutdown(start_date=None, baseline_date=None, end_date=None):
          """
          Main analysis function
          
          Args:
              start_date: Shutdown start date (YYYY-MM-DD), defaults to 2025-10-01
              baseline_date: Baseline comparison date (YYYY-MM-DD), defaults to one week before start
              end_date: Analysis end date (YYYY-MM-DD), defaults to today
          """
          # Set defaults
          if start_date is None:
              start_date = "2025-10-01"
          if end_date is None:
              end_date = datetime.now().strftime("%Y-%m-%d")
          if baseline_date is None:
              baseline_dt = datetime.strptime(start_date, "%Y-%m-%d") - timedelta(days=7)
              baseline_date = baseline_dt.strftime("%Y-%m-%d")
          
          # Fetch data starting from baseline
          print(f"Fetching data from {baseline_date} to {end_date}...\n")
          
          all_data = {}
          for name, series_id in SERIES_CONFIG.items():
              df = fetch_fred_data(series_id, baseline_date, end_date)
              if df is not None:
                  all_data[name] = df
                  print(f"✓ {name}: {len(df)} observations")
              else:
                  print(f"✗ {name}: Failed to fetch")
          
          if not all_data:
              print("\nError: No data retrieved")
              return None
          
          # Merge data
          merged = None
          for name, df in all_data.items():
              df_renamed = df.rename(columns={'value': name})
              if merged is None:
                  merged = df_renamed
              else:
                  merged = pd.merge(merged, df_renamed, on='date', how='outer')
          
          merged = merged.sort_values('date').reset_index(drop=True)
          
          # Calculate SOFR Premium
          merged['SOFR_Premium_bps'] = (merged['SOFR'] - merged['EFFR']) * 100
          
          # Filter weekly data (TGA/Reserves published on Wednesdays)
          weekly_data = merged[merged['TGA'].notna() & merged['Bank_Reserves'].notna()].copy()
          
          # Find key points
          baseline_dt = pd.to_datetime(baseline_date)
          shutdown_dt = pd.to_datetime(start_date)
          
          baseline_row = weekly_data[weekly_data['date'] <= baseline_dt].iloc[-1] if len(weekly_data[weekly_data['date'] <= baseline_dt]) > 0 else None
          first_shutdown = weekly_data[weekly_data['date'] >= shutdown_dt].iloc[0] if len(weekly_data[weekly_data['date'] >= shutdown_dt]) > 0 else None
          peak_tga = weekly_data.loc[weekly_data['TGA'].idxmax()]
          latest = weekly_data.iloc[-1]
          
          # Build result
          result = {
              'raw_data': merged.to_dict('records'),
              'weekly_data': weekly_data.to_dict('records'),
              'key_points': {
                  'baseline': baseline_row.to_dict() if baseline_row is not None else None,
                  'shutdown_start': first_shutdown.to_dict() if first_shutdown is not None else None,
                  'tga_peak': peak_tga.to_dict(),
                  'latest': latest.to_dict()
              },
              'analysis': analyze_liquidity_status(baseline_row, peak_tga, latest)
          }
          
          return result
      
      def analyze_liquidity_status(baseline, peak, latest):
          """Determine liquidity stress status"""
          if baseline is None or peak is None or latest is None:
              return {"status": "INSUFFICIENT_DATA", "conclusion": "Not enough data for analysis"}
          
          # Changes vs baseline
          tga_change_pct = ((latest['TGA'] - baseline['TGA']) / baseline['TGA']) * 100
          reserves_change_pct = ((latest['Bank_Reserves'] - baseline['Bank_Reserves']) / baseline['Bank_Reserves']) * 100
          premium_change = latest['SOFR_Premium_bps'] - baseline['SOFR_Premium_bps']
          
          # Changes vs peak
          tga_from_peak = latest['TGA'] - peak['TGA']
          reserves_from_peak = latest['Bank_Reserves'] - peak['Bank_Reserves']
          
          # Determine status
          if tga_from_peak < -10 and reserves_from_peak > 10:
              status = "EASING"
              conclusion = "Liquidity stress significantly easing. TGA releasing funds, reserves recovering. Shutdown likely ended or fiscal spending resumed."
          elif abs(tga_from_peak) < 20 and abs(reserves_from_peak) < 20:
              status = "STABLE"
              conclusion = "Liquidity conditions relatively stable. TGA and reserves showing minimal change."
          elif tga_change_pct > 5 and reserves_change_pct < -2:
              status = "TIGHTENING"
              conclusion = "Liquidity stress intensifying. TGA accumulating, reserves declining. Shutdown's 'stealth tightening' effect persists."
          else:
              status = "MIXED"
              conclusion = "Mixed liquidity signals. Requires continued monitoring."
          
          return {
              "status": status,
              "conclusion": conclusion,
              "metrics": {
                  "tga_vs_baseline_pct": round(tga_change_pct, 2),
                  "reserves_vs_baseline_pct": round(reserves_change_pct, 2),
                  "premium_vs_baseline_bps": round(premium_change, 1),
                  "tga_from_peak_bn": round(tga_from_peak, 2),
                  "reserves_from_peak_bn": round(reserves_from_peak, 2)
              }
          }
      
      if __name__ == "__main__":
          import argparse
          
          parser = argparse.ArgumentParser(description='Analyze US Government Shutdown Liquidity Impact')
          parser.add_argument('--start-date', help='Shutdown start date (YYYY-MM-DD)', default=None)
          parser.add_argument('--baseline-date', help='Baseline comparison date (YYYY-MM-DD)', default=None)
          parser.add_argument('--end-date', help='Analysis end date (YYYY-MM-DD)', default=None)
          parser.add_argument('--output', help='Output JSON file path', default=None)
          
          args = parser.parse_args()
          
          result = analyze_shutdown(args.start_date, args.baseline_date, args.end_date)
          
          if result:
              if args.output:
                  with open(args.output, 'w') as f:
                      json.dump(result, f, indent=2, default=str)
                  print(f"\n✓ Results saved to {args.output}")
              else:
                  print("\n" + "="*80)
                  print("ANALYSIS SUMMARY")
                  print("="*80)
                  print(json.dumps(result['analysis'], indent=2, default=str))
      
    • visualize.py 5.5 KB
      #!/usr/bin/env python3
      """
      Generate visualization charts for government shutdown liquidity analysis
      """
      
      import pandas as pd
      import matplotlib.pyplot as plt
      import matplotlib.dates as mdates
      import json
      import sys
      from datetime import datetime
      
      def create_charts(data_json, output_path, shutdown_date="2025-10-01"):
          """
          Create visualization charts from analysis data
          
          Args:
              data_json: Analysis result JSON (from analyze_shutdown.py)
              output_path: Path to save the chart image
              shutdown_date: Official shutdown start date for annotations
          """
          
          # Load data
          if isinstance(data_json, str):
              with open(data_json, 'r') as f:
                  data = json.load(f)
          else:
              data = data_json
          
          # Convert to DataFrame
          df = pd.DataFrame(data['raw_data'])
          df['date'] = pd.to_datetime(df['date'])
          
          weekly_df = pd.DataFrame(data['weekly_data'])
          weekly_df['date'] = pd.to_datetime(weekly_df['date'])
          
          # Get key dates
          tga_peak_date = pd.to_datetime(data['key_points']['tga_peak']['date'])
          shutdown_dt = pd.to_datetime(shutdown_date)
          
          # Create figure
          fig, axes = plt.subplots(3, 1, figsize=(14, 10))
          fig.suptitle('US Government Shutdown - Liquidity Impact Analysis', 
                       fontsize=16, fontweight='bold')
          
          # Chart 1: TGA vs Bank Reserves
          ax1 = axes[0]
          ax1.plot(weekly_df['date'], weekly_df['TGA'], 'o-', 
                   color='#d62728', linewidth=2, markersize=8, label='TGA Balance')
          ax1_twin = ax1.twinx()
          ax1_twin.plot(weekly_df['date'], weekly_df['Bank_Reserves'], 's-', 
                        color='#1f77b4', linewidth=2, markersize=8, label='Bank Reserves')
          
          # Add event markers
          ax1.axvline(shutdown_dt, color='orange', linestyle='--', 
                      linewidth=2, alpha=0.7, label='Shutdown Begins')
          ax1.axvline(tga_peak_date, color='red', linestyle='--', 
                      linewidth=2, alpha=0.7, label='TGA Peak')
          
          ax1.set_ylabel('TGA ($Billions)', fontsize=11, color='#d62728', fontweight='bold')
          ax1_twin.set_ylabel('Bank Reserves ($Billions)', fontsize=11, color='#1f77b4', fontweight='bold')
          ax1.tick_params(axis='y', labelcolor='#d62728')
          ax1_twin.tick_params(axis='y', labelcolor='#1f77b4')
          ax1.grid(True, alpha=0.3)
          ax1.set_title('Treasury General Account vs Bank Reserves', 
                        fontsize=12, fontweight='bold', pad=10)
          
          lines1, labels1 = ax1.get_legend_handles_labels()
          lines2, labels2 = ax1_twin.get_legend_handles_labels()
          ax1.legend(lines1 + lines2, labels1 + labels2, loc='upper left', fontsize=9)
          
          # Chart 2: EFFR and SOFR
          ax2 = axes[1]
          ax2.plot(df['date'], df['EFFR'], '-', color='#2ca02c', 
                   linewidth=2, label='EFFR (Fed Funds Effective Rate)', alpha=0.8)
          ax2.plot(df['date'], df['SOFR'], '-', color='#ff7f0e', 
                   linewidth=2, label='SOFR (Secured Overnight Financing Rate)', alpha=0.8)
          
          ax2.axvline(shutdown_dt, color='orange', linestyle='--', linewidth=2, alpha=0.7)
          ax2.axvline(tga_peak_date, color='red', linestyle='--', linewidth=2, alpha=0.7)
          
          # Check for rate cuts
          baseline_effr = df[df['date'] < shutdown_dt]['EFFR'].iloc[-1] if len(df[df['date'] < shutdown_dt]) > 0 else None
          latest_effr = df['EFFR'].iloc[-1]
          if baseline_effr and latest_effr < baseline_effr - 0.2:
              rate_cut_date = df[df['EFFR'] < baseline_effr - 0.1]['date'].iloc[0]
              ax2.axvline(rate_cut_date, color='green', linestyle='--', 
                          linewidth=2, alpha=0.7, label='Fed Rate Cut')
          
          ax2.set_ylabel('Rate (%)', fontsize=11, fontweight='bold')
          ax2.grid(True, alpha=0.3)
          ax2.legend(loc='upper right', fontsize=9)
          ax2.set_title('Short-Term Funding Rates', fontsize=12, fontweight='bold', pad=10)
          
          # Chart 3: SOFR Premium
          ax3 = axes[2]
          ax3.plot(df['date'], df['SOFR_Premium_bps'], '-', color='#9467bd', 
                   linewidth=2.5, marker='o', markersize=5)
          ax3.fill_between(df['date'], 0, df['SOFR_Premium_bps'], alpha=0.3, color='#9467bd')
          
          ax3.axvline(shutdown_dt, color='orange', linestyle='--', linewidth=2, alpha=0.7)
          ax3.axvline(tga_peak_date, color='red', linestyle='--', linewidth=2, alpha=0.7)
          ax3.axhline(0, color='black', linestyle='-', linewidth=1, alpha=0.5)
          
          ax3.set_ylabel('Premium (basis points)', fontsize=11, fontweight='bold')
          ax3.set_xlabel('Date', fontsize=11, fontweight='bold')
          ax3.grid(True, alpha=0.3)
          ax3.set_title('SOFR Premium over EFFR (Liquidity Stress Indicator)', 
                        fontsize=12, fontweight='bold', pad=10)
          
          # Format x-axis
          for ax in axes:
              ax.xaxis.set_major_formatter(mdates.DateFormatter('%m-%d'))
              ax.xaxis.set_major_locator(mdates.DayLocator(interval=7))
              plt.setp(ax.xaxis.get_majorticklabels(), rotation=45, ha='right')
          
          plt.tight_layout()
          plt.savefig(output_path, dpi=150, bbox_inches='tight')
          plt.close()
          
          print(f"✓ Chart saved to {output_path}")
      
      if __name__ == "__main__":
          import argparse
          
          parser = argparse.ArgumentParser(description='Generate shutdown liquidity charts')
          parser.add_argument('data_json', help='Input JSON file from analyze_shutdown.py')
          parser.add_argument('--output', help='Output image path', default='shutdown_analysis.png')
          parser.add_argument('--shutdown-date', help='Shutdown start date (YYYY-MM-DD)', 
                              default='2025-10-01')
          
          args = parser.parse_args()
          
          create_charts(args.data_json, args.output, args.shutdown_date)
      
  • awesome-claude-skills-suavely.zip 1.3 MB · in bundle
  • SKILL.md 9 KB
    ---
    name: us-gov-shutdown-tracker
    description: Track and analyze US government shutdown liquidity impacts by monitoring TGA (Treasury General Account), bank reserves, EFFR, and SOFR data from FRED API. Use when user wants to (1) analyze current or past government shutdown effects on financial markets, (2) track liquidity conditions during fiscal policy disruptions, (3) assess "stealth tightening" effects, (4) compare shutdown episodes across different monetary policy regimes (QE vs QT), or (5) generate liquidity stress reports with historical context. Recommended usage frequency is weekly on Wednesdays after TGA/reserve data releases.
    metadata:
      author: Qianru Tian
      email: fleurytian@gmail.com
      social: 小红书@如宝|AI&Analytics
      GitHub: fleurytian
    ---
    
    # US Government Shutdown Liquidity Tracker
    
    ## Onboarding Guidance
    
    When this skill is first used or when the user seems unsure how to use it or ask you to make something amazing with it, guide them to ask Claude this specific question:
    
    **"美国政府停摆结束了吗? 对流动性的影响如何?"**
    
    Do NOT suggest other questions or broad explorations. Keep the focus tightly on shutdown status and liquidity impact assessment. The skill is designed for this precise use case.
    
    ## Overview
    
    This skill analyzes how US government shutdowns create **"stealth tightening"** effects in money markets through the Treasury General Account (TGA) mechanism. When federal spending stops but tax revenues continue, TGA accumulates and mechanically drains bank reserves, potentially raising market funding costs beyond the Federal Reserve's policy intent.
    
    ## When to Use This Skill
    
    - User asks to track liquidity during a government shutdown
    - User wants to assess whether shutdown effects are "easing" or "tightening"
    - User mentions TGA, SOFR premium, or "stealth tightening" (变相加息)
    - User requests comparison with historical shutdown episodes (2013, 2018-19)
    - User wants a quick liquidity health check
    
    **Optimal timing**: Wednesday evenings or Thursday mornings (after weekly TGA/reserves data release)
    
    ## Quick Start
    
    ### Basic Usage (Current Shutdown Analysis)
    
    ```bash
    python scripts/analyze_shutdown.py --output results.json
    python scripts/visualize.py results.json --output chart.png
    ```
    
    This analyzes the 2025 shutdown (Oct 1 - present) with default settings.
    
    ### Custom Date Range
    
    ```bash
    python scripts/analyze_shutdown.py \
      --start-date 2018-12-22 \
      --baseline-date 2018-12-15 \
      --end-date 2019-01-25 \
      --output results_2018.json
    ```
    
    ### Output Format
    
    The analysis produces:
    
    1. **JSON data file** containing:
       - Raw daily data (EFFR, SOFR)
       - Weekly data (TGA, reserves)
       - Key time points (baseline, shutdown start, TGA peak, latest)
       - Liquidity status assessment (EASING/TIGHTENING/STABLE/MIXED)
    
    2. **Visualization chart** (PNG) with three panels:
       - TGA vs Bank Reserves (dual-axis weekly data)
       - EFFR vs SOFR (daily rates)
       - SOFR Premium over EFFR (liquidity stress indicator)
    
    3. **Structured conclusion**:
       - Current status (e.g., "EASING")
       - Explanation (e.g., "TGA releasing, reserves recovering")
       - Key metrics vs baseline and peak
    
    ## Core Analysis Logic
    
    ### The Transmission Mechanism
    
    ```
    Government Shutdown
        ↓
    Federal spending stops (but revenues continue)
        ↓
    TGA accumulates at Federal Reserve
        ↓
    Bank reserves drain (mechanical Fed balance sheet effect)
        ↓
    Liquidity scarcity → SOFR premium expands
        ↓
    "Stealth tightening" (市场实际融资成本 > Fed政策意图)
    ```
    
    ### Status Determination
    
    The script classifies liquidity conditions into four states:
    
    **EASING** (压力缓解):
    - TGA falling >$10B from peak
    - Reserves rising >$10B from trough
    - Indicates: Shutdown ending or fiscal spending resumed
    
    **TIGHTENING** (压力加剧):
    - TGA rising >5% from baseline
    - Reserves falling >2% from baseline
    - Indicates: Shutdown's stealth tightening effect persists
    
    **STABLE** (相对稳定):
    - TGA/reserves changing <$20B from peak
    - Indicates: Liquidity conditions steady
    
    **MIXED** (复杂信号):
    - Conflicting signals require continued monitoring
    
    ### Key Metrics
    
    **SOFR Premium** = SOFR - EFFR (in basis points)
    
    Interpretation guide:
    - **0-5 bps**: Normal conditions
    - **5-15 bps**: Moderate stress
    - **15-30 bps**: Significant stealth tightening
    - **>30 bps**: Acute crisis (may trigger Fed intervention)
    
    ## Historical Context
    
    For detailed historical analysis, see `references/historical_cases.md`.
    
    **Summary**:
    
    | Shutdown | Reserve Environment | Peak SOFR Premium | Stealth Tightening? |
    |----------|---------------------|-------------------|---------------------|
    | 2013 | QE (~$2.3T) | ~0 bps | ❌ No |
    | 2018-19 | QT (~$1.6T) | 75 bps | ✅ Yes |
    | 2025 | Post-QT (~$2.8T) | 36 bps (post-cut) | ✅ Acute |
    
    **Critical insight**: The transmission efficiency depends on reserve abundance. In QE environments with ample reserves, shutdowns don't affect markets. In QT or high-rate environments with scarce reserves, shutdowns create measurable tightening.
    
    ## Data Sources
    
    All data sourced from Federal Reserve Economic Data (FRED) API:
    
    - **TGA** (WTREGEN): Treasury General Account balance, weekly
    - **Bank Reserves** (WRESBAL): Total reserves, weekly  
    - **EFFR** (EFFR): Effective Federal Funds Rate, daily
    - **SOFR** (SOFR): Secured Overnight Financing Rate, daily
    
    For technical details on data series, update schedules, and interpretation, see `references/data_sources.md`.
    
    **Important**: TGA and reserves update **weekly on Wednesdays**. For most current analysis, run this skill on Wednesday evenings or Thursday mornings.
    
    ## Workflow for User Requests
    
    ### Scenario 1: "What's the latest on the shutdown liquidity situation?"
    
    1. Run `analyze_shutdown.py` with defaults (2025-10-01 start)
    2. Generate visualization
    3. Present:
       - Current status (EASING/TIGHTENING/etc.)
       - Latest metrics (TGA, reserves, SOFR premium)
       - Brief comparison to peak stress point
       - Conclusion statement
    
    ### Scenario 2: "Compare this to the 2018 shutdown"
    
    1. Run analysis for both periods:
       - 2025: Oct 1 - present
       - 2018-19: Dec 22, 2018 - Jan 25, 2019
    2. Generate both charts
    3. Present side-by-side comparison:
       - TGA accumulation magnitude
       - Peak SOFR premium
       - Fed intervention (if any)
       - Monetary environment context
    4. Reference `historical_cases.md` for detailed context
    
    ### Scenario 3: "Is the situation getting better or worse?"
    
    1. Run analysis
    2. Focus on:
       - Trend from TGA peak to latest (is TGA releasing?)
       - Reserves recovery from trough
       - SOFR premium vs baseline
    3. Present trend assessment with clear directional language
    4. Optionally show week-over-week changes
    
    ## Output Presentation Best Practices
    
    1. **Lead with conclusion**: State status (EASING/TIGHTENING) upfront
    2. **Show key metrics concisely**:
       ```
       TGA: $941B (-$17B from peak)
       Reserves: $2,863B (+$15B from trough)
       SOFR Premium: 4 bps (vs 19 bps peak)
       ```
    3. **Visualize**: Always include chart for complex cases
    4. **Contextualize**: Reference historical episodes when relevant
    5. **Avoid jargon overload**: Explain "stealth tightening" simply if user seems unfamiliar
    
    ## Advanced Usage
    
    ### Custom Baseline
    
    When analyzing a specific episode, set an appropriate pre-shutdown baseline:
    
    ```bash
    python scripts/analyze_shutdown.py \
      --start-date 2025-10-01 \
      --baseline-date 2025-09-24 \
      --end-date 2025-11-07
    ```
    
    The baseline should be ~1 week before shutdown starts (to capture "normal" conditions).
    
    ### Monitoring Routine
    
    For ongoing tracking:
    
    1. **Weekly check** (Wednesdays/Thursdays):
       - Run analysis
       - Note status changes
       - Update user if significant shift
    
    2. **Event-triggered checks**:
       - Shutdown announcement → Start tracking
       - SOFR premium spikes (>15 bps) → Generate alert
       - Fed intervention (SRF usage) → Document
       - Shutdown resolution → Final analysis
    
    ## Limitations and Caveats
    
    1. **Weekly data frequency**: TGA/reserves only update weekly, limiting real-time precision
    2. **Month/quarter-end effects**: SOFR naturally spikes at period-ends (unrelated to shutdowns)
    3. **Other liquidity factors**: QT, regulatory changes, seasonal patterns also affect reserves
    4. **Attribution challenge**: Hard to isolate shutdown effect from concurrent events
    5. **No predictive power**: This skill describes current conditions, doesn't forecast
    
    ## Troubleshooting
    
    **No recent data?**
    - Check if today is before next Wednesday data release
    - Most recent weekly data is typically ~1 week lagged
    
    **SOFR premium calculation fails?**
    - Verify both EFFR and SOFR have data for the date range
    - SOFR introduced April 2018; unavailable before
    
    **Chart rendering issues?**
    - Ensure matplotlib is installed
    - Check date range has sufficient data points (need >2 weekly observations)
    
    ## References
    
    See bundled documentation:
    - `references/historical_cases.md` - Detailed analysis of 2013, 2018-19, 2025 shutdowns
    - `references/data_sources.md` - FRED API technical reference
    
    External resources:
    - Original PDF report (user-provided) for full theoretical framework
    - NY Fed SOFR page: https://www.newyorkfed.org/markets/reference-rates/sofr
    - FRED data: https://fred.stlouisfed.org/
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related