Skip to content

sudden problem with RBloomberg

7 messages · Sergey Goriatchev, Ana Nelson

#
Hello everyone

I run R 2.10 (also, R 2.7.2) with RBloomberg 0.1-10
I cannot run new java-based RBloomberg due to local restrictions.

This morning I get a sudden problem with RBloomberg:

------------------------
Error: Exception occurred.
Warning message:
In as.matrix.BlpCOMReturn(x) : NAs introduced by coercion
Warning message:
In as.matrix.BlpCOMReturn(x) : NAs introduced by coercion
Warning message:
In as.matrix.BlpCOMReturn(x) : NAs introduced by coercion
---------------------------

I don't know what is going on, in particular the first "Error:
Exception occured" is new to me. I tried restart R, different versions
of R, feeding line by line, nothing helps.

Anyone has an inkling what the problem is caused by?

Best,
Sergey
#
Hi, Ana

Thank you for your help.
1) I have same RDCOMClient installed on 2.10 and on 2.7.2, the one
that is available on RDCOMClient web page (don't remember version
number and do not know how to find it out in R)
2) I cannot install this version of RBloomberg where I am at, due to
IT restrictions. I need to do it at home and then transport the whole
thing here (do not ask why). And I cannot install any Java.
3) The code has been running fine before. Surely, there were glitches
from time to time, especially when there were calls for a lot of data,
but on rerun the code eventually worked. Until today.
Today I get this exception no matter what I do, I restarted PC, I
restarted R, I ran different versions of R, I ran code line by line
(once it worked, but then it started throwing off errors again). That
is really strange.
4) With contract sizes I can simply set values by hand, without calls
to Bloomberg, but I wanted it all connected to Bloomberg.
5) I cannot live without zoo objects. There is a lot of code and it
all is written around zoo objects.

I will try manually some more and see if I can find some acceptable
solution, but the code worked fine till today...

Kind Regards,
Sergey
On Tue, Apr 13, 2010 at 10:44, Ana Nelson <nelson.ana at gmail.com> wrote:

  
    
#
I wanted also to add that the errors come up in the beginning of a
long script, it is second call to Bloomberg.
After this call there are numerous other calls where more data and
more diverse data is called from Bloomberg, including contract sizes.
These calls perform without errors.
Ain't that funny?

Best,
Sergey
On Tue, Apr 13, 2010 at 10:44, Ana Nelson <nelson.ana at gmail.com> wrote:

  
    
#
#Here are two examples of calls

#The first one is the one that throws errors:

#-------------------------------------------
start.date 	<- as.chron("2006-01-01")
end.date	<- as.chron(Sys.Date())

.tickers <- c("TY1 Comdty", "SP1 Index", "SPGSCIP Index", "GC1 Comdty")

conn <- blpConnect(show.days="week", na.action="previous.days",
periodicity="daily")
bldata <- blpGetData(conn, .tickers, "PX_LAST", start=start.date,
end=end.date, retval="zoo")

conn <- blpConnect(show.days="trading", na.action="previous.days",
periodicity="daily")
ty1.csize <- blpGetData(conn,  "TY1 Comdty", "FUT_CONT_SIZE",
retval="raw")[[1]][[1]] #USD
gc1.cvalue <- blpGetData(conn, "GC1 Comdty", "CONTRACT_VALUE",
start=as.chron(Sys.Date()-5), end=as.chron(Sys.Date()), retval="zoo")
gi1.cvalue <- blpGetData(conn, "GI1 Index",  "CONTRACT_VALUE",
start=as.chron(Sys.Date()-5), end=as.chron(Sys.Date()), retval="zoo")
es1.cvalue <- blpGetData(conn, "ES1 Index",  "CONTRACT_VALUE",
start=as.chron(Sys.Date()-5), end=as.chron(Sys.Date()), retval="zoo")
blpDisconnect(conn)
#------------------------------------------------

#The second one is very much further in the same script file and it works fine:

start.date 	<- as.chron("2008-01-01")
end.date 	<- as.chron( Sys.Date() )

.tickers <- c("TY1 Comdty", "RX1 Comdty", "JB1 Comdty")

conn <- blpConnect(show.days="week", na.action="previous.days",
periodicity="daily")
bond.futures <- blpGetData(conn, .tickers, "PX_LAST",
start=start.date, end=end.date, retval="zoo")

TY1.csize <- blpGetData(conn, "TY1 Comdty", "FUT_CONT_SIZE",
retval="raw")[[1]][[1]] #USD
RX1.csize <- blpGetData(conn, "RX1 Comdty", "FUT_CONT_SIZE",
retval="raw")[[1]][[1]] #EUR
JB1.csize <- blpGetData(conn, "JB1 Comdty", "FUT_CONT_SIZE",
retval="raw")[[1]][[1]] #JPY
blpDisconnect(conn)

#If I run the second one before the first one - the first one runs
without problems.
#If I run the first one before the second one - I have Exception error
and other errors in first, but second runs perfect.
#
#I tried to shuffle the lines to the following:

start.date      <- as.chron("2006-01-01")
end.date        <- as.chron(Sys.Date())

.tickers <- c("TY1 Comdty", "SP1 Index", "SPGSCIP Index", "GC1 Comdty")

conn <- blpConnect(show.days="week", na.action="previous.days",
periodicity="daily")

bldata <- blpGetData(conn, .tickers, "PX_LAST", start=start.date,
end=end.date, retval="zoo")

ty1.csize <- blpGetData(conn,  "TY1 Comdty", "FUT_CONT_SIZE",
retval="raw")[[1]][[1]] #USD

conn <- blpConnect(show.days="trading", na.action="previous.days",
periodicity="daily")

gc1.cvalue <- blpGetData(conn, "GC1 Comdty", "CONTRACT_VALUE",
start=as.chron(Sys.Date()-5), end=as.chron(Sys.Date()), retval="zoo")

gi1.cvalue <- blpGetData(conn, "GI1 Index",  "CONTRACT_VALUE",
start=as.chron(Sys.Date()-5), end=as.chron(Sys.Date()), retval="zoo")

es1.cvalue <- blpGetData(conn, "ES1 Index",  "CONTRACT_VALUE",
start=as.chron(Sys.Date()-5), end=as.chron(Sys.Date()), retval="zoo")

blpDisconnect(conn)

#that runs without problems, so the problem is creating conns.
#
Sergey,

Please read this before you post to this list again:
http://www.catb.org/~esr/faqs/smart-questions.html

Please try adding blpDisconnect(conn) as below. And please check the
log file for error messages as I asked you to in my previous email.


conn <- blpConnect(show.days="week", na.action="previous.days",
periodicity="daily")
bldata <- blpGetData(conn, .tickers, "PX_LAST", start=start.date,
end=end.date, retval="zoo")
blpDisconnect(conn)

conn <- blpConnect(show.days="trading"
, na.action="previous.days",
periodicity="daily")


Regards,
Ana
On Tue, Apr 13, 2010 at 10:21 AM, Sergey Goriatchev <sergeyg at gmail.com> wrote: