[R-SIG-Finance] [R-sig-finance] Aggregating tick by tick timeSeries [NC]
Jeff Ryan
jeff.a.ryan at gmail.com
Wed Mar 5 16:55:42 CET 2008
Anass,
I suspect you will have to write it yourself - as I haven't seen a
general implementation of that myself. If you go that route it would
be great if you could share your efforts with the list.
Jeff
On Wed, Mar 5, 2008 at 9:29 AM, <anass.mouhsine at sgcib.com> wrote:
> Thank you Jeff,
>
>
> my aim was to calculate standard statistics + volume weighted prices and
> spreads.
>
>
> I will try out the xts package, but I am wondering if it can aggregate
> Multivariate timeSeries (e.g, (spread, volume) or (price,volume)).
>
>
> thanks again
>
>
> |------------------------------
> | jeff.a.ryan at gmail
> | .com
> |
> | 03/05/2008 16:21
> |
>
>
> To
> Anass
> MOUHSINE/fr/socgen at socgen
> cc
> r-sig-finance at stat.math.eth
> z.ch
> Subject
> Re: [R-SIG-Finance]
> [R-sig-finance] Aggregating
> tick by tick timeSeries
> [C1]
>
>
>
>
>
>
>
>
>
>
> Anass,
>
> If you want the mean/sd/etc for each hour ?aggregate from zoo will do
> the job very well. To get there from timeSeries you can use the new
> 'xts' package:
>
> myTS [a timeSeries object]
>
> as.xts(myTS) [ now an 'xts' object - which inherits from zoo]
>
> --or--
>
> as.zoo(myTS)
>
> you can even put it back to a timeSeries with little information loss
> if you use xts via 'reclass' (changing the series outside of xts
> functions currently isn't perfect - but it is good)
>
> If you want to just aggregate the data into OHLC per time period -
> to.period in xts is fast and flexible:
>
> to.period(myTS,'minutes',15)
> to.period(myTS,'hours')
> to.monthly(myTS)
>
> All these work by converting and reconverting to an 'xts' class
> internally - so most any (including timeSeries) class will just work
> with the function. In addition it is all compiled code - so it works
> well.
>
> One caveat - you'll need to get the most recent xts from
> http://r-forge.r-project.org/projects/xts - as there was a minor bug
> in the transition of 'to.period' code from quantmod to xts.
>
> Jeff
>
> On Wed, Mar 5, 2008 at 8:21 AM, <anass.mouhsine at sgcib.com> wrote:
> >
> > Hi guys,
> >
> >
> > I have a timeSeries object like this one
> > V10
> > 2005-04-08 17:31:41 0.01
> > 2005-04-08 17:31:57 0.02
> > 2005-04-08 17:32:00 0.02
> > 2005-04-08 17:32:57 0.02
> > 2005-04-08 17:38:34 0.02
> > 2005-04-08 17:38:49 0.01
> >
> > and I would like to aggregate the timeSeries in hours or minutes in
> order
> > to apply whatever function on the aggregated data (e.g mean, standard
> dev,
> > etc...)
> > I have seen some aggreagation functions like aggregate in the fSeries
> > package but it aggregates only monthly or quaterly.
> > I am sure some of you guys were faced to this kind of issue.
> >
> > Could anyone give me some hints on how to solve my problem?
> >
> > thanks in advance
> >
> > Anass
> >
> *************************************************************************
> > This message and any attachments (the "message") are
> con...{{dropped:10}}
> >
> > _______________________________________________
> > R-SIG-Finance at 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.
> >
>
>
>
> --
> There's a way to do it better - find it.
> Thomas A. Edison
>
> *************************************************************************
> This message and any attachments (the "message") are confidential and intended solely for the addressee(s).
> Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration.
> Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or
> falsified.
> ************
> Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses
> destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout message electronique est susceptible d'alteration.
> La SOCIETE GENERALE et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie.
> *************************************************************************
>
--
There's a way to do it better - find it.
Thomas A. Edison
More information about the R-SIG-Finance
mailing list