Closed kyleleedixon closed 3 years ago
can you pls run w/ verbose=TRUE and past the response here (just the relevant part).
can you pls run w/ verbose=TRUE and past the response here (just the relevant part).
I got the exact same response as before with both tries on PX_Close and Close.
~I don't have access to Bloomberg at the moment, but I am pretty certain that you should be using PX_LAST to get the close part of the bar.~
Actually, my mistake I conflated bdh/getbars. You should use the getBars
functionality for intraday bars. Pass in 240 as your interval size. In Excel, BDH does both.
please close the issue if @wmorgan85's suggestion resolves it.
~I don't have access to Bloomberg at the moment, but I am pretty certain that you should be using PX_LAST to get the close part of the bar.~
Actually, my mistake I conflated bdh/getbars. You should use the
getBars
functionality for intraday bars. Pass in 240 as your interval size. In Excel, BDH does both.
Ah, amazing thank you so much!
I tried running
Rblpapi::bdh("BGCI Index", "Close", start.date = base::as.Date("2020-01-01", "%Y-%m-%d"), end.date = base::Sys.time(), options = c("BarSz" = "240"))
and got the above error.I've verified that this works fine in Excel:
=BDH("BGCI Index","Close","2021-03-01","2021-03-08","BarSz=240")
I also tried changing it to
Rblpapi::bdh("BGCI Index", "PX_Close", start.date = base::as.Date("2020-01-01", "%Y-%m-%d"), end.date = base::Sys.time(), options = c("BarSz" = "240"))
and I got the following error:Error in bdh_Impl(con, securities, fields, start.date, end.date, options, : Sub-element '(null)' does not exist.