Message-ID: <2AFE63B1-4005-40CB-891F-E780DA1B357B@gmail.com>
Date: 2012-09-15T17:00:41Z
From: Jeff Ryan
Subject: Aggregating tick-by-tick data to seconds
In-Reply-To: <CABfqsR_kSE8RbKeq2jikAKBDWf87+PesV0oih2rF-=ku139ndg@mail.gmail.com>
?period.sum
HTH
Jeff
Jeffrey Ryan | Founder | jeffrey.ryan at lemnica.com
www.lemnica.com
On Sep 15, 2012, at 10:57 AM, Costas Vorlow <costas.vorlow at gmail.com> wrote:
> Hello,
>
> I have the following data (xts) (last two columns refer to up and down
> volumes).
>
>> head(test,20)
> [,1] [,2] [,3]
> 2012-09-12 16:30:00 144.39 300 0
> 2012-09-12 16:30:00 144.39 500 0
> 2012-09-12 16:30:00 144.39 300 0
> 2012-09-12 16:30:00 144.39 400 0
> 2012-09-12 16:30:00 144.39 300 0
> 2012-09-12 16:30:00 144.39 300 0
> 2012-09-12 16:30:00 144.39 100 0
> 2012-09-12 16:30:00 144.39 900 0
> 2012-09-12 16:30:00 144.39 200 0
> 2012-09-12 16:30:00 144.39 103 0
> 2012-09-12 16:30:00 144.39 197 0
> 2012-09-12 16:30:00 144.39 200 0
> 2012-09-12 16:30:00 144.39 500 0
> 2012-09-12 16:30:00 144.39 400 0
> 2012-09-12 16:30:00 144.39 100 0
> 2012-09-12 16:30:00 144.39 500 0
> 2012-09-12 16:30:00 144.39 300 0
> 2012-09-12 16:30:00 144.39 200 0
> 2012-09-12 16:30:00 144.39 103 0
> 2012-09-12 16:30:00 144.38 0 100
>
>
> I can use the to.period to aggregate the above data to seconds
>
> test.Open test.High test.Low test.Close
> 2012-09-12 16:30:00 144.39 144.47 144.37 144.38
> 2012-09-12 16:31:00 144.39 144.40 144.33 144.37
> 2012-09-12 16:32:00 144.37 144.45 144.37 144.45
> 2012-09-12 16:33:00 144.45 144.47 144.42 144.47
>
>
> but I am not sure how to do this for the volume columns. I would need to
> retrieve the volume sums per second.
>
> Is this functionality built into the xts package? Is there any other
> function that could be used to do something like that?
>
> Thanks & best regards,
> Costas
> _______________
>
> [[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.