[R-SIG-Finance] sudden problem with RBloomberg

Sergey Goriatchev sergeyg at gmail.com
Tue Apr 13 11:53:52 CEST 2010


#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.



More information about the R-SIG-Finance mailing list