Thanks Ana, that was very helpful. The following code works fine.
library(RBloomberg)
library(timeSeries)
conn <- blpConnect()
spx <- blpGetData(conn, "SPX Index", c("PX_LAST"),
start=as.chron(Sys.time()-86400*20), show.days="trading")
as.timeSeries(data.frame(as.timeDate(as.POSIXct(index(spx))),coredata(spx)))


On Wed, Jul 8, 2009 at 10:37 AM, Ana Nelson <nelson.ana@gmail.com> wrote:

> I haven't worked with timeDate before, but here are 2 suggestions you could
> try:
> * convert your dates to POSIXct, then timeDate via as.timeDate.POSIXct
> * convert your dates to string, then timeDate via strptimeDate
>
>
> On Wed, Jul 8, 2009 at 3:19 PM, Olivier Schmitt <olivier.schmitt@gmail.com
> > wrote:
>
>> Good morning everyone,
>> My name is Olivier, I work for the World Bank in Washington DC.
>>
>> I am trying to use the timeSeries package to manipulate data that I get
>> from
>> RBloomberg. When I run the code below
>>
>> library(RBloomberg)
>> library(timeSeries)
>> conn <- blpConnect()
>> spx <- blpGetData(conn, "SPX Index", c("PX_LAST"),
>> start=as.chron(Sys.time()-86400*10), show.days="trading")
>> as.timeSeries(spx)
>>
>> I get
>>
>> GMT
>>           PX_LAST
>> 0009-06-29  927.23
>> 0009-06-30  919.32
>> 0009-07-01  923.33
>> 0009-07-02  896.42
>> 0009-07-03      NA
>> 0009-07-06  898.72
>> 0009-07-07  881.03
>> 0009-07-08  885.20
>>
>> > spx
>>         PX_LAST
>> 06/29/09  927.23
>> 06/30/09  919.32
>> 07/01/09  923.33
>> 07/02/09  896.42
>> 07/03/09      NA
>> 07/06/09  898.72
>> 07/07/09  881.03
>> 07/08/09  885.20
>>
>> So RBloomberg gets me the it seems I cannot get the full dates but when
>> converted into a timeSeries object, year 2009 becomes 0009. Does someone
>> know how to get the full date in timeSeries?
>>
>> Thanks
>>
>> Olivier
>>
>>        [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-SIG-Finance@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only.
>> -- If you want to post, subscribe first.
>>
>
>

	[[alternative HTML version deleted]]

