[R-SIG-Finance] Time interval logic
Brian G. Peterson
brian at braverock.com
Wed Nov 9 14:33:36 CET 2011
Pleaee follow the posting guide and provide a reproducible example, as
it is, you ask others to re-do work that you have already done, greatly
increasing the time to help you finish your project.
On Wed, 2011-11-09 at 21:48 +1100, Manoj wrote:
> Hello,
> I am working on some tick-data and needed help computing the
> following statistics:
This is not tick data. it is one minute intraday observations.
> Assume the dataset to be an xts object of Price and Volume as shown below:
> -------
> Time Prc Vol CumVol Vol-Threshold Vol_Residual Time_Elapsed
> 10:01 24.01 20 20
> 10:02 24.05 200 220
> 10:03 23.99 120 340 300 40 3
> 10:04 24.02 125 465
> 10:05 24.01 99 564
> 10:06 24.02 231 795 300 195 4
> 10:07 23.99 1000 1795 300 895 2
This does not appear to be an xts object, where the index would not be
called 'Time', would contain a date, and would not be labeled at all.
> -------
>
> From the above trade data - I am interested in finding out the
> time taken to complete a certain volume threshold. The column in
> question from above data is the "Time_Elapsed" column. I have used 300
> shares as volume threshold in above example. Once the threshold is
> reached, the excess volume for the currently processed trade is
> allocated to next group. In example above - it takes 3 minutes to
> complete 1st volume threshold (20+200+80) leaving behind a residual of
> 40 shares for next group. The second and third volume thresholds are
> completed in 4 minutes and 2 minutes in the example above.
>
> What's the optimal way of speeding up the logic above?
More information about the R-SIG-Finance
mailing list