[Quantproject-developers] QuantProject/b4_Business/a2_Strategies EndOfDayStrategyBackTester.cs, 1.8
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2008-03-19 23:21:38
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12614/b4_Business/a2_Strategies Modified Files: EndOfDayStrategyBackTester.cs Log Message: - the property public DateTime FirstDateTime has been added - constructor's parameters are checked now (proper exceptions are risen if parameters don't comply to some requirements) Index: EndOfDayStrategyBackTester.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/EndOfDayStrategyBackTester.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** EndOfDayStrategyBackTester.cs 13 Mar 2008 19:36:26 -0000 1.8 --- EndOfDayStrategyBackTester.cs 19 Mar 2008 23:21:33 -0000 1.9 *************** *** 69,73 **** } /// <summary> ! /// Returns the dimulated DateTime when the backtest is stopped /// (not the real time) /// </summary> --- 69,84 ---- } /// <summary> ! /// Returns the simulated DateTime when the backtest is started ! /// (not the real time) ! /// </summary> ! public DateTime FirstDateTime ! { ! get ! { ! return this.firstDateTime; ! } ! } ! /// <summary> ! /// Returns the simulated DateTime when the backtest is stopped /// (not the real time) /// </summary> *************** *** 149,152 **** --- 160,171 ---- double maxRunningHours ) { + this.endOfDayStrategyBackTester_checkParameters( + endOfDayStrategy , + historicalQuoteProvider , + accountProvider, + firstDateTime , lastDateTime , + benchmark , + cashToStart , + maxRunningHours ); this.backTestID = backTestID; this.endOfDayStrategy = endOfDayStrategy; *************** *** 168,171 **** --- 187,212 ---- this.realDateTimeWhenTheBackTestIsStopped = DateTime.MinValue; } + private void endOfDayStrategyBackTester_checkParameters( + IEndOfDayStrategyForBacktester endOfDayStrategy , + IHistoricalQuoteProvider historicalQuoteProvider , + IAccountProvider accountProvider, + DateTime firstDateTime , DateTime lastDateTime , + Benchmark benchmark , + double cashToStart , + double maxRunningHours ) + { + if ( endOfDayStrategy == null ) + throw new Exception( "endOfDayStrategy cannot be null!" ); + if ( historicalQuoteProvider == null ) + throw new Exception( "historicalQuoteProvider cannot be null!" ); + if ( accountProvider == null ) + throw new Exception( "accountProvider cannot be null!" ); + if ( firstDateTime.CompareTo( lastDateTime ) > 0 ) + throw new Exception( "firstDateTime is greater than lastDateTime!" ); + if ( cashToStart <= 0 ) + throw new Exception( "cashToStart must be greater than zero!" ); + if ( maxRunningHours <= 0 ) + throw new Exception( "maxRunningHours must be greater than zero!" ); + } private void initialize_endOfDayTimer() |