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)
}
Run the code above in your browser using DataLab