Skip to content
RDocumentation: bdh
Note that this notebook was automatically generated from an RDocumentation page. It depends on the package and the example code whether this code will run without errors. You may need to edit the code to make things work.
if(!require('Rblpapi')) {
install.packages('Rblpapi')
library('Rblpapi')
}if (FALSE) {
bdh("SPY US Equity", c("PX_LAST", "VOLUME"), start.date=Sys.Date()-31)
## example for an options field: request monthly data; see section A.2.4 of
## http://www.bloomberglabs.com/content/uploads/sites/2/2014/07/blpapi-developers-guide-2.54.pdf
## for more
opt <- c("periodicitySelection"="MONTHLY")
bdh("SPY US Equity", c("PX_LAST", "VOLUME"),
start.date=Sys.Date()-31*6, options=opt)
## example for non-date start
bdh("SPY US Equity", c("PX_LAST", "VOLUME"),
start.date="-6CM", options=opt)
## example for options and overrides
opt <- c("periodicitySelection"="QUARTERLY")
ovrd <- c("BEST_FPERIOD_OVERRIDE"="1GQ")
bdh("IBM US Equity", "BEST_SALES", start.date=Sys.Date()-365.25*4,
options=opt, overrides=ovrd)
## example for returnRelativeDate option
opt <- c(periodicitySelection="YEARLY", periodicityAdjustment="FISCAL", returnRelativeDate=TRUE)
bdh("GLB ID Equity", "CUR_MKT_CAP", as.Date("1997-12-31"), as.Date("2017-12-31"), options=opt)
}