How to get daily US Treasury yields and macro data into pandas
Short answer
The Curvewire dataset mirrors public Treasury yield curve rates (nominal and real) and monthly BLS series. Load "treasury_yields", pick the 2-year and 10-year columns and subtract to get the 10y-2y spread; a negative value means the curve is inverted.
- pip install datasets
- Load "treasury_yields" (daily) or "treasury_real_yields".
- Compute spread = 10-year − 2-year.
- Load "bls_monthly" for inflation and jobs series to plot alongside.
Copy-paste code
Data: CyberMax dataset on Hugging Face; load it with the datasets library (pip install datasets)
from datasets import load_dataset
ds = load_dataset("CyberMax-tools/curvewire-us-macro-panel", "treasury_yields", split="train")
df = ds.to_pandas()
print(len(df), "rows")
print(df.head())Good to know
Public data for information only; not financial advice.
Curvewire Brief: Every Monday: US rates and macro, on one page
from $19/monthWant it read for you every Monday? The Curvewire Brief turns this data into a rates and macro brief (PDF + CSVs): $19/month, cancel any time.
Secure checkout · 14-day fix-or-refund if it doesn't work as described (terms)Free: the Free API Starter Kit
Copy-paste calls for 4 APIs with free daily tiers (CVE priority, VIN recalls, US duty rates, email checks), then 5 short emails on KEV/EPSS, MCP and free data.