Here is an example of how to do this using RBloomberg:

http://dpaste.de/FYwc/

I've removed some irrelevant bits from that code so it might not run as-is,
but it gives you an idea. You need to define equities and fields, obviously.

You might also experiment with iterating over fields in batches if you have
a lot of those, and using cbind() to aggregate everything.




On Thu, Jul 9, 2009 at 11:25 AM, Bengoechea Bartolomé Enrique (SIES 73) <
enrique.bengoechea@credit-suisse.com> wrote:

> Hi,
>
> One thing I do when requesting much data from Bloomberg is to split it into
> "lots": instead of a big request, several smaller requests that are then
> aggregated in R. I've found that big requests tend to fail, and that
> individual requests (say, ticker-per-ticker) tend to be too slow. Somewhere
> in-between provides the best solution to me. I have this built-in into my
> own library to access Bloomberg, with user-definable lot size. Don't know
> whether such a feature is available in RBloomberg.
>
> Enrique
>
> ------------------------------
>
> Message: 2
> Date: Wed, 8 Jul 2009 13:37:39 +0200
> From: Sergey Goriatchev <sergeyg@gmail.com>
> Subject: Re: [R-SIG-Finance] RBloomberg warning message
> To: nelson.ana@gmail.com, r-sig-finance@stat.math.ethz.ch
> Message-ID:
>        <7cb007bd0907080437o7d98613cm62f7ab0a059a2c7f@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi, Ana,
>
> Thank you for answering.
> In each load I download only numerical data (prices), I am not combining
> different types of data.
> I use retval="zoo", because I find it most useful for my purposes.
> Moreover, I've tried "data.frame" before and there were problems with this
> setting for retval.
> I cannot provide an example script, firstly because it is proprietary,
> secondly, because it is very long, and thirdly, because providing something
> illustrative is difficult as the problem pops up in different places (I call
> blpGetData many times in the script and at different places) or not at all
> sometimes!
>
> Since I load daily data for last 5 years and for up to 30 instruments
> sometimes, I think the load size may be responsible. But then only partly,
> because the same problem pops up when I load 4 years of daily data for just
> one ticker. Also the problem does not always pop up when I load data for 30
> tickers at the same time.
>
> Maybe it is some kind of function overload? Before I used to connect at the
> beginning of the script, get some data, process it, output results, get some
> more data, etc... without disconnecting after each data retreival call. From
> today I connect-retreive-disconnect-process-connect-...
>
> Basically, I am not sure why the problem pops up from time to time.
>
> Kind Regards,
> Sergey
>
>
>
>
>
> Hi, Sergey,
> A matrix can only handle 1 kind of data. Everything has to be a numeric, or
> everything has to be a string. Are you trying to combine different types of
> data?
> It might be better to try retval="data.frame".
> Otherwise, can you provide an example script which reproduces the problem?
> Regards,
> Ana
>
> On Tue, Jul 7, 2009 at 3:55 PM, Sergey Goriatchev <sergeyg@gmail.com>
> wrote:
> > Hello, everyone
> >
> > I have this very long script, where I call blpGetData many times (I
> > get some data, I do some computations, I output results in and Excel
> > file, I call some other data....)
> >
> > As the code grew, I started to get the same warning message more and
> > more
> > often:
> >
> > "Warning message:
> > In as.matrix.BlpCOMReturn(x) NAs are introduced by coersion"
> >
> > Basically, blpGetData sometimes does not work!
> >
> > This message comes up in different parts of the code (in different
> > calls to blpGetData), and since script is very long and runs
> > considerable amount of time, one such error completely messes up the
> > end results.
> >
> > Does anyone know why blpGetData sometimes fails to execute?
> >
> > Thanks in advance for help!
> >
> > Best,
> > Sergey
>
>
>
> --
> I'm not young enough to know everything. /Oscar Wilde Experience is one
> thing you can't get for nothing. /Oscar Wilde When you are finished
> changing, you're finished. /Benjamin Franklin Tell me and I forget, teach me
> and I remember, involve me and I learn.
> /Benjamin Franklin
> Luck is where preparation meets opportunity. /George Patten
>
> _______________________________________________
> R-SIG-Finance@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>

	[[alternative HTML version deleted]]

