Dividing tick-data into 5 min intervals

R programming language resources Forums Data manipulation Dividing tick-data into 5 min intervals

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #491
    oswi3605
    Member

    Hello,

    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.002073009

    and so on for 108 days (this stock is a small cap company, and therefore the infrequent trading)…

    #493
    bryan
    Participant

    The 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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Scroll to top
Privacy Policy