Dear R Folks, I know that Enrique Bengoechea ( Credit Suisse ) had posted some code snippets for importing Bloomberg historical data into R. I found them to be very useful. Has anyone succeeded in getting the below items from Bloomberg to R? (a) historical economic release data, (b) tick/intra-day data (c) bulk data such as Index membership info, etc. If someone is willing to share their code to get Bloomberg data into R, that would be extremely appreciated. Regards, Prasad
Prasad, Chalasani, Prasad <prasad.chalasani <at> gs.com> writes:> I know that Enrique Bengoechea ( Credit Suisse ) had posted some code > snippets for importing Bloomberg historical data into R. > I found them to be very useful. > > Has anyone succeeded in getting the below items > from Bloomberg to R? > (a) historical economic release data, > (b) tick/intra-day data > (c) bulk data such as Index membership info, etc.Yes, I have a package that can do all of the above. See the presentation at http://dirk.eddelbuettel.com/papers/r_lim_bloomberg.pdf> If someone is willing to share their code > to get Bloomberg data into R, that would be > extremely appreciated.Unfortunately the code belongs to my (former) employer and cannot be shared. That said, with a modicum of effort and knowledge of C programming, you can replicate the package based on a) the excellent Bloomberg C Api documentation and examples, and b) the 'Writing R Extensions' manual, as well as your choice among the 500+ packages on CRAN for concrete C linkage examples. May be worthwhile discussing with your IT group. Regards, Dirk
Dirk, Yes I am aware of your presentation. Seems to me your approach is different from the one of Enrique Bengoechea: you use the C API, whereas he uses the bloomberg ActiveX/COM API ( which requires the RDCOMClient package from OmegaHat -- it doesn't work with R2001, so I actually downloaded Thomas Baier's build of that package ). 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. -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Dirk Eddelbuettel Sent: Thursday, March 24, 2005 2:24 PM To: r-help at stat.math.ethz.ch Subject: Re: [R] Bloomberg data import Prasad, Chalasani, Prasad <prasad.chalasani <at> gs.com> writes:> I know that Enrique Bengoechea ( Credit Suisse ) had posted some code > snippets for importing Bloomberg historical data into R. I found them > to be very useful. > > Has anyone succeeded in getting the below items > from Bloomberg to R? > (a) historical economic release data, > (b) tick/intra-day data > (c) bulk data such as Index membership info, etc.Yes, I have a package that can do all of the above. See the presentation at http://dirk.eddelbuettel.com/papers/r_lim_bloomberg.pdf> If someone is willing to share their code > to get Bloomberg data into R, that would be > extremely appreciated.Unfortunately the code belongs to my (former) employer and cannot be shared. That said, with a modicum of effort and knowledge of C programming, you can replicate the package based on a) the excellent Bloomberg C Api documentation and examples, and b) the 'Writing R Extensions' manual, as well as your choice among the 500+ packages on CRAN for concrete C linkage examples. May be worthwhile discussing with your IT group. Regards, Dirk ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Dirk, the URL for the working binary of RDCOMClient is at the bottom this page: http://tolstoy.newcastle.edu.au/R/help/04/11/6759.html it works with my R 2001. -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Dirk Eddelbuettel Sent: Thursday, March 24, 2005 3:00 PM To: r-help at stat.math.ethz.ch Subject: Re: [R] Bloomberg data import 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 ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Prasad, Chalasani, Prasad <prasad.chalasani <at> gs.com> writes:> the URL for the working binary of RDCOMClient is at the bottom this page: > http://tolstoy.newcastle.edu.au/R/help/04/11/6759.html > > it works with my R 2001.My bad -- I was looking for the Beier/Neuwirth one which seems to have disappeared. I knew about the Omegahat-based RDCOMClient, but tend to confuse them at times. Thanks for this pointer, though. Regards, Dirk
Pasad, I think GetHistoricalData might work for tick data. (At least it does from VB and VBA.) HTH, David L. Reiner p.s. Static data was mentioned, and that you get with Subscribe. -----Original Message----- From: Chalasani, Prasad [mailto:prasad.chalasani at gs.com] Sent: Thursday, March 24, 2005 3:10 PM To: r-help at stat.math.ethz.ch Subject: RE: [R] Bloomberg data import Dirk, the URL for the working binary of RDCOMClient is at the bottom this page: http://tolstoy.newcastle.edu.au/R/help/04/11/6759.html it works with my R 2001. -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Dirk Eddelbuettel Sent: Thursday, March 24, 2005 3:00 PM To: r-help at stat.math.ethz.ch Subject: Re: [R] Bloomberg data import 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 ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html