Rblp / Rblpapi

R package interfacing the Bloomberg API from https://www.bloomberglabs.com/api/
Other
166 stars 75 forks source link

Wrong output in the bdh formula #326

Closed calik97 closed 3 years ago

calik97 commented 3 years ago

That function instead of showing the Last Price of this security, shows the Yield. Do you know how to fix it?

bdh('EK783758 Corp', "PX_LAST", as.Date('2005-04-27'), as.Date('2021-03-29'))

eddelbuettel commented 3 years ago

If I recall correctly that is in fact a 'feature' of bonds. Check the docs, there are price-related fields available, try requesting one of those.

calik97 commented 3 years ago

Well, the issue is that if I choose a different Bond the output is fine. For instance: bdh('GB00BK5CVX03 Govt', "PX_LAST", as.Date('2005-04-27'), as.Date('2021-03-29'))

wmorgan85 commented 3 years ago

@eddelbuettel is correct. It looks like EK783758 is a JGB, which is probably yield quoted. I no longer have a terminal so cannot verify this.

The parameter to change is: image should be pricingOption=PRICING_OPTION_PRICE.

This is a legacy component of how bonds price, as opposed to how Bloomberg handles them.

calik97 commented 3 years ago

How could I access the documentation and change that parameter? I was struggling a lot and did not find a way to do it.

eddelbuettel commented 3 years ago

Bloomberg documentation is at their website. Our documentation has links.

Our code is documented here as well as in the package you installed to run. Try help(bdh) for a start, I am sure we have examples in different places on how to set options.

calik97 commented 3 years ago

Finally, it works. Thank you very much for your help. That made the trick:

bdh('EK783758 Corp', 'PX_LAST', as.Date('2005-04-27'), as.Date('2021-03-29'), 
    options = c("pricingOption"="PRICING_OPTION_PRICE"))