Overview
Whether uses US Treasury yield data from FRED (Federal Reserve Economic Data) to calculate the base rate and curve slope—the two foundational inputs for regime classification. This page documents the sourcing strategy, caching behavior, and fallback mechanisms.Data Sources
FRED CSV Endpoints
Whether fetches Treasury yields via direct CSV downloads from the Federal Reserve Bank of St. Louis:Endpoint:
https://fred.stlouisfed.org/graph/fredgraph.csv?id=DGS1MOSeries: 1-Month Treasury Constant Maturity RateUsage: Primary base rate inputEndpoint:
https://fred.stlouisfed.org/graph/fredgraph.csv?id=DGS3MOSeries: 3-Month Treasury Constant Maturity RateUsage: Fallback base rate if 1M is unavailableEndpoint:
https://fred.stlouisfed.org/graph/fredgraph.csv?id=DGS2Series: 2-Year Treasury Constant Maturity RateUsage: Short-end input for curve slope calculationEndpoint:
https://fred.stlouisfed.org/graph/fredgraph.csv?id=DGS10Series: 10-Year Treasury Constant Maturity RateUsage: Long-end input for curve slope calculationRequired Fields
Whether requires the following yields to operate:- 1-Month OR 3-Month: Used as the base rate proxy for cost of money
- 2-Year: Short-end anchor for curve slope
- 10-Year: Long-end anchor for curve slope
Data Processing
Base Rate Calculation
The base rate represents the short-term cost of money:- Use 1-Month yield
- If unavailable, use 3-Month yield
- If both missing, default to 0% and flag as
MISSING
Curve Slope Calculation
The curve slope measures risk appetite via the yield curve steepness:10Y - 2Y
- Positive slope (e.g., +1.5%): Longer-term rates are higher → healthy risk appetite
- Flat slope (e.g., 0%): Long and short rates converge → caution building
- Inverted slope (e.g., -0.5%): Short rates exceed long rates → risk aversion
Latest Common Date Logic
Whether ensures all yield series align to the same record date:Caching Strategy
Treasury data is fetched server-side with Next.js revalidation:- Revalidate interval: 24 hours (86400 seconds)
- Rationale: Treasury rates are published end-of-day and rarely updated intraday
- Implementation: Uses Next.js
fetchwithnext: { revalidate: 86400 }
Whether does not cache Treasury data in the client. All caching is handled by Next.js’s server-side cache.
Fallback Mechanisms
Snapshot Data
If the live fetch fails, Whether falls back to a checked-in snapshot:ISO timestamp when the fallback was triggered
Human-readable reason for fallback (e.g., “Treasury API error: 503”)
Set to
false when using snapshot data. Triggers “OFFLINE” badge in UI.Time Machine Mode
When viewing historical regimes, Whether uses pre-cached snapshots:Response Structure
Always
"https://fred.stlouisfed.org" for live dataISO date of the Treasury data (e.g.,
"2024-03-15")ISO timestamp when Whether fetched the data
true if fetched from FRED; false if using snapshotData Warnings
Whether surfaces explicit warnings when data quality is compromised:-
“Base rate missing; defaulted to threshold for conservative scoring.”
- Triggered when both 1M and 3M yields are unavailable
- Scoring uses the
baseRateTightnessthreshold as a safe default
-
“Curve slope missing; defaulted to cautious floor for scoring.”
- Triggered when 2Y or 10Y yields are unavailable
- Scoring assumes the minimum slope (
-1.0%) to avoid false optimism
Source Attribution
All Treasury data displayed in Whether includes:- Source label: “US Treasury Fiscal Data API” (though fetched via FRED)
- Source URL: Link to
fred.stlouisfed.org - Record date: The official date of the yield data
- Fetched timestamp: When Whether retrieved the data
Related
- Macro Indicators - Additional economic signals
- Data Provenance - Freshness monitoring and audit trails
- Regime Scoring - How yields feed into regime classification