Rblp / Rblpapi

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

Use of Isin instead of Index? #311

Closed cnordenlow closed 4 years ago

cnordenlow commented 4 years ago

Hi, thanks for this great package. I may be fooling myself but I can't find a way to use Isin instead of Index? Is this possible? In the below example, to use "US912828ZQ64 ISIN" instead of "USGG10YR Index"?

us10 <- bdh(securities = "US912828ZQ64 ISIN", fields = "PX_LAST", start.date = as.Date("2020-03-01"))

Br, Chris

johnlaing commented 4 years ago

There are a couple of different things going on here. First, it's absolutely possible to use an ISIN; however the suffix refers to the security's yellow key (in this case Govt), not the identifier type. Try: bdp("US912828Q64 Govt", "PX_LAST")

Next, and this isn't specifically related to our package, there's an important difference in the two securities you're referring to. The index is Bloomberg's rolling series of 10-year yields, while the ISIN is a specific bond which happens to be the current 10-year note T 5/30. Using the index you can go very far back in time to retrieve historical yields, but if you're going to use bonds you'll have to stitch them together yourself. Specific to this example: bdh("US912828Q64 Govt", "PX_LAST", as.Date("2020-03-01")) will only return data beginning in May, when the bond was first issued.

cnordenlow commented 4 years ago

Ah perfect. Working fine with Govt instead of Isin.

And a great second point. Just took a date for the example but super that you are mentioning it.

/Chris

johnlaing commented 4 years ago

Great! Happy to help.