[R] Bloomberg data import

Dirk Eddelbuettel edd at debian.org
Thu Mar 24 21:00:01 CET 2005


Prasad,

Chalasani, Prasad <prasad.chalasani <at> gs.com> writes:
> I found that with Enrique's approach it's extremely easy to bang together 
> R code to grab historical *daily* data from Bloomberg.
> However when I tried to extend it to to grab Tick/Intraday data, 
> it didn't work. I did look at the Bloomberg ActiveX documentation on 
> my Bloomberg screen, and thought I followed their instructions, 
> e.g I do ( with slight modification of  Enrique's framework ):
> 
> dat <- '2005-03-22'
> from.t <- '10:00:00'
> to.t <- '11:00:00'
> # convert date + time to COM format.
> comFrom <- as.comDate.Date(as.Date(dat), from.t)
> comTo <- as.comDate.Date(as.Date(dat), to.t)
> histData <- try(blCon$BLPGetHistoricalData(Security='IBM US Equity',
> Fields="Last_Price",
>                         StartDate=comFrom, EndDate=comTo, BarSize=0));
> 
> The documentation says that I can get tick data by simply setting BarSize to
> 0,
> and using the appropriate field name -- I tried Last_Price, LAST_TRADE, etc
> but to no avail -- I keep getting some kind of exception.
> 
> If someone has any hints as to how to get Tick/Intraday data, that would be
> nice.

I don't use ActiveX, so take this with a grain of salt. 

Based on the names of functions in the older C interface, I would conjecture
that the BLPGetHistoricalData() function does not return intra-daily data.
So you may need to find different functions for the intraday data and for the 
static data you were seeking as well. May be worth a try -- report back here
or on R-SIG-Finance if you succeed.  In any event, whatever you want to put
together for R via (D)COM has to first work in plain VB, no?

Do you have a current URL for the (D)COM code?  I haven't found it ever since
they had to take their server down after it got attacked.

Cheers, Dirk




More information about the R-help mailing list