[Quantproject-developers] QuantProject/b7_Scripts/TickerSelectionTesting/SimpleSelection RunSimple
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:20:14
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/SimpleSelection In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17551/SimpleSelection Modified Files: RunSimpleSelection.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: RunSimpleSelection.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/SimpleSelection/RunSimpleSelection.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RunSimpleSelection.cs 19 Aug 2008 17:13:10 -0000 1.3 --- RunSimpleSelection.cs 29 Sep 2008 21:19:36 -0000 1.4 *************** *** 60,66 **** protected ReportTable reportTable; ! protected EndOfDayDateTime startDateTime; ! protected EndOfDayDateTime endDateTime; ! protected IHistoricalQuoteProvider historicalQuoteProvider; protected EndOfDayTimerHandlerSimpleSelection endOfDayTimerHandler; --- 60,66 ---- protected ReportTable reportTable; ! protected DateTime startDateTime; ! protected DateTime endDateTime; ! protected HistoricalMarketValueProvider historicalMarketValueProvider; protected EndOfDayTimerHandlerSimpleSelection endOfDayTimerHandler; *************** *** 68,72 **** protected Account account; ! protected IEndOfDayTimer endOfDayTimer; protected string benchmark; --- 68,72 ---- protected Account account; ! protected QuantProject.Business.Timing.Timer endOfDayTimer; protected string benchmark; *************** *** 96,100 **** public DateTime TimerLastDate { ! get{return this.endOfDayTimer.GetCurrentTime().DateTime ;} } --- 96,100 ---- public DateTime TimerLastDate { ! get{return this.endOfDayTimer.GetCurrentDateTime();} } *************** *** 105,112 **** { ! this.startDateTime = new EndOfDayDateTime( ! startDate, EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); ! this.endDateTime = new EndOfDayDateTime( ! endDate, EndOfDaySpecificTime.OneHourAfterMarketClose ); this.benchmark = benchmark; this.ScriptName = "SimpleTestGeneric"; --- 105,116 ---- { ! this.startDateTime = ! HistoricalEndOfDayTimer.GetFiveMinutesBeforeMarketClose( startDate ); ! // new EndOfDayDateTime( ! // startDate, EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); ! this.endDateTime = ! HistoricalEndOfDayTimer.GetOneHourAfterMarketClose( endDate ); ! // new EndOfDayDateTime( ! // endDate, EndOfDaySpecificTime.OneHourAfterMarketClose ); this.benchmark = benchmark; this.ScriptName = "SimpleTestGeneric"; *************** *** 131,138 **** this.numDaysForOptimizationPeriod = numDaysForOptimizationPeriod; this.reportTable = new ReportTable( "Summary_Reports" ); ! this.startDateTime = new EndOfDayDateTime( ! startDate, EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); ! this.endDateTime = new EndOfDayDateTime( ! endDate, EndOfDaySpecificTime.OneHourAfterMarketClose ); this.benchmark = benchmark; this.ScriptName = "SimpleTestGeneric"; --- 135,146 ---- this.numDaysForOptimizationPeriod = numDaysForOptimizationPeriod; this.reportTable = new ReportTable( "Summary_Reports" ); ! this.startDateTime = ! HistoricalEndOfDayTimer.GetFiveMinutesBeforeMarketClose( startDate ); ! // new EndOfDayDateTime( ! // startDate, EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); ! this.endDateTime = ! HistoricalEndOfDayTimer.GetOneHourAfterMarketClose( endDate ); ! // new EndOfDayDateTime( ! // endDate, EndOfDaySpecificTime.OneHourAfterMarketClose ); this.benchmark = benchmark; this.ScriptName = "SimpleTestGeneric"; *************** *** 159,165 **** this.account = new Account( this.scriptName , this.endOfDayTimer , new HistoricalEndOfDayDataStreamer( this.endOfDayTimer , ! this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , ! this.historicalQuoteProvider )); } --- 167,173 ---- this.account = new Account( this.scriptName , this.endOfDayTimer , new HistoricalEndOfDayDataStreamer( this.endOfDayTimer , ! this.historicalMarketValueProvider ) , new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , ! this.historicalMarketValueProvider )); } *************** *** 180,191 **** } ! protected virtual void checkDateForReport(Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs) { ! if(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime>=this.endDateTime.DateTime || ! DateTime.Now >= this.startingTimeForScript.AddHours(this.maxRunningHours)) ! //last date is reached by the timer or maxRunning hours ! //are elapsed from the time script started ! this.SaveScriptResults(); } public virtual void SaveScriptResults() --- 188,214 ---- } ! // protected virtual void checkDateForReport( ! // Object sender , DateTime dateTime) ! // { ! // if(dateTime.EndOfDayDateTime.DateTime>=this.endDateTime.DateTime || ! // DateTime.Now >= this.startingTimeForScript.AddHours(this.maxRunningHours)) ! // //last date is reached by the timer or maxRunning hours ! // //are elapsed from the time script started ! // this.SaveScriptResults(); ! // } ! ! protected virtual void checkDateForReport( ! Object sender , DateTime dateTime) { ! if ( HistoricalEndOfDayTimer.IsMarketClose( dateTime ) ) ! { ! if( dateTime >= this.endDateTime || ! DateTime.Now >= this.startingTimeForScript.AddHours(this.maxRunningHours)) ! //last date is reached by the timer or maxRunning hours ! //are elapsed from the time script started ! this.SaveScriptResults(); ! } } + public virtual void SaveScriptResults() *************** *** 205,209 **** //default report with numIntervalDays = 1 AccountReport accountReport = this.account.CreateReport(fileName,1, ! this.endOfDayTimer.GetCurrentTime(), this.benchmark, new HistoricalAdjustedQuoteProvider()); --- 228,232 ---- //default report with numIntervalDays = 1 AccountReport accountReport = this.account.CreateReport(fileName,1, ! this.endOfDayTimer.GetCurrentDateTime(), this.benchmark, new HistoricalAdjustedQuoteProvider()); *************** *** 229,237 **** //run_initializeProgressHandlers(); } protected virtual void run_addEventHandlers() { ! this.endOfDayTimer.MarketClose += ! new MarketCloseEventHandler( ! this.checkDateForReport); //in inherited classes'override method: --- 252,270 ---- //run_initializeProgressHandlers(); } + + private void newDateTimeEventHandler( object sender , DateTime dateTime ) + { + if ( HistoricalEndOfDayTimer.IsMarketClose( dateTime ) ) + this.checkDateForReport( sender , dateTime ); + } + protected virtual void run_addEventHandlers() { ! this.endOfDayTimer.NewDateTime += ! new NewDateTimeEventHandler( this.newDateTimeEventHandler ); ! ! // this.endOfDayTimer.MarketClose += ! // new MarketCloseEventHandler( ! // this.checkDateForReport); //in inherited classes'override method: |