← Back to all sparks
T

treasury

ANALYTICS
Velocity0.0

R package treasury by m-muecke — release notes from GitHub.

A thin Treasury rates wrapper has stopped adding endpoints and started making its tables self-describing.

treasury-ratesfixed-incomer-packageapi-wrapperdata-tablecaching
Current state
treasury wraps the US Treasury's published rate feeds — bill rates, par yields, forward rates, long-term extrapolated rates, and the HQM and breakeven inflation curves — into one set of R functions. Since 0.3.0 every function returns a data.table, and 0.5.0 added optional on-disk response caching with a one-day default. The most recent release is about data fidelity rather than reach: identifying columns, correct maturity labels, and locale-safe date parsing.
Where it's heading
Endpoint coverage looks essentially complete, so the work has moved to the metadata a downstream analyst needs to join and audit results — cusip and maturity_date on bill quotes, the feed's updated_at stamp, and the extrapolation factor behind 2002-2006 long-term rate estimates. Error handling is tightening in the same direction: an out-of-range month now fails with a message instead of quietly returning nothing. That is the profile of a wrapper moving from coverage to correctness, where the remaining bugs are the subtle ones that only surface in other people's locales.
Prediction
Expect further column-level enrichment and input validation on the endpoints already covered rather than new data sources, since the structural pieces — data.table returns and caching — are already in place.

Recent moves

  1. 1mo ago

    Bill rates gain CUSIP and maturity date; locale bug fixed

    The release that best shows the shift to correctness: bill quotes now identify which security they came from via cusip and maturity_date, long-term rates expose the extrapolation factor used between 2002 and 2006, and every daily function carries the feed's updated_at stamp. Two real bugs go with it — dates failed to parse under non-English locales, and the 1.5-month maturity was mislabelled.

    View source ↗
  2. 4mo ago

    Optional response caching, one day by default

    An opt-in cache with a configurable max age, plus helpers to locate and clear it. Small in code, but it changes how the package behaves in repeated backtests and knitted reports, where the same curve was previously refetched on every run.

    View source ↗
  3. 11mo ago

    Rate functions renamed to singular for consistency

    Function names were made consistent — tr_bill_rates() and tr_par_yields() lose their plurals — alongside a fix to the readxl installation check. A breaking rename this early in the version history is cheap; doing it now is what lets the later releases add columns rather than argue about names.

    View source ↗
  4. 1y ago

    Every function now returns a data.table

    ⚡ SPARK

    The package's one architectural commitment: internals moved to data.table and every exported function changed its return type. Everything after this release — caching, added columns, validation — is built on that decision, and it is the point where treasury stopped being a loose set of download helpers.

    View source ↗
  5. 2y ago

    HQM, coupon-issue and breakeven inflation curves added

    The coverage build-out: HQM corporate bond, nominal and real coupon-issue, and breakeven inflation curves join the core rate feeds. This is the release where the package's scope stopped being just bills and par yields and became the Treasury curve set that later releases have been refining.

    View source ↗