[Quantproject-developers] QuantProject/b4_Business/a2_Strategies Benchmark.cs, 1.1, 1.2
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2008-02-06 22:53:59
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22045/a2_Strategies Modified Files: Benchmark.cs Log Message: Added GetEndOfDayHistory method. Index: Benchmark.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Benchmark.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Benchmark.cs 19 Jan 2008 17:33:45 -0000 1.1 --- Benchmark.cs 6 Feb 2008 22:53:54 -0000 1.2 *************** *** 99,102 **** --- 99,133 ---- } + /// <summary> + /// Returns the EndOfDayHistory of the benchmark + /// between the two given EndOfDayDateTimes + /// </summary> + public EndOfDayHistory GetEndOfDayHistory( + EndOfDayDateTime firstEndOfDayDateTime, + EndOfDayDateTime lastEndOfDayDateTime ) + { + if( lastEndOfDayDateTime.IsLessThanOrEqualTo(firstEndOfDayDateTime) ) + throw new Exception("lastEndOfDayDateTime has to be greater than " + + "firstEndOfDayDateTime !!"); + EndOfDayHistory endOfDayHistory = new EndOfDayHistory(); + EndOfDayDateTime endOfDayDateTimeToAddToHistory = + firstEndOfDayDateTime.Copy(); + while( endOfDayDateTimeToAddToHistory.IsLessThanOrEqualTo(lastEndOfDayDateTime) ) + { + if( this.isExchanged( endOfDayDateTimeToAddToHistory ) ) + { + endOfDayHistory.Add( endOfDayDateTimeToAddToHistory, endOfDayDateTimeToAddToHistory ); + endOfDayDateTimeToAddToHistory = + endOfDayDateTimeToAddToHistory.GetNextMarketStatusSwitch(); + } + else + { + endOfDayDateTimeToAddToHistory = + endOfDayDateTimeToAddToHistory.GetNextMarketStatusSwitch(); + } + } + return endOfDayHistory; + } + } } |