Package 'treasury'

Title: Client for US Treasury XML Feed and Published Data
Description: 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.
Authors: Maximilian Mücke [aut, cre]
Maintainer: Maximilian Mücke <[email protected]>
License: MIT + file LICENSE
Version: 0.2.0.9000
Built: 2024-11-11 08:20:52 UTC
Source: https://github.com/m-muecke/treasury

Help Index


Daily treasury bill rates

Description

These rates are the daily secondary market quotations on the most recently auctioned Treasury Bills for each maturity tranche (4-week, 8-week, 13-week, 17-week, 26-week, and 52-week) for which Treasury currently issues new bills.

Usage

tr_bill_rates(date = NULL)

Arguments

date

character(1) or numeric(1) date in format yyyy or yyyymm. If NULL, all data is returned. Default NULL.

Details

Market quotations are obtained at approximately 3:30 PM each business day by the Federal Reserve Bank of New York. The Bank Discount rate is the rate at which a bill is quoted in the secondary market and is based on the par value, amount of the discount and a 360-day year. The Coupon Equivalent, also called the Bond Equivalent, or the Investment Yield, is the bill's yield based on the purchase price, discount, and a 365- or 366-day year. The Coupon Equivalent can be used to compare the yield on a discount bill to the yield on a nominal coupon security that pays semiannual interest with the same maturity date.

Value

A data.frame() containing the rates or NULL when no entries were found.

Source

https://home.treasury.gov/treasury-daily-interest-rate-xml-feed

See Also

Other interest rate: tr_long_term_rate(), tr_real_long_term(), tr_real_yield_curve(), tr_yield_curve()

Examples

# get data for a single month
tr_bill_rates("202201")
# or for the entire year
tr_bill_rates(2022)

Download Treasury Coupon Issues and Corporate Bond Yield Curves

Description

The Yield Curve for Treasury Nominal Coupon Issues (TNC yield curve) is derived from Treasury nominal notes and bonds. The Yield Curve for Treasury Real Coupon Issues (TRC yield curve) is derived from Treasury Inflation-Protected Securities (TIPS). The Treasury Breakeven Inflation Curve (TBI curve) is derived from the TNC and TRC yield curves combined.

Usage

tr_curve_rate(
  x = c("hqm", "tnc", "trc", "tbi"),
  type = c("monthly", "end-of-month"),
  year = NULL
)

tr_par_yields(x = c("hqm", "tnc", "trc"), type = c("monthly", "end-of-month"))

tr_forward_rate(
  x = c("tnc", "trc", "tbi"),
  type = c("monthly", "end-of-month")
)

Arguments

x

character(1). Must be one of the following options:

  • "hqm": The Treasury High Quality Market (HQM) Corporate Bond Yield Curve.

  • "tnc": The Treasury Nominal Coupon-Issue (TNC) Yield Curve.

  • "trc": The Treasury Real Coupon-Issue (TRC) Yield Curve.

  • "tbi": The Treasury Breakeven Inflation (TBI) Curve.

type

character(1). Either "monthly" or "end-of-month". Default is "monthly".

year

integer(1). Year to download. Default is NULL. If NULL, then all available years are downloaded.

Value

A data.frame() containing the treasury rates.

Source

https://home.treasury.gov/data/treasury-coupon-issues-and-corporate-bond-yield-curves

Examples

## Not run: 
# TBI Treasury Curve Breakeven Rates
tr_curve_rate("tbi")
tr_curve_rate("trc", "end-of-month", 2024L)
# TRC Treasury Yield Curve Par Yields, Monthly Average
tr_par_yields("trc")
# TNC Treasury Yield Curve Forward Rates, End of Month
tr_forward_rate("tnc", "end-of-month")

## End(Not run)

Daily treasury long-term rates

Description

Treasury ceased publication of the 30-year constant maturity series on February 18, 2002 and resumed that series on February 9, 2006. To estimate a 30-year rate during that time frame, this series includes the Treasury 20-year Constant Maturity rate and an "adjustment factor," which may be added to the 20-year rate to estimate a 30-year rate during the period of time in which Treasury did not issue the 30-year bonds.

Usage

tr_long_term_rate(date = NULL)

Arguments

date

character(1) or numeric(1) date in format yyyy or yyyymm. If NULL, all data is returned. Default NULL.

Value

A data.frame() containing the rates or NULL when no entries were found.

Source

https://home.treasury.gov/treasury-daily-interest-rate-xml-feed

See Also

Other interest rate: tr_bill_rates(), tr_real_long_term(), tr_real_yield_curve(), tr_yield_curve()

Examples

# get data for a single month
tr_long_term_rate("202201")
# or for the entire year
tr_long_term_rate(2022)

Daily treasury real long-term rate averages

Description

The Long-Term Real Rate Average is the unweighted average of bid real yields on all outstanding TIPS with remaining maturities of more than 10 years and is intended as a proxy for long-term real rates.

Usage

tr_real_long_term(date = NULL)

Arguments

date

character(1) or numeric(1) date in format yyyy or yyyymm. If NULL, all data is returned. Default NULL.

Value

A data.frame() containing the rates or NULL when no entries were found.

Source

https://home.treasury.gov/treasury-daily-interest-rate-xml-feed

See Also

Other interest rate: tr_bill_rates(), tr_long_term_rate(), tr_real_yield_curve(), tr_yield_curve()

Examples

# get data for a single month
tr_real_long_term("202201")
# or for the entire year
tr_real_long_term(2022)

Daily treasury par real yield curve rates

Description

The par real curve, which relates the par real yield on a Treasury Inflation Protected Security (TIPS) to its time to maturity, is based on the closing market bid prices on the most recently auctioned TIPS in the over-the-counter market. The par real yields are derived from input market prices, which are indicative quotations obtained by the Federal Reserve Bank of New York at approximately 3:30 PM each business day. Treasury began publishing this series on January 2, 2004. At that time Treasury released 1 year of historical data.

Usage

tr_real_yield_curve(date = NULL)

Arguments

date

character(1) or numeric(1) date in format yyyy or yyyymm. If NULL, all data is returned. Default NULL.

Value

A data.frame() containing the rates or NULL when no entries were found.

Source

https://home.treasury.gov/treasury-daily-interest-rate-xml-feed

See Also

Other interest rate: tr_bill_rates(), tr_long_term_rate(), tr_real_long_term(), tr_yield_curve()

Examples

# get data for a single month
tr_real_yield_curve("202201")
# or for the entire year
tr_real_yield_curve(2022)

Daily treasury par yield curve rates

Description

This par yield curve, which relates the par yield on a security to its time to maturity, is based on the closing market bid prices on the most recently auctioned Treasury securities in the over-the-counter market. The par yields are derived from input market prices, which are indicative quotations obtained by the Federal Reserve Bank of New York at approximately 3:30 PM each business day.

Usage

tr_yield_curve(date = NULL)

Arguments

date

character(1) or numeric(1) date in format yyyy or yyyymm. If NULL, all data is returned. Default NULL.

Value

A data.frame() containing the rates or NULL when no entries were found.

Source

https://home.treasury.gov/treasury-daily-interest-rate-xml-feed

See Also

Other interest rate: tr_bill_rates(), tr_long_term_rate(), tr_real_long_term(), tr_real_yield_curve()

Examples

# get data for a single month
tr_yield_curve("202201")
# or for the entire year
tr_yield_curve(2022)