Download daily interest rates from the US Treasury XML feed. Leveraging < https://home.treasury.gov/treasury-daily-interest-rate-xml-feed>, this package serves as a wrapper, facilitating the retrieval of daily treasury rates across various categories, including par yield curves, treasury bills, long-term rates, and real yield curves. In addition, it provides access to the monthly published yield curve datasets, including the High Quality Market (HQM) corporate bond yield curve and the Treasury nominal and real coupon-issue (TNC, TRC) and breakeven inflation (TBI) curves.
The goal of treasury is to provide a simple and modern interface to the US treasury XML feed for daily interest rates.
You can install the released version of treasury from CRAN with:
install.packages("treasury")
And the development version from GitHub with:
# install.packages("pak")
pak::pak("m-muecke/treasury")
treasury functions are prefixed with tr_ and follow the naming
convention of the XML feed.
library(treasury)
yield_curve = tr_yield_curve(2025)
head(yield_curve)
#> date maturity rate updated_at
#> <Date> <char> <num> <POSc>
#> 1: 2025-01-02 1 month 4.45 2026-08-21 15:59:37
#> 2: 2025-01-02 2 month 4.36 2026-08-21 15:59:37
#> 3: 2025-01-02 3 month 4.36 2026-08-21 15:59:37
#> 4: 2025-01-02 4 month 4.31 2026-08-21 15:59:37
#> 5: 2025-01-02 6 month 4.25 2026-08-21 15:59:37
#> 6: 2025-01-02 1 year 4.17 2026-08-21 15:59:37