Client for US Treasury XML Feed and Published Data

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.


treasury

R-CMD-check CRANstatus R-universeversion

Overview

The goal of treasury is to provide a simple and modern interface to the US treasury XML feed for daily interest rates.

Installation

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")

Usage

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

Related work

  • ustyc - R package to download and parse the US Treasury yield curve data
  • ustfd - R client for US Treasury Fiscal Data API

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("treasury")

0.7.0 by Maximilian Mücke, 2 months ago


https://m-muecke.github.io/treasury/, https://github.com/m-muecke/treasury


Report a bug at https://github.com/m-muecke/treasury/issues


Browse source code at https://github.com/cran/treasury


Authors: Maximilian Mücke [aut, cre] (ORCID:


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports curl, data.table, httr2, xml2

Suggests ggplot2, knitr, readxl, scales, testthat


Suggested by ragtop.


See at CRAN