in reply to Recursive method to check overlap of many date ranges
I do not think that recursion is helpful here, though not impossible. First step seems to come up with a proper definition of average number of trades open at the same time (What time? How to deal with inactivity?).
Maybe you can just re-sample your data like so:
Update: Instead of the synchronous sampling method suggested above, count parallel trades asynchronously at open/close times (events) - including/excluding the opened/closed trade respectively. You might weight the count with its duration (relative to observation period) to get an average value. Here, duration of count might differ from duration of given trade since it is the time span between adjacent events.
Example:
Observation period: 10:10-11:15 = 65 (Minutes) = 260 15s-samples=Asynchronous Method= =Sampling Method= Time Action Count Duration Weight Count 15s-Samples ----------------------------------------------- ------------------- 10:10 open#1 1 2 2/65 1 8 10:12 open#2 2 3 3/65 2 12 10:15 open#3 3 3 3/65 3 12 10:18 close#2 2 8 8/65 2 32 10:26 close#3 1 49 49/65 1 196 11:15 close#1 0 - - - - ----------------------------------------------- -------------------
Seems, the asynchronous method is more efficient (same result, lesser computations).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Recursive method to check overlap of many date ranges
by bigbot (Beadle) on Sep 17, 2011 at 20:40 UTC |