[Quantproject-developers] QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank BestPerfor
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:19:15
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16751/WalkForwardOneRank Modified Files: BestPerformingTickers.cs ChosenTickers.cs ComparableAccount.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: BestPerformingTickers.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank/BestPerformingTickers.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** BestPerformingTickers.cs 7 Jun 2005 15:18:56 -0000 1.10 --- BestPerformingTickers.cs 29 Sep 2008 21:18:25 -0000 1.11 *************** *** 43,47 **** private int numberDaysForPerformanceCalculation; ! private IHistoricalQuoteProvider historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); --- 43,47 ---- private int numberDaysForPerformanceCalculation; ! private HistoricalMarketValueProvider historicalMarketValueProvider = new HistoricalAdjustedQuoteProvider(); *************** *** 75,85 **** HistoricalEndOfDayTimer historicalEndOfDayTimer = new HistoricalEndOfDayTimer( ! new EndOfDayDateTime( dateTime.AddDays( -this.numberDaysForPerformanceCalculation ) , ! EndOfDaySpecificTime.MarketOpen ) ); ComparableAccount account = new ComparableAccount( ticker , historicalEndOfDayTimer , new HistoricalEndOfDayDataStreamer( historicalEndOfDayTimer , ! this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( historicalEndOfDayTimer , ! this.historicalQuoteProvider ) ); OneRank oneRank = new OneRank( account , dateTime ); double goodness = account.Goodness; // forces Goodness computation here (for a better ProgressBar effect) --- 75,87 ---- HistoricalEndOfDayTimer historicalEndOfDayTimer = new HistoricalEndOfDayTimer( ! HistoricalEndOfDayTimer.GetMarketOpen( ! dateTime.AddDays( -this.numberDaysForPerformanceCalculation ) ) ); ! // new EndOfDayDateTime( dateTime.AddDays( -this.numberDaysForPerformanceCalculation ) , ! // EndOfDaySpecificTime.MarketOpen ) ); ComparableAccount account = new ComparableAccount( ticker , historicalEndOfDayTimer , new HistoricalEndOfDayDataStreamer( historicalEndOfDayTimer , ! this.historicalMarketValueProvider ) , new HistoricalEndOfDayOrderExecutor( historicalEndOfDayTimer , ! this.historicalMarketValueProvider ) ); OneRank oneRank = new OneRank( account , dateTime ); double goodness = account.Goodness; // forces Goodness computation here (for a better ProgressBar effect) *************** *** 119,129 **** HistoricalEndOfDayTimer historicalEndOfDayTimer = new HistoricalEndOfDayTimer( ! new EndOfDayDateTime( dateTime.AddDays( -this.numberDaysForPerformanceCalculation ) , ! EndOfDaySpecificTime.MarketOpen ) ); ComparableAccount account = new ComparableAccount( ticker , historicalEndOfDayTimer , new HistoricalEndOfDayDataStreamer( historicalEndOfDayTimer , ! this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( historicalEndOfDayTimer , ! this.historicalQuoteProvider ) ); OneRank oneRank = new OneRank( account , dateTime ); this.tickersWithGoodness.Add( new EstimatedObject( account.Key , account.Goodness ) ); --- 121,133 ---- HistoricalEndOfDayTimer historicalEndOfDayTimer = new HistoricalEndOfDayTimer( ! HistoricalEndOfDayTimer.GetMarketOpen( ! dateTime.AddDays( -this.numberDaysForPerformanceCalculation ) ) ); ! // new EndOfDayDateTime( dateTime.AddDays( -this.numberDaysForPerformanceCalculation ) , ! // EndOfDaySpecificTime.MarketOpen ) ); ComparableAccount account = new ComparableAccount( ticker , historicalEndOfDayTimer , new HistoricalEndOfDayDataStreamer( historicalEndOfDayTimer , ! this.historicalMarketValueProvider ) , new HistoricalEndOfDayOrderExecutor( historicalEndOfDayTimer , ! this.historicalMarketValueProvider ) ); OneRank oneRank = new OneRank( account , dateTime ); this.tickersWithGoodness.Add( new EstimatedObject( account.Key , account.Goodness ) ); Index: ChosenTickers.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank/ChosenTickers.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ChosenTickers.cs 15 Oct 2005 17:59:35 -0000 1.7 --- ChosenTickers.cs 29 Sep 2008 21:18:25 -0000 1.8 *************** *** 3,7 **** ChosenTickers.cs ! Copyright (C) 2003 Glauco Siliprandi --- 3,7 ---- ChosenTickers.cs ! Copyright (C) 2003 Glauco Siliprandi *************** *** 19,23 **** along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; using System.Collections; --- 19,23 ---- along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; using System.Collections; *************** *** 38,42 **** private int numberTickersToBeChosen; ! private IHistoricalQuoteProvider historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); --- 38,42 ---- private int numberTickersToBeChosen; ! private HistoricalMarketValueProvider historicalMarketValueProvider = new HistoricalAdjustedQuoteProvider(); *************** *** 50,59 **** double todayMarketValueAtClose = account.DataStreamer.GetCurrentBid( ticker ); ! EndOfDayDateTime yesterdayAtClose = new ! EndOfDayDateTime( account.EndOfDayTimer.GetCurrentTime().DateTime.AddDays( - 1 ) , ! EndOfDaySpecificTime.MarketClose ); double yesterdayMarketValueAtClose = ! this.historicalQuoteProvider.GetMarketValue( ticker , ! yesterdayAtClose ); if ( todayMarketValueAtClose > yesterdayMarketValueAtClose ) // today close is higher than yesterday close --- 50,61 ---- double todayMarketValueAtClose = account.DataStreamer.GetCurrentBid( ticker ); ! DateTime yesterdayAtClose = ! HistoricalEndOfDayTimer.GetMarketClose( ! account.Timer.GetCurrentDateTime().AddDays( - 1 ) ); ! // new EndOfDayDateTime( account.EndOfDayTimer.GetCurrentTime().DateTime.AddDays( - 1 ) , ! // EndOfDaySpecificTime.MarketClose ); double yesterdayMarketValueAtClose = ! this.historicalMarketValueProvider.GetMarketValue( ticker , ! yesterdayAtClose ); if ( todayMarketValueAtClose > yesterdayMarketValueAtClose ) // today close is higher than yesterday close *************** *** 61,69 **** } private void setTickers_build( BestPerformingTickers bestPerformingTickers , ! Account account ) { int index = 0; while ( ( this.Count < this.numberTickersToBeChosen ) && ! ( index <= ( bestPerformingTickers.Count - 1 ) ) ) { string ticker = (string)bestPerformingTickers[ index ]; --- 63,71 ---- } private void setTickers_build( BestPerformingTickers bestPerformingTickers , ! Account account ) { int index = 0; while ( ( this.Count < this.numberTickersToBeChosen ) && ! ( index <= ( bestPerformingTickers.Count - 1 ) ) ) { string ticker = (string)bestPerformingTickers[ index ]; *************** *** 80,84 **** /// <param name="dateTime"></param> public void SetTickers( BestPerformingTickers bestPerformingTickers , ! Account account ) { this.Clear(); --- 82,86 ---- /// <param name="dateTime"></param> public void SetTickers( BestPerformingTickers bestPerformingTickers , ! Account account ) { this.Clear(); Index: ComparableAccount.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank/ComparableAccount.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ComparableAccount.cs 15 Oct 2005 18:04:58 -0000 1.11 --- ComparableAccount.cs 29 Sep 2008 21:18:25 -0000 1.12 *************** *** 3,7 **** ComparableAccount.cs ! Copyright (C) 2003 Glauco Siliprandi --- 3,7 ---- ComparableAccount.cs ! Copyright (C) 2003 Glauco Siliprandi *************** *** 19,23 **** along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; --- 19,23 ---- along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; *************** *** 38,46 **** public class ComparableAccount : Account { ! // private double maxAcceptableDrawDown = 30; // private double minAcceptableWinningPeriods = 52; ! private IHistoricalQuoteProvider historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); --- 38,46 ---- public class ComparableAccount : Account { ! // private double maxAcceptableDrawDown = 30; // private double minAcceptableWinningPeriods = 52; ! private HistoricalMarketValueProvider historicalMarketValueProvider = new HistoricalAdjustedQuoteProvider(); *************** *** 57,63 **** get { return this.goodness(); } } ! public ComparableAccount( string accountName , IEndOfDayTimer endOfDayTimer , ! IDataStreamer dataStreamer , IOrderExecutor orderExecutor ) : base( accountName , ! endOfDayTimer , dataStreamer , orderExecutor ) { } --- 57,63 ---- get { return this.goodness(); } } ! public ComparableAccount( string accountName , Timer endOfDayTimer , ! IDataStreamer dataStreamer , IOrderExecutor orderExecutor ) : base( accountName , ! endOfDayTimer , dataStreamer , orderExecutor ) { } *************** *** 68,74 **** { this.accountReport = new AccountReport( ! this , this.historicalQuoteProvider ); this.accountReport.SetEquityLine( 1 , ! this.EndOfDayTimer.GetCurrentTime() ); returnValue = AdvancedFunctions.GetSharpeRatio( this.accountReport.EquityLine.GetReturns().Values ); --- 68,75 ---- { this.accountReport = new AccountReport( ! this , this.historicalMarketValueProvider , ! new SelectorForMaketClose( this.Transactions.FirstDateTime ) ); this.accountReport.SetEquityLine( 1 , ! this.Timer.GetCurrentDateTime() ); returnValue = AdvancedFunctions.GetSharpeRatio( this.accountReport.EquityLine.GetReturns().Values ); |