Site icon R-bloggers

Connect R to Bloomberg with the RBlpapi package

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

For anyone who works with financial data and has access to a Bloomberg terminal, there is a new R package to interface to Bloomberg data services: RBlpapi. (If you had searched for an R connection to Bloomberg you wouldn’t have found this one — Bloomberg is happy to have software that connects to its public API, but not to use its name, apparently.)

One of the authors, Dirk Eddelbuettel, gave a presentation at at the R/Finance conference last month (you can take a look at the slides here). Here are a few examples of the types of queries you can perform, which generate time series data objects in R:

bdp(c("ESA Index", "SPY US Equity"), c("PX_LAST", "VOLUME"))
bds("GOOG US Equity", "TOP_20_HOLDERS_PUBLIC_FILINGS")
bdh("SPY US Equity", c("PX_LAST", "VOLUME"), start.date=Sys.Date()-31)
getBars("ESA Index", startTime=ISOdatetime(2015,1,1,0,0,0))
getTicks("ESA Index", "TRADE", Sys.time()-60*60))
fieldSearch("VWAP")

The package is fast and lightweight (no Java required), and works well on Linux-based systems. Dirk reports that it's currently tricky to build on Windows, though: suggestions welcome in the comments or via the Github project linked below.

Github: RBlpapi, R Access to Bloomberg API

To leave a comment for the author, please follow the link and comment on their blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.