Ivan Vanchev
Ivan Vanchev

Reputation: 111

Rblpapi - bdh function returns NULL with certain fields

Does bdh() only work with certain Bloomberg fields on Rblpapi? The following returns NULL:

library(Rblpapi)
blpConnect()
bdh("IBM US Equity", "RR906", start.date = Sys.Date()-22)

and so does using the mnemonic for the field:

bdh("IBM US Equity", "TRAIL_12M_EPS", start.date = Sys.Date()-22)

I can get the current value through bdp() but that's it. bdh() seems to be working fine for Real-time fields but not so for Static ones even though Bloomberg says historical values are available for those through the API.

Has anyone run into this problem? And more importantly, are there any solutions for this? Not sure if I'm missing something obvious.

EDIT: I figured out a solution. Using the following option returns the correct values:

bdh("IBM Equity", "TRAIL_12M_EPS", Sys.Date()-22, options = c("nonTradingDayFillOption"="ALL_CALENDAR_DAYS"))

Depending on user requirements the value of nonTradingDayFillOption can also be set to ACTIVE_DAYS_ONLY (returns only days when field value changes).

Upvotes: 0

Views: 1261

Answers (2)

Matias
Matias

Reputation: 1

Basically the error here is that you used "IBM Equity" where it should be "IBM US Equity" Best regards,

Upvotes: 0

Ivan Vanchev
Ivan Vanchev

Reputation: 111

Using the following option returns the correct values:

bdh("IBM Equity", "TRAIL_12M_EPS", Sys.Date()-22, options = c("nonTradingDayFillOption"="ALL_CALENDAR_DAYS"))

Depending on user requirements the value of nonTradingDayFillOption can also be set to ACTIVE_DAYS_ONLY (returns only days when field value changes).

Going through the full API documentation does help, I guess...

Upvotes: 0

Related Questions