Title: | Fetch US Treasury yield curve data. |
---|---|
Description: | Forms a query to submit for US Treasury yield curve data, posting this query to the US Treasury web site's data feed service. By default the download includes data yield data for 12 products from January 1, 1990, some of which are NA during this span. The caller can pass parameters to limit the query to a certain year or year and month, but the full download is not especially large. The download data from the service is in XML format. The package's main function transforms that XML data into a numeric data frame with treasury product items (constant maturity yields for 12 kinds of bills, notes, and bonds) as columns and dates as row names. The function returns a list which includes an item for this data frame as well as query-related values for reference and the update date from the service. |
Authors: | Matt Barry <[email protected]> |
Maintainer: | Matt Barry <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.1 |
Built: | 2024-11-03 03:04:18 UTC |
Source: | https://github.com/mrbcuda/ustyc |
Downloads US Treasury yield curve data from the US Treasury web site.
getYieldCurve(year = NULL, month = NULL, base = "http://data.treasury.gov/feed.svc/DailyTreasuryYieldCurveRateData", allowParallel = FALSE)
getYieldCurve(year = NULL, month = NULL, base = "http://data.treasury.gov/feed.svc/DailyTreasuryYieldCurveRateData", allowParallel = FALSE)
year |
the desired year number or NULL for all years (default) |
month |
the desired month number or NULL for all months (default) |
base |
the base URL for the data service, defaulting to http://data.treasury.gov/feed.svc/DailyTreasuryYieldCurveRateData. If the month or year arguments are not NULL, then the function modifies this URL to parameterize the download request. |
allowParallel |
whether to allow |
Forms a query to submit for US Treasury yield curve data, posting this query to the US Treasury web site's data feed service. By default the download includes data yield data for 12 products from January 1, 1990, some of which are NA during this span. The caller can pass parameters to limit the query to a certain year or year and month, but the full download is not especially large. The download data from the service is in XML format. This function transforms that data into a numeric data frame with treasury product items (constant maturity yields for 12 kinds of bills, notes, and bonds) as columns and dates as row names. The function returns a list which includes an item for this data frame as well as query-related values for reference and the update date from the service. The data frame can be used as-is or converted easily to a time series format such as xts
.
Class type ustyc
containing update date updated
, dataframe df
, month
, year
, and query
elements. The query
element value is the string used to call the data service for download.
http://data.treasury.gov/feed.svc/DailyTreasuryYieldCurveRateData
http://cran.r-project.org/web/packages/FRBData/ for different interest rates and source.
## Not run: xlist = getYieldCurve() summary(xlist) ## End(Not run)
## Not run: xlist = getYieldCurve() summary(xlist) ## End(Not run)
Fetches US Treasury yield curve data and transforms to data frame.
Downloads the US Treasury yield curve data in its original XML format, then translates that data into a data frame with dates as row names and maturities as column names.
Matt Barry [email protected]
US Treasury resource web site http://www.treasury.gov/resource-center/data-chart-center/interest-rates/Pages/TextView.aspx?data=yield