Hi R-Finance Users,

I'm coding on GetData function from Bloomberg terminal for my need.
Here, I meet a problem on transformation for time data.

timedata is ZOO class from RBloomberg Lib

Now, I want transformation from ZOO class to timeSeries class, Rmetrics Lib. 

But, result is as below.


source("D:/R/RBloomberg.r")
tkrs <- c("DJA Index","SPX Index")
data <- RBGM(tkrs)
> head(data)
       GMT
                  PX_LAST.tmp PX_LAST.data
       0010-08-09       10666      1127.79
       0010-08-10       10618      1121.06
       0010-08-11       10337      1089.47
       0010-08-12       10271      1083.61
       0010-08-13       10266      1079.25
       0010-08-16       10273      1079.38

time date is changed to "0010-08-09".
time date should display at "2010-08-09"

It's weird ~~~ I don't know how to debug this function.
How to fix this mistakenly timeSeries object ? 



Here is my simple code

library(chron)
library(RBloomberg)
library(timeDate)
library(timeSeries)
library(fPortfolio)
library(fImport)

conn <- blpConnect()

RBGM <- function(tkrs , field="px_last", nDays=30) {

           tmp <- NULL;


           for(tkr in tkrs){

                if(is.null(tmp)){

                    data <- 
blpGetData(conn,tkr,field,start=as.chron(Sys.time()-86400*nDays));

                    tmp <- data
                 
                 } else{

                    data <- 
blpGetData(conn,tkr,field,start=as.chron(Sys.time()-86400*nDays));

                    tmp <- cbind(tmp,data);

                          }
                   
                   }
                   
                    tmp <- na.omit(tmp)
                    tmp <- as.timeSeries(tmp);
           
                    return(tmp);
 }

	[[alternative HTML version deleted]]

