[Quantproject-developers] QuantProject/b1_ADT/Timing Time.cs, 1.8, 1.9
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2009-02-05 23:16:47
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Timing In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4209/b1_ADT/Timing Modified Files: Time.cs Log Message: Added static method GetIntermediateTimes, in order to make easier writing code for intraday strategies Index: Time.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Timing/Time.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Time.cs 6 Jan 2009 17:32:40 -0000 1.8 --- Time.cs 5 Feb 2009 22:18:15 -0000 1.9 *************** *** 51,54 **** --- 51,75 ---- /// <summary> + /// Returns a list of all the daily times between the given times (firstTime and lastTime) + /// </summary> + /// <param name="firstTime">First time (it will be returned)</param> + /// <param name="lastTime">Last time (it will be returned)</param> + /// <param name="stepInMinutesForIntermediateTimes">Number of minutes between the intermediate + /// times that are to be returned</param> + /// <returns></returns> + public static List<Time> GetIntermediateTimes ( Time firstTime, Time lastTime, + int stepInMinutesForIntermediateTimes) + { + Time currentTimeToAdd = firstTime; + List<Time> returnValue = new List<Time>(); + while( currentTimeToAdd <= lastTime ) + { + returnValue.Add( currentTimeToAdd ); + currentTimeToAdd = currentTimeToAdd.AddMinutes( stepInMinutesForIntermediateTimes ); + } + return returnValue; + } + + /// <summary> /// Adds the given minutes to the current instance's value /// </summary> |