[R-SIG-Finance] Importing batch tickers from Bloomberg to R for Rblpapi use

Jason Hart jasonhart4 at icloud.com
Thu Apr 7 14:44:59 CEST 2016


Thanks for the response Nick.  I tried your suggestions and can't seem to get this to work.  I can pull in the tickers but the problem appears to be when it gets passed along to bdp where the tickers are not recognized. I pasted the tickers into excel and it starts in cell A1 and ends in A100.  Here's a small sample of what it looks like  




On Apr 06, 2016, at 08:17 PM, Nick White <n-e-w at qtradr.net> wrote:

Yes - this is very easy. 

Do you get the error message when you run the bdp command or when you try to run the read.csv command?

If it's after read.csv, can you supply an extract of the header row and​ the first row of tickers so we can see what your file looks like? How you read in a csv is largely a function of how you've set it up.

Alternatively, you could just paste in the result of

str(imp)

if the read.csv command succeeds.

The default behavior of read.csv is to convert strings to factors in a data frame. You want to preserve your tickers as characters, so typically you need to specify something like:

imp <- read.csv("xyz.csv", stringsAsFactors=FALSE, headers = TRUE)

otherwise your frame of tickers will be of type factor rather than string

assuming you have some structure in the csv like:

row 1: |ticker|
           --------
row 2  |SPY US Equity|
           --------

I suspect (though Dirk et al could confirm) that you're getting the 'expecting a string vector' error as you're not passing a character vector to bdp




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20160407/3b850486/attachment.html>


More information about the R-SIG-Finance mailing list