[R-SIG-Finance] [SPAM] - Re: subset section of trading day from RBloombergbar download - Email found in subject

David Reiner David.Reiner at xrtrading.com
Thu Jul 25 21:23:20 CEST 2013


Actually, the "T", while part of the standard, has to be specified in the format for as.POSIXct, or removed.
Then the xts command has to pass the core data and the index as POSIXct separately:

ftse.xts <- xts(ftse_Bars[,-1], as.POSIXct(sub("T"," ",ftse_Bars[,1])))

Then the subsetting can be done using Jeff's amazing datetime filtering:

ftse.sub <- ftse.xts["T07:00/T15:30"]

HTH,
David L. Reiner
XR Trading LLC

-----Original Message-----
From: r-sig-finance-bounces at r-project.org [mailto:r-sig-finance-bounces at r-project.org] On Behalf Of Brian Rowe
Sent: Thursday, July 25, 2013 2:05 PM
To: Tim Meggs
Cc: r-sig-finance at r-project.org
Subject: [SPAM] - Re: [R-SIG-Finance] subset section of trading day from RBloombergbar download - Email found in subject

That strange 'T' happens to be specified as part of the ISO 8601 date and time standard. As such it is compatible with as.POSIXlt and as.POSIXct.

> as.POSIXlt('2013-01-10T00:00:00.000')
[1] "2013-01-10"

https://en.wikipedia.org/wiki/ISO_8601


On Jul 25, 2013, at 2:40 PM, Tim Meggs <twmeggs at gmail.com> wrote:

> Hi R finance people,
>
> I have downloaded some 15-min price Bar data across a number of days from
> Bloomberg for the March13 FTSE futures.
>
> library(Rbbg)
> conn <- blpConnect()
> ftse <- "Z H3 Index"
> ftse_Bars <- bar(conn, ftse, "TRADE", "2013-01-04 07:00:00.000", "2013-02-01
> 20:00:00.000", "15")
> ftse_Bars<-as.xts(ftse_Bars)
> blpDisconnect(conn)
>
> The data looks like this:
>
>                                           time   open   high    low  close
> numEvents volume
> 2013-01-10T01:00:00.000 2013-01-10T01:00:00.000 6050.5 6050.5 6047.0 6048.0
> 12     12
> 2013-01-10T01:15:00.000 2013-01-10T01:15:00.000 6046.5 6047.5 6046.5 6047.5
> 2      2
> 2013-01-10T01:30:00.000 2013-01-10T01:30:00.000 6046.5 6046.5 6044.5 6045.0
> 12     21
> 2013-01-10T01:45:00.000 2013-01-10T01:45:00.000 6044.5 6045.5 6044.5 6045.5
> 6      9
> 2013-01-10T02:00:00.000 2013-01-10T02:00:00.000 6045.5 6049.0 6045.5 6047.5
> 11     13
> 2013-01-10T02:15:00.000 2013-01-10T02:15:00.000 6053.0 6059.0 6049.0 6058.0
> 37     68
>
> I would like to remove those bars that fall outside the hours 07:00 UTC to
> 15:30 UTC, to leave me with data just from the hours when the cash index is
> open.  Given the time column I receive from Bloomberg is in the slightly odd
> format format "%Y-%m-%dT%H:%M:%S" with the strange "T" in the middle how can
> subset out my desired data?
>
> Any help greatly appreciated.
>
> Thanks
> Tim
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/subset-section-of-trading-day-from-RBloomberg-bar-download-tp4672338.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> R-SIG-Finance at 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.


        [[alternative HTML version deleted]]

_______________________________________________
R-SIG-Finance at 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.



More information about the R-SIG-Finance mailing list