[R-SIG-Finance] Intraday data with RBloomberg

Robert Sams robert at sanctumfi.com
Mon Jul 9 12:31:02 CEST 2007


Hi Ian,

I'm not aware of any delay in the intraday historical calls. For
example, I made this call at just before 11:07am London time:

 blpGetData(conn, "ERU9 COMDTY", "BEST_BID",
start=chron("7/9/7","11:05:00"), barsize=0)
                    BEST_BID
(07/09/07 11:05:18)    95.22
(07/09/07 11:05:33)    95.22
(07/09/07 11:05:33)    95.22
(07/09/07 11:05:36)    95.22
(07/09/07 11:05:43)    95.22
(07/09/07 11:05:44)    95.22
(07/09/07 11:05:46)    95.22
(07/09/07 11:05:47)    95.22
(07/09/07 11:05:51)    95.22
(07/09/07 11:06:11)    95.22
(07/09/07 11:06:13)    95.22
(07/09/07 11:06:15)    95.22
(07/09/07 11:06:15)    95.22
(07/09/07 11:06:23)    95.22
(07/09/07 11:06:23)    95.22
(07/09/07 11:06:34)    95.22
(07/09/07 11:06:42)    95.22
(07/09/07 11:06:42)    95.22
(07/09/07 11:06:47)    95.22
(07/09/07 11:06:48)    95.22
(07/09/07 11:06:57)    95.22
(07/09/07 11:06:58)    95.22
> 

Perhaps you need to enable your terminal for live feeds on the product
under question?

As for the integration of RBloomberg with a trading system.. I guess it
depends upon what you are trying to do. I wouldn't have thought that R
is the appropriate platform on which to build an algorithmic trading
program, but I would be very interested to hear about the successful
implementation of such a thing. 

For analysis, backtesting, etc I think the Bloomberg/R solution is
ideal. But for trade execution, I prefer using feeds from the platform I
use to trade (e.g., TradingTechnologies for futures trading, TradeWeb
for OTC). There are many such platforms on the market; as I don't trade
FX, I cannot give you any useful advice here. Just about all of them
provide at least a C API, so if you have R code that you want to use in
an algorithmic trading environment, I'm sure you can integrate it with
whatever platform you end up using.

FYI.. I will put a new version of RBloomberg on cran at some point this
week.

Robert
  

-----Original Message-----
From: Ian Seow [mailto:ianseow at gmail.com] 
Sent: 07 July 2007 01:11
To: Robert Sams
Cc: davidr at rhotrading.com; r-sig-finance at stat.math.ethz.ch
Subject: Re: [R-SIG-Finance] Intraday data with RBloomberg

Hi Robert, this definitely works for me! 'BEST_BID' worked like a charm,
thank you so much.

Another point of curiousity... I am currently trying to build a model in
R which uses bloomberg price feeds (minute data) to obtain buy/sell
orders and execute them via an electronic trading platform API. I've
done something similar successfully using daily data, but this is the
first time I'm doing this on an intraday basis. My main worry is in the
time lag I've been observing when getting the bloomberg feeds (this lag
is present, regardless of whether I'm using VBA or RBloomberg)...

Could anyone with similar experiences give me some advice? Or perhaps I
should rethink the system architecture altogether, or perhaps use
another price feed more suited for this purpose?

Regards
Ian Seow

On 7/6/07, Robert Sams <robert at sanctumfi.com> wrote:
> David,
>
> "sort of given up"? I'm disappointed in you ;)
>
> Let's look at Ian's original example.
>
>  blpGetData(conn,'USDJPY Curncy', c('BID'), 
> start=as.chron(Sys.time()-3600), barfields='OPEN', barsize=2)
>                     BID.OPEN
> (07/06/07 14:02:50)       NA
>
> Indeed, this doesn't seem right. A little more transparency:
>
> blpGetData(conn,'USDJPY Curncy', 'BID', 
> start=as.chron(Sys.time()-3600), barfields='OPEN', barsize=2, 
> retval="raw") [[1]] [[1]][[1]] [[1]][[1]][[1]] [[1]][[1]][[1]][[1]] An

> object of class "COMDate"
> [1] 39269.59
>
>
>
>
> [[2]]
> [[2]][[1]]
> [[2]][[1]][[1]]
> [[2]][[1]][[1]][[1]]
> [1] "#N/A History"
>
>
>
>
> attr(,"num.of.date.cols")
> [1] 1
> attr(,"class")
> [1] "BlpCOMReturn"
> attr(,"securities")
> [1] "USDJPY CURNCY"
> attr(,"fields")
> [1] "BID"
> attr(,"barfields")
> [1] "OPEN"
> >
>
> The existence of a "no available history" Bloomberg error in the 
> return value of the underlying COM method makes me think that this 
> isn't really an RBloomberg or RDCOMClient package error.
>
> It's always useful to experiment with different fields.. in a few 
> minutes I discovered this:
>
> blpGetData(conn,'USDJPY Curncy', 'BEST_BID', 
> start=as.chron(Sys.time()-3600), barfields='OPEN', barsize=2)
>                     BEST_BID.OPEN
> (07/06/07 12:07:00)       123.230
> (07/06/07 12:09:00)       123.230
> (07/06/07 12:11:00)       123.240
> (07/06/07 12:13:00)       123.230
> (07/06/07 12:15:00)       123.215
> (07/06/07 12:17:00)       123.230
> (07/06/07 12:19:00)       123.260
> (07/06/07 12:21:00)       123.250
> (07/06/07 12:23:00)       123.260
> (07/06/07 12:25:00)       123.270
> (07/06/07 12:27:00)       123.280
> (07/06/07 12:29:00)       123.320
> etc..
>
> Does this call work for you Ian?
>
> Now, I don't know why BID does not work but BEST_BID does, but it 
> seems to me that the answer lies on the Bloomberg API side of things 
> rather than with RBloomberg. But maybe I'm wrong. Can somebody send me

> a VBA snippet that shows a successful call to 
> GetHistoricalData(Security='USDJPY Curncy', Fields='BID', ... in that 
> language's binding of the COM interface? If so, it's worth looking
into.
>
>
> I haven't touched the RBloomberg code for well over a year but use it 
> every day in a trading environment without any problems. I will 
> however set aside some time over the next week to clean up the code 
> and incorporate any bug fixes or features that RBloombergers care to 
> submit, so please keep an eye on cran for an updated version(s).
>
> Cheers,
>
> Robert
>
>
>
>
>
> -----Original Message-----
> From: davidr at rhotrading.com [mailto:davidr at rhotrading.com]
> Sent: 05 July 2007 15:56
> To: Ian Seow
> Cc: r-sig-finance at stat.math.ethz.ch; Robert Sams
> Subject: RE: [SPAM] - Re: [R-SIG-Finance] Intraday data with 
> RBloomberg
> - Email found in subject
>
> I can verify similar behavior.
> I can get the data via VBA behind Excel.
> Between versions of Bloomberg and R and the difficulty I seem to have 
> getting RDCOMClient installed correctly, I have sort of given up on 
> this approach, unfortunately so, since it seems so useful. I pretty 
> much use VBA/Excel or C# to generate text files to read into R.
>
> David L. Reiner
> Rho Trading Securities, LLC
> 550 W. Jackson Blvd #1000
> Chicago, IL 60661-5704
>
> 312-244-4610 direct
> 312-244-4500 main
> 312-244-4501 fax
>
>
> -----Original Message-----
> From: Ian Seow [mailto:ianseow at gmail.com]
> Sent: Tuesday, July 03, 2007 6:53 PM
> To: David Reiner <davidr at rhotrading.com>
> Cc: r-sig-finance at stat.math.ethz.ch
> Subject: [SPAM] - Re: [R-SIG-Finance] Intraday data with RBloomberg - 
> Email found in subject
>
> Hi David, that doesn't seem to work either.
>
> In the example below, I cut and paste the example from ?blpGetData, 
> replacing only the security field with 'USDJPY Curncy'. Notice that 
> the example works great when we use 'ED1 Comdty'. Also, when I try the

> historical data example, it works great for USDJPY Curncy daily
prices.
> I'm totally stumped.
>
>
> > edc=blpGetData(conn,'USDJPY Curncy', c('BID','ASK'),
> start=as.chron(Sys.time()-3600), barfields='OPEN', barsize=2)
>
> > edc
>                     BID.OPEN ASK.OPEN
> (07/04/07 07:46:10)       NA       NA
>
> > edc=blpGetData(conn,'ED1 Comdty', c('BID','ASK'),
> start=as.chron(Sys.time()-3600), barfields='OPEN', barsize=2)
> > edc
>                     BID.OPEN ASK.OPEN
> (07/03/07 22:38:00)   94.660   94.665
> (07/03/07 22:40:00)   94.660   94.665
> (07/03/07 22:42:00)   94.660   94.665
> (07/03/07 22:44:00)   94.660   94.665
> (07/03/07 22:46:00)   94.660   94.665
> (07/03/07 22:48:00)   94.660   94.665
> (07/03/07 22:50:00)   94.660   94.665
> (07/03/07 22:52:00)   94.660   94.665
> (07/03/07 22:54:00)   94.660   94.665
> (07/03/07 22:56:00)   94.660   94.665
> (07/03/07 22:58:00)   94.660   94.665
> etc....
>
>
>
> On 7/3/07, davidr at rhotrading.com <davidr at rhotrading.com> wrote:
> > Almost there! You just have to set the barfields; see the example at
> the
> > end of ?blpGetData.
> > HTH,
> >
> > David L. Reiner
> > Rho Trading Securities, LLC
> > 550 W. Jackson Blvd #1000
> > Chicago, IL 60661-5704
> >
> > 312-244-4610 direct
> > 312-244-4500 main
> > 312-244-4501 fax
> >
> >
> > -----Original Message-----
> > From: r-sig-finance-bounces at stat.math.ethz.ch
> > [mailto:r-sig-finance-bounces at stat.math.ethz.ch] On Behalf Of Ian 
> > Seow
> > Sent: Tuesday, July 03, 2007 2:25 AM
> > To: r-sig-finance at stat.math.ethz.ch
> > Subject: [R-SIG-Finance] Intraday data with RBloomberg
> >
> > Hi, I'm currently trying to implement an intraday currency model 
> > using
>
> > a live feed from bloomberg.
> > I hit the following error when I attempt to download intraday 2 min
> > ticks:
> >
> > > usdjpy=blpGetData(conn,securities='USDJPY
> > Curncy',fields=c('BID','ASK'), start= as.chron(Sys.time()-6000), 
> > end=as.chron(Sys.time()),barsize=2, barfields='OPEN')
> >
> > > usdjpy
> >                     BID.OPEN ASK.OPEN
> > (07/03/07 15:01:45)       NA       NA
> >
> > blpGetData works fine for historical price data and seems to work 
> > fine
>
> > for commodity futures ( e.g. the example above works fine for ED1 
> > Comdty), so I'm puzzled why this function does not return a result 
> > for
>
> > Curncy. I double-checked the "USDJPY Curncy" intraday bloomberg API 
> > feed in excel and it works.
> >
> > Also, is it a good idea in general to avoid implementing such models

> > in R?  Would C/C++ be a better alternative?
> > Any ideas / insights would be greatly appreciated! Thanks.
> >
> >
> > Best Regards
> > Ian Seow
> >
> > _______________________________________________
> > R-SIG-Finance at 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.
> >
>



More information about the R-SIG-Finance mailing list