R programming language resources › Forums › Data manipulation › Dividing tick-data into 5 min intervals
- This topic has 1 reply, 2 voices, and was last updated 12 years, 11 months ago by
bryan.
- AuthorPosts
- May 8, 2012 at 9:29 pm #491
oswi3605
MemberHello,
Im currently writing my bachelor thesis in statistical finance and i have run into a small problem. I want to evaluate forcasts from my GARCH with realized intraday volatility. The intraday data is Tick-data over a certain period. The date column is presented as for example 2011-11-01 09:24:41 for different points in time. The other column is with the stock prices at that same time. What I want to do is to recieve the end courses of certain time intervals. For example i want to know what the closing course if for every five minute or ten minute interval in the sample. In other words, i want to transform the tick-data into k-minute-interval data.
I have been trying to this in the following way:
The data has been converted to a time serie and look likes:
price
2011-11-01 08:00:00 0.000000000
2011-11-01 08:00:00 0.000000000
2011-11-01 08:02:00 0.000000000
2011-11-01 08:03:00 -0.017033339
2011-11-01 08:24:00 0.000000000
2011-11-01 08:24:00 0.000000000
2011-11-01 08:29:00 0.000000000
2011-11-01 08:29:00 0.000000000
2011-11-01 08:29:00 0.000000000
2011-11-01 08:29:00 0.000000000
2011-11-01 08:29:00 0.002166062
2011-11-01 08:44:00 0.000000000
2011-11-01 08:44:00 -0.002166062
2011-11-01 08:44:00 0.004321374
2011-11-01 10:36:00 0.010618976
2011-11-01 15:59:00 0.002092990
2011-11-01 16:21:00 0.000000000
2011-11-01 16:30:00 0.004155960
2011-11-02 08:00:00 0.000000000
2011-11-02 11:50:00 0.000000000
2011-11-02 13:38:00 -0.002073009and so on for 108 days (this stock is a small cap company, and therefore the infrequent trading)…
May 17, 2012 at 9:30 pm #493bryan
ParticipantThe quantmod package will let you do that and, as an added benefit, it will do it quickly.
The to.period function is what you’ll need. If you have any trouble figuring it out, just post again with the specific error or issue you’re having.
- AuthorPosts
- You must be logged in to reply to this topic.