output |
---|
pdf_document |
This R package usfrbcp
provides functions for processing the US Federal Reserve Bank's commercial paper history data. The main function posts a query to the US Federal Reserve Bank's web site. By default the download includes commercial paper rates, volumes, and outstanding issue counts, variously in daily, weekly, or monthly frequency. The download data from the service is in compressed XML format. The query function transforms that data into a list of products. Several supporting functions then convert these lists by data type into smaller lists of data frames for convenient usage. The data frames can be used as-is or converted easily to a time series format such as xts
.
The main function retrieves the commercial paper data history archive from the web service and extracts it into a collection of lists:
require(usfrbcp)
cp <- getCommercialPaper()
summary(cp)
We then decompose this into the products of interest, such as
rates <- getCommercialPaperRates(cp,"text")
summary(rates)
volumes <- getCommercialPaperVolumes(cp,"text")
summary(volumes)
The data frame might be converted to xts
and plotted for example with lattice
:
require(xts)
require(lattice)
df <- mergeSeries(rates)
xt = xts(df,order.by=as.Date(rownames(df)))
xyplot.ts(xt,scales=list(y=list(relation="same")),ylab="Rate (%)")
xyplot.ts(xt,superpose=TRUE,auto.key=list(columns=4),ylab="Yield (%)")
One might also plot data from the volume series, which also contains dollar values:
volumes <- getCommercialPaperVolumes(cp,"text")
v = volumes[[35]]
xyplot.ts(na.omit(xts(v$df,order.by=as.Date(rownames(v$df)))),
ylab=paste(v$unit,v$currency,v$unit_mult),
panel=function(x,...){
panel.xyplot(x,...)
panel.grid(-1,0)
panel.loess(x,col=2,...)},
main=v$short_desc)
Using dplyr
and tidyr
we can easily create some ggplot2
graphics. Using the year-end series as an example:
require(ggplot2)
require(dplyr)
require(tidyr)
require(scales)
rv = getCommercialPaperYearend(cp,"text")
df <- mergeSeries(rv)
df <- df %>%
mutate(Date=as.Date(rownames(df))) %>%
gather(Product,Outstanding,starts_with("DT"))
# p <- ggplot(df,aes(x=Date,y=Outstanding,group=Product))
# p + geom_line(aes(colour=Product)) + scale_x_date()
p <- ggplot(df,aes(x=Date,y=Outstanding))
p + geom_line(aes(colour=Product)) +
facet_wrap(~Product,ncol=2,scales="fixed") +
scale_x_date(limits=c(as.Date("2010-1-1"),max(df$Date))) +
theme(legend.position="none") +
ggtitle("Commercial Paper Outstanding Year End")
RATES is data set with 24 Series:
- Overnight AA nonfinancial commercial paper rate
- 7-day AA nonfinancial commercial paper rate
- 15-day AA nonfinancial commercial paper rate
- 30-day AA nonfinancial commercial paper rate
- 60-day AA nonfinancial commercial paper rate
- 90-day AA nonfinancial commercial paper rate
- Overnight A2/P2 nonfinancial commercial paper rate
- 7-day A2/P2 nonfinancial commercial paper rate
- 15-day A2/P2 nonfinancial commercial paper rate
- 30-day A2/P2 nonfinancial commercial paper rate
- 60-day A2/P2 nonfinancial commercial paper rate
- 90-day A2/P2 nonfinancial rate
- Overnight AA financial commercial paper rate
- 7-day AA financial commercial paper rate
- 15-day AA financial commercial paper rate
- 30-day AA financial commercial paper rate
- 60-day AA financial commercial paper rate
- 90-day AA financial commercial paper rate
- Overnight AA asset-backed commercial paper rate
- 7-day AA asset-backed commercial paper rate
- 15-day AA asset-backed commercial paper rate
- 30-day AA asset-backed commercial paper rate
- 60-day AA asset-backed commercial paper rate
- 90-day AA asset-backed commercial paper rate
VOL is data set with 60 Series
- Amount of AA nonfinancial commercial paper maturing in 1-4 days
- Amount of A2/P2 nonfinancial commercial paper maturing in 1-4 days
- Amount of AA financial commercial paper maturing in 1-4 days
- Amount of AA asset-backed commercial paper maturing in 1-4 days
- Amount of commercial paper maturing in 1-4 days
- Number of issues of AA nonfinancial commercial paper maturing in 1-4 days
- Number of issues of A2/P2 nonfinancial commercial paper maturing in 1-4 days
- Number of issues of AA financial commercial paper maturing in 1-4 days
- Number of issues of AA asset-backed commercial paper maturing in 1-4 days
- Number of issues of commercial paper maturing in 1-4 days
- Amount of AA nonfinancial commercial paper maturing in 5-9 days
- Amount of A2/P2 nonfinancial commercial paper maturing in 5-9 days
- Amount of AA financial commercial paper maturing in 5-9 days
- Amount of AA asset-backed commercial paper maturing in 5-9 days
- Amount of commercial paper maturing in 5-9 days
- Number of issues of AA nonfinancial commercial paper maturing in 5-9 days
- Number of issues of A2/P2 nonfinancial commercial paper maturing in 5-9 days
- Number of issues of AA financial commercial paper maturing in 5-9 days
- Number of issues of AA asset-backed commercial paper maturing in 5-9 days
- Number of issues of commercial paper maturing in 5-9 days
- Amount of AA nonfinancial commercial paper maturing in 10-20 days
- Amount of A2/P2 nonfinancial commercial paper maturing in 10-20 days
- Amount of AA financial commercial paper maturing in 10-20 days
- Amount of AA asset-backed commercial paper maturing in 10-20 days
- Amount of commercial paper maturing in 10-20 days
- Number of issues of AA nonfinancial commercial paper maturing in 10-20 days
- Number of issues of A2/P2 nonfinancial commercial paper maturing in 10-20 days
- Number of issues of AA financial commercial paper maturing in 10-20 days
- Number of issues of AA asset-backed commercial paper maturing in 10-20 days
- Number of issues of commercial paper maturing in 10-20 days
- Amount of AA nonfinancial commercial paper maturing in 21-40 days
- Amount of A2/P2 nonfinancial commercial paper maturing in 21-40 days
- Amount of AA financial commercial paper maturing in 21-40 days
- Amount of AA asset-backed commercial paper maturing in 21-40 days
- Amount of commercial paper maturing in 21-40 days
- Number of issues of AA nonfinancial commercial paper maturing in 21-40 days
- Number of issues of A2/P2 nonfinancial commercial paper maturing in 21-40 days
- Number of issues of AA financial commercial paper maturing in 21-40 days
- Number of issues of AA asset-backed commercial paper maturing in 21-40 days
- Number of issues of commercial paper maturing in 21-40 days
- Amount of AA nonfinancial commercial paper maturing in 41-80 days
- Amount of A2/P2 nonfinancial commercial paper maturing in 41-80 days
- Amount of AA financial commercial paper maturing in 41-80 days
- Amount of AA asset-backed commercial paper maturing in 41-80 days
- Amount of commercial paper maturing in 41-80 days
- Number of issues of AA nonfinancial commercial paper maturing in 41-80 days
- Number of issues of A2/P2 nonfinancial commercial paper maturing in 41-80 days
- Number of issues of AA financial commercial paper maturing in 41-80 days
- Number of issues of AA asset-backed commercial paper maturing in 41-80 days
- Number of issues of commercial paper maturing in 41-80 days
- Amount of AA nonfinancial commercial paper maturing in greater than 80 days
- Amount of A2/P2 nonfinancial commercial paper maturing in greater than 80 days
- Amount of AA financial commercial paper maturing in greater than 80 days
- Amount of AA asset-backed commercial paper maturing in greater than 80 days
- Amount of commercial paper maturing in greater than 80 days
- Number of issues of AA nonfinancial commercial paper maturing in greater than 80 days
- Number of issues of A2/P2 nonfinancial commercial paper maturing in greater than 80 days
- Number of issues of AA financial commercial paper maturing in greater than 80 days
- Number of issues of AA asset-backed commercial paper maturing in greater than 80 days
- Number of issues of commercial paper maturing in greater than 80 days
OUTST is data set with 77 Series
- Total commercial paper outstanding; seasonally adjusted
- Nonfinancial commercial paper outstanding; seasonally adjusted
- Nonfinancial domestic commercial paper outstanding; seasonally adjusted
- Nonfinancial foreign commercial paper outstanding; seasonally adjusted
- Nonfinancial other commercial paper outstanding; seasonally adjusted
- Financial commercial paper outstanding; seasonally adjusted
- Financial domestic commercial paper outstanding; seasonally adjusted
- Financial foreign commercial paper outstanding; seasonally adjusted
- Financial other commercial paper outstanding; seasonally adjusted
- Asset-backed commercial paper outstanding; seasonally adjusted
- Other commercial paper outstanding; seasonally adjusted
- Total commercial paper outstanding
- Nonfinancial commercial paper outstanding
- Nonfinancial domestic commercial paper outstanding
- Nonfinancial foreign commercial paper outstanding
- Nonfinancial other commercial paper outstanding
- Financial commercial paper outstanding
- Financial domestic commercial paper outstanding
- Financial domestic commercial paper outstanding, U.S. owned
- Financial domestic commercial paper outstanding, foreign bank parent
- Financial domestic commercial paper outstanding, foreign nonbank parent
- Financial domestic commercial paper outstanding, other
- Financial foreign commercial paper outstanding
- Financial foreign commercial paper outstanding, bank or bank holding company
- Financial foreign commercial paper outstanding, other
- Financial other commercial paper outstanding
- Asset-backed commercial paper outstanding
- Other commercial paper outstanding
- SEC rule 2a-7 tier-1 commercial paper outstanding
- SEC rule 2a-7 tier-2 commercial paper outstanding
- Dealer placed nonfinancial commercial paper outstanding
- Dealer placed financial commercial paper outstanding
- Dealer placed asset-backed commercial paper outstanding
- Dealer placed other commercial paper outstanding
- Directly placed nonfinancial commercial paper outstanding
- Directly placed financial commercial paper outstanding
- Directly placed asset-backed commercial paper outstanding
- Directly placed other commercial paper outstanding
- Total commercial paper outstanding; seasonally adjusted
- Nonfinancial commercial paper outstanding; seasonally adjusted
- Nonfinancial domestic commercial paper outstanding; seasonally adjusted
- Nonfinancial foreign commercial paper outstanding; seasonally adjusted
- Nonfinancial other commercial paper outstanding; seasonally adjusted
- Financial commercial paper outstanding; seasonally adjusted
- Financial domestic commercial paper outstanding; seasonally adjusted
- Financial foreign commercial paper outstanding; seasonally adjusted
- Financial other commercial paper outstanding; seasonally adjusted
- Asset-backed commercial paper outstanding; seasonally adjusted
- Other commercial paper outstanding; seasonally adjusted
- Total commercial paper outstanding
- Nonfinancial commercial paper outstanding
- Nonfinancial domestic commercial paper outstanding
- Nonfinancial foreign commercial paper outstanding
- Nonfinancial other commercial paper outstanding
- Financial commercial paper outstanding
- Financial domestic commercial paper outstanding
- Financial domestic commercial paper outstanding, U.S. owned
- Financial domestic commercial paper outstanding, foreign bank parent
- Financial domestic commercial paper outstanding, foreign nonbank parent
- Financial domestic commercial paper outstanding, other
- Financial foreign commercial paper outstanding
- Financial foreign commercial paper outstanding, bank or bank holding company
- Financial foreign commercial paper outstanding, other
- Financial other commercial paper outstanding
- Asset-backed commercial paper outstanding
- Other commercial paper outstanding
- L.O.C. (letter of credit)-backed commercial paper outstanding
- SEC rule 2a-7 tier-1 commercial paper outstanding
- SEC rule 2a-7 tier-2 commercial paper outstanding
- Dealer placed nonfinancial commercial paper outstanding
- Dealer placed financial commercial paper outstanding
- Dealer placed asset-backed commercial paper outstanding
- Dealer placed other commercial paper outstanding
- Directly placed nonfinancial commercial paper outstanding
- Directly placed financial commercial paper outstanding
- Directly placed asset-backed commercial paper outstanding
- Directly placed other commercial paper outstanding
OUTST_YREND is data set with 4 Series
- Total commercial paper outstanding, maturing after December 31
- SEC rule 2a-7 tier-1 commercial paper outstanding, maturing after December 31
- SEC rule 2a-7 tier-2 commercial paper outstanding, maturing after December 31
- Asset-backed commercial paper outstanding, maturing after December 31
OUTST_OLD is data set with 25 Series
- Total commercial paper outstanding; seasonally adjusted
- Nonfinancial commercial paper outstanding; seasonally adjusted
- Nonfinancial domestic commercial paper outstanding; seasonally adjusted
- Nonfinancial foreign commercial paper outstanding; seasonally adjusted
- Financial (including asset-backed) commercial paper outstanding; seasonally adjusted
- Financial (including asset-backed) domestic commercial paper outstanding; seasonally adjusted
- Financial (including asset-backed) foreign commercial paper outstanding; seasonally adjusted
- Total commercial paper outstanding
- Nonfinancial commercial paper outstanding
- Nonfinancial domestic commercial paper outstanding
- Nonfinancial foreign commercial paper outstanding
- Financial (including asset-backed) commercial paper outstanding
- Financial (including asset-backed) domestic commercial paper outstanding
- Financial (including asset-backed) domestic commercial paper outstanding, U.S. owned
- Financial (including asset-backed) domestic commercial paper outstanding, foreign bank parent
- Financial (including asset-backed) domestic commercial paper outstanding, foreign nonbank parent
- Financial (including asset-backed) foreign commercial paper outstanding
- Financial (including asset-backed) foreign commercial paper outstanding, bank or bank holding company
- Financial (including asset-backed) foreign commercial paper outstanding, other
- Asset-backed commercial paper outstanding
- L.O.C. (letter of credit)-backed commercial paper outstanding
- SEC rule 2a-7 tier-1 commercial paper outstanding
- SEC rule 2a-7 tier-2 commercial paper outstanding
- Directly placed nonfinancial commercial paper outstanding
- Directly placed financial commercial paper outstanding
RATES_OLD is data set with 12 Series
- Overnight directly placed financial commercial paper rate
- 7-day directly placed financial commercial paper rate
- 3 15-day directly placed financial commercial paper rate
- 4 30-day directly placed financial commercial paper rate
- 5 60-day directly placed financial commercial paper rate
- 6 90-day directly placed financial commercial paper rate
- 7 Overnight dealer placed AA commercial paper rate
- 7-day dealer placed AA commercial paper rate
- 15-day dealer placed AA commercial paper rate
- 30-day dealer placed AA commercial paper rate
- 60-day dealer placed AA commercial paper rate
- 90-day dealer placed AA commercial paper rate