[R-SIG-Finance] HELP: Problem with RBloomberg blp intraday data

John Laing john.laing at gmail.com
Thu Dec 1 13:58:23 CET 2011


Michael,

This works in the current version of RBloomberg:

#############################################################
require(RBloomberg)
conn <- blpConnect()

ticker <- "AGS BB Equity"
start.time <- "2011-09-12 08:00:00.000"
end.time <- "2011-09-12 16:30:00.000"

trades.1 <- bar(conn, ticker, "TRADE", start.time, end.time, "1")
trades.510 <- bar(conn, ticker, "TRADE", start.time, end.time, "510")
sum(trades.1$numEvents) == sum(trades.510$numEvents) ## TRUE

bids.1 <- bar(conn, ticker, "BID", start.time, end.time, "1")
bids.510 <- bar(conn, ticker, "BID", start.time, end.time, "510")
sum(bids.1$numEvents) == sum(bids.510$numEvents) ## TRUE

asks.1 <- bar(conn, ticker, "ASK", start.time, end.time, "1")
asks.510 <- bar(conn, ticker, "ASK", start.time, end.time, "510")
sum(asks.1$numEvents) == sum(asks.510$numEvents) ## TRUE
#############################################################

If there are still problems or unexpected NAs after you upgrade, I'd
be happy to help.

Thanks,
John

On Tue, Nov 29, 2011 at 7:11 AM, Benjamin, Michael
<Michael.Benjamin at bernstein.com> wrote:
> John
>
> Thanks for looking into this for me.
>
> Details of what I am using is as follows:
>
> ============================================================
>> sessionInfo()
> R version 2.10.1 (2009-12-14)
> i386-pc-mingw32
>
> locale:
> [1] LC_COLLATE=English_United Kingdom.1252
> [2] LC_CTYPE=English_United Kingdom.1252
> [3] LC_MONETARY=English_United Kingdom.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United Kingdom.1252
>
> attached base packages:
> [1] grDevices datasets  stats     utils     graphics  methods   base
>
> other attached packages:
>  [1] RBloomberg_0.2-98
>  [3]
>  [5]
>  [7]
>  [9]
> [11]
>
> ============================================================
>
>
> I agree that what is being processed is pretty straightforward which is why it is strange that it works for some data and not for others despite using an old version of RBloomberg.  I will update my RBloomber soon, but out of curiosity, as the issue is not the "TRADE" ticks being returned over a time range (which works OK for me) but the "number of ticks" for bid or ask prices.
>
> Do you have any issues if you
>
>  increase the barsize to 510
>
> and
>
> request the total number of ticks for bid, ask and trade ticks for the same stock over the same time period?
>
>
> Best regards
>
> Michael
>
>
>
> -----Original Message-----
> From: John Laing [mailto:john.laing at gmail.com]
> Sent: 29 November 2011 00:23
> To: Benjamin, Michael
> Cc: r-sig-finance at r-project.org
> Subject: Re: [R-SIG-Finance] HELP: Problem with RBloomberg blp intraday data
>
> Michael,
>
> It is helpful if you provide information about the version of R and
> various packages that you are running. The sessionInfo() function is
> an excellent way to do that.
>
> The timeout argument to blpConnect was eliminated in early 2010, so I
> assume your version of RBloomberg is very old. There are now several
> recent threads on this list about how to upgrade and the dependencies
> involved. I recommend you read some of these.
>
> In the current RBloomberg what you're trying to do is pretty straightforward:
>
> library(RBloomberg)
> conn <- blpConnect()
> trades <- bar(conn, "AGS BB Equity", "TRADE", "2011-09-12
> 08:00:00.000", "2011-09-12 16:30:00.000", "1")
>
> Hope that helps,
> John
>
> On Thu, Nov 24, 2011 at 5:45 AM, Benjamin, Michael
> <Michael.Benjamin at bernstein.com> wrote:
>> Hello
>>
>> I am trying to download some intraday data, the number of ticks over a time range.  Packages installed are "package:RBloomberg" and "package:RDCOMClient".
>>
>> The data request is for the number of ticks over a date range using
>>
>> conn<-blpConnect(timeout=120000,show.days="week",na.action="na",periodicity="daily")
>> blp(conn, "AGS BB EQUITY",fields=c("LAST_PRICE"),start="2011-09-12 08:00",end="2011-09-12 16:30",barsize=510, barfields="NUMBER_TICKS")
>>
>> which returns the number 3574.  When passing the argument fields=c("BID") or fields=c("ASK") the number of bid or ask ticks returns <NA>.
>>
>> blp(conn, "AGS BB EQUITY",fields=c("BID"),start="2011-09-12 08:00",end="2011-09-12 16:30",barsize=510, barfields="NUMBER_TICKS")
>> blp(conn, "AGS BB EQUITY",fields=c("ASK"),start="2011-09-12 08:00",end="2011-09-12 16:30",barsize=510, barfields="NUMBER_TICKS")
>>
>> The issue is this is not consistent behavour with other stocks, for example, for EBS AV EQUITY the BID, ASK LAST_PRICE number of ticks is
>> 33800, 33800,2232
>>
>> Has anyone got any idea why this happens or if there is a way to resolve it?
>>
>> Best regards
>>
>> Michael
>>
>> ............................................................................
>>
>> Sanford C. Bernstein Limited (registered in England and Wales under company number 3760267) is authorised and regulated in the United Kingdom by the Financial Services Authority. The company has its registered office at 50 Berkeley Street, London W1J 8SB.
>>
>> Trading instructions sent electronically to Bernstein shall not be deemed accepted until a representative of Bernstein acknowledges receipt electronically or by telephone. Comments in this e-mail transmission and any attachments may form part of a larger body of investment analysis. For our research reports, which contain information that may be used to support investment decisions and disclosures see our website at www.bernsteinresearch.com.
>>
>> For further important information about AllianceBernstein please click here http://www.alliancebernstein.com/disclaimer/email/disclaimer.html
>>
>> Please note that as of 7 November, 2011 Sanford C. Bernstein Limited will be located at 50 Berkeley Street, London W1J 8SB.
>>
>>        [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-SIG-Finance at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions should go.
>>



More information about the R-SIG-Finance mailing list