I'm using Rblpapi's bdh formula to download Bloomberg time series data and trying to separate the date variable from the rest of the code in order to gain flexibility. I'm struggling, however, to get this working. My code looks as follows:
periods <- c("periodicitySelection"="MONTHLY") #set monthly periodicity
start <- c("start.date"=as.Date("1990-01-01")) #set start date
var1<-bdh("NAPMPMI Index","PX_LAST",start.date=start,options=periods) #download data var1
I get the error "Error in bdh_Impl(con, securities, fields, start.date, end.date, options, : not compatible with STRSXP"
What should my code look like in order to fix this?
Thanks & kind regards