[R-SIG-Finance] Accessing Bloomberg historic data for invalid codes with RBloomberg

gordon.morrison at hsbcib.com gordon.morrison at hsbcib.com
Mon Aug 15 17:19:38 CEST 2011


Can anyone shed any light into what I am doing wrong

> securities <- c("AMZN US Equity", "OCN US Equity", "123456 XX Equity")
> fields1 <- c("NAME", "PX_LAST", "TIME", "SETTLE_DT")
> fields2 <- "VOLUME"
> library(RBloomberg)
Loading required package: rJava
> conn <- blpConnect()
R version 2.13.1 (2011-07-08)
rJava Version 0.8-8
RBloomberg Version 0.4-149
Java environment initialized successfully.
Looking for most recent blpapi3.jar file...
Adding C:\blp\API\APIv3\JavaAPI\v3.4.3.2\lib\blpapi3.jar to Java classpath
Bloomberg API Version 3.4.3.2

> bdp(conn, securities, fields1)
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  :
  org.findata.blpwrapper.WrapperException: invalid security 123456 XX
Equity

> bdp(conn, securities[1:2], fields1)
                               NAME PX_LAST     TIME  SETTLE_DT
AMZN US Equity       AMAZON.COM INC  202.30 15:49:42 2011-08-18
OCN US Equity  OCWEN FINANCIAL CORP   13.03 15:49:43 2011-08-18

> bdh(conn, securities[1:2], fields2, "20110810", "20110814")
           ticker       date  VOLUME
1  AMZN US Equity 2011-08-10 8757585
2  AMZN US Equity 2011-08-11 7404618
3  AMZN US Equity 2011-08-12 5620580
4  AMZN US Equity 2011-08-13      NA
5  AMZN US Equity 2011-08-14      NA
6   OCN US Equity 2011-08-10 1874309
7   OCN US Equity 2011-08-11 1257872
8   OCN US Equity 2011-08-12 1430524
9   OCN US Equity 2011-08-13      NA
10  OCN US Equity 2011-08-14      NA

> bdh(conn, securities, fields2, "20110810", "20110814")
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  :
  org.findata.blpwrapper.WrapperException: invalid security 123456 XX
Equity

> blpDisconnect(conn)
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 241304  6.5     407500 10.9   350000  9.4
Vcells 124164  1.0     786432  6.0   458087  3.5

> conn <- blpConnect(throw.ticker.errors = FALSE)
R version 2.13.1 (2011-07-08)
rJava Version 0.8-8
RBloomberg Version 0.4-149
Java environment initialized successfully.
Looking for most recent blpapi3.jar file...
Adding C:\blp\API\APIv3\JavaAPI\v3.4.3.2\lib\blpapi3.jar to Java classpath
Bloomberg API Version 3.4.3.2

> bdp(conn, securities[1:2], fields1)
                               NAME PX_LAST     TIME  SETTLE_DT
AMZN US Equity       AMAZON.COM INC  202.42 15:51:52 2011-08-18
OCN US Equity  OCWEN FINANCIAL CORP   13.03 15:51:30 2011-08-18

> bdp(conn, securities, fields1)
                                 NAME PX_LAST     TIME  SETTLE_DT
AMZN US Equity         AMAZON.COM INC  202.42 15:52:02 2011-08-18
OCN US Equity    OCWEN FINANCIAL CORP   13.03 15:51:30 2011-08-18
123456 XX Equity                 <NA>      NA     <NA>       <NA>

> bdh(conn, securities[1:2], fields2, "20110810", "20110814")
           ticker       date  VOLUME
1  AMZN US Equity 2011-08-10 8757585
2  AMZN US Equity 2011-08-11 7404618
3  AMZN US Equity 2011-08-12 5620580
4  AMZN US Equity 2011-08-13      NA
5  AMZN US Equity 2011-08-14      NA
6   OCN US Equity 2011-08-10 1874309
7   OCN US Equity 2011-08-11 1257872
8   OCN US Equity 2011-08-12 1430524
9   OCN US Equity 2011-08-13      NA
10  OCN US Equity 2011-08-14      NA

> bdh(conn, securities, fields2, "20110810", "20110814")
Error in rep(security, dim(matrix.data)[1]) : invalid 'times' argument
>

I was expecting the last call to return NAs for the invalid security rather
than an error.

Regards


Gordon M Morrison

************************************************************
HSBC Bank plc may be solicited in the course of its placement efforts for a
new issue, by investment clients of the firm for whom the Bank as a firm
already provides other services. It may equally decide to allocate to its
own proprietary book or with an associate of HSBC Group. This represents a
potential conflict of interest. HSBC Bank plc has internal arrangements
designed to ensure that the firm would give unbiased and full advice to the
corporate finance client about the valuation and pricing of the offering as
well as internal systems, controls and procedures to identify and manage
conflicts of interest.

HSBC Bank plc
Registered Office: 8 Canada Square, London E14 5HQ, United Kingdom
Registered in England - Number 14259
Authorised and regulated by the Financial Services Authority.
************************************************************

-----------------------------------------
SAVE PAPER - THINK BEFORE YOU PRINT!

This transmission has been issued by a member of the HSBC Group
"HSBC" for the information of the addressee only and should not be
reproduced and/or distributed to any other person. Each page
attached hereto must be read in conjunction with any disclaimer
which forms part of it. Unless otherwise stated, this transmission
is neither an offer nor the solicitation of an offer to sell or
purchase any investment. Its contents are based on information
obtained from sources believed to be reliable but HSBC makes no
representation and accepts no responsibility or liability as to its
completeness or accuracy.



More information about the R-SIG-Finance mailing list