new<-xts(bid[,3:4],order.by=strptime(x=bid$time,format="%Y-%m-%dT%H:%M:%OS")-4*3600)
should work for you (until DST ends.) Note that bid$time was already character. Always look to see what you are getting back. Also, it's considered polite to give the commands you used to get your results so helpers are encouraged to help. -- David -----Original Message----- From: r-sig-finance-boun...@r-project.org [mailto:r-sig-finance-boun...@r-project.org] On Behalf Of Nikos Rachmanis Sent: Tuesday, May 21, 2013 12:34 AM To: r-sig-finance@r-project.org Subject: [SPAM] - [R-SIG-Finance] Rbbg(Bloomberg) time zone problem and xtsconstructor - Email found in subject Hi all, I have come across the following time zone problem and I would appreciate your input. I am trying to download tick data using the Rbloomberg and I have found out that the query should be done in "UTC" time zone. My current zone is "EST" so i have written the code below to transform it from "EST" to "UTC" and works fine however the output i get is indicated in "UTC" as listed below for my query (instead of 10:00:00.000). time type value size 1 2013-05-13T14:00:00.000 ASK_BEST 454.87 1 2 2013-05-13T14:00:00.000 TRADE 454.58 100 3 2013-05-13T14:00:00.000 ASK_BEST 454.78 10 4 2013-05-13T14:00:00.000 ASK_BEST 454.7 1 5 2013-05-13T14:00:00.000 TRADE 454.58 100 6 2013-05-13T14:00:00.000 ASK_BEST 454.7 1 7 2013-05-13T14:00:01.000 ASK_BEST 454.69 1 My questions are the the following: 1) Is there a way I could write the timezone transformation and get the correct timing or would I have to change after I download? 2) I have tried to use the xts constructor with the following command but was not successful. Any idea how to separate the "T" in the time? new<-xts(bid[,3:4],order.by=strptime(x=as.character(bid$time),format="%Y-%m-%d %H:%M:%OS",tz="EST")) Thank you all, Nikos #Rbloomberg Code # Special options options(warn=-1) options(digits.secs = 3) options(java.parameters = "-Xmx1000m") # Import libraries library(RODBC) library(Rbbg) #set time interval (transforms from 10:00:00.001 to 14:00:00.001) start_time<-toString(format(as.POSIXct("2013-05-13 10:00:00.001", tz="EST5EDT"), tz="UTC")) end_time<-toString(format(as.POSIXct("2013-05-13 10:15:00.001", tz="EST5EDT"), tz="UTC")) # Connect to Bloomberg API conn <- blpConnect(log.level = "finest") #Download command data <- tick(conn, "AAPL US Equity", c("TRADE","BID_BEST","ASK_BEST"), start_date_time=start_time, end_date_time=end_time) [[alternative HTML version deleted]] _______________________________________________ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. This e-mail and any materials attached hereto, including, without limitation, all content hereof and thereof (collectively, "XR Content") are confidential and proprietary to XR Trading, LLC ("XR") and/or its affiliates, and are protected by intellectual property laws. Without the prior written consent of XR, the XR Content may not (i) be disclosed to any third party or (ii) be reproduced or otherwise used by anyone other than current employees of XR or its affiliates, on behalf of XR or its affiliates. THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY KIND. TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE. _______________________________________________ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.