[Quantproject-developers] QuantProject/b7_Scripts/TickerSelectionTesting EndOfDayTimerHandler.cs,1.1
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2005-08-01 22:31:57
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16912/b7_Scripts/TickerSelectionTesting Modified Files: EndOfDayTimerHandler.cs EndOfDayTimerHandlerCTC.cs EndOfDayTimerHandlerCTO.cs RunEfficientPortfolio.cs RunTestOptimizedCTCPortfolio.cs RunTestOptimizedCTOPortfolio.cs Log Message: Now also genomes are saved at the end of the script, in a directory specified in the app.config file. Minor bugs have been fixed, in addition. Index: RunTestOptimizedCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunTestOptimizedCTOPortfolio.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RunTestOptimizedCTOPortfolio.cs 27 Jul 2005 22:30:56 -0000 1.6 --- RunTestOptimizedCTOPortfolio.cs 1 Aug 2005 22:31:48 -0000 1.7 *************** *** 41,44 **** --- 41,45 ---- using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; using QuantProject.Presentation.Reporting.WindowsForm; + using QuantProject.Scripts.WalkForwardTesting.LinearCombination; *************** *** 109,112 **** --- 110,116 ---- { this.endOfDayTimer.Stop(); + this.account.OptimizationOutput = (object) new OptimizationOutput(this.startDateTime.DateTime, + this.endDateTime.DateTime, + this.endOfDayTimerHandler.BestGenomes); } Index: EndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandler.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** EndOfDayTimerHandler.cs 27 Jul 2005 22:30:55 -0000 1.14 --- EndOfDayTimerHandler.cs 1 Aug 2005 22:31:48 -0000 1.15 *************** *** 32,35 **** --- 32,36 ---- using QuantProject.Data.Selectors; using QuantProject.ADT.Optimizing.Genetic; + using QuantProject.Scripts.WalkForwardTesting.LinearCombination; namespace QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios *************** *** 66,70 **** protected PortfolioType portfolioType; ! protected GenomeCounter genomeCounter; public GenomeCounter GenomeCounter --- 67,71 ---- protected PortfolioType portfolioType; ! protected GenomeCounter genomeCounter; public GenomeCounter GenomeCounter *************** *** 87,90 **** --- 88,100 ---- } + /// <summary> + /// bestGenomes[ i ] contains an array list with the best genomes + /// for generation i + /// </summary> + protected ArrayList bestGenomes; + public ArrayList BestGenomes + { + get { return this.bestGenomes; } + } public EndOfDayTimerHandler(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, *************** *** 107,110 **** --- 117,121 ---- this.targetReturn = targetReturn; this.portfolioType = portfolioType; + } *************** *** 192,195 **** --- 203,217 ---- } + protected void addGenomeToBestGenomes(Genome genome, + DateTime firstOptimizationDate, + DateTime secondOptimizationDate) + { + if(this.bestGenomes == null) + this.bestGenomes = new ArrayList(); + + this.bestGenomes.Add(new GenomeRepresentation(genome, + firstOptimizationDate, + secondOptimizationDate)); + } public virtual void MarketOpenEventHandler( Index: RunEfficientPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientPortfolio.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RunEfficientPortfolio.cs 27 Jul 2005 22:30:56 -0000 1.11 --- RunEfficientPortfolio.cs 1 Aug 2005 22:31:48 -0000 1.12 *************** *** 43,46 **** --- 43,47 ---- using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; using QuantProject.Presentation.Reporting.WindowsForm; + using QuantProject.Scripts.WalkForwardTesting.LinearCombination; *************** *** 225,228 **** --- 226,231 ---- string dirNameWhereToSaveTransactions = System.Configuration.ConfigurationSettings.AppSettings["TransactionsArchive"] + "\\" + this.ScriptName + "\\"; + string dirNameWhereToSaveBestGenomes = System.Configuration.ConfigurationSettings.AppSettings["GenomesArchive"] + + "\\" + this.ScriptName + "\\"; //default report with numIntervalDays = 1 AccountReport accountReport = this.account.CreateReport(fileName,1, *************** *** 234,242 **** dirNameWhereToSaveReports + fileName + ".qPr"); this.checkDateForReport_createDirIfNotPresent(dirNameWhereToSaveTransactions); ObjectArchiver.Archive(this.account.Transactions, dirNameWhereToSaveTransactions + fileName + ".qPt"); ! this.endOfDayTimer.Stop(); --- 237,254 ---- dirNameWhereToSaveReports + fileName + ".qPr"); + // this.checkDateForReport_createDirIfNotPresent(dirNameWhereToSaveTransactions); ObjectArchiver.Archive(this.account.Transactions, dirNameWhereToSaveTransactions + fileName + ".qPt"); ! // ! this.checkDateForReport_createDirIfNotPresent(dirNameWhereToSaveBestGenomes); ! this.account.OptimizationOutput = (object) new OptimizationOutput(this.startDateTime.DateTime, ! this.endDateTime.DateTime, ! this.endOfDayTimerHandler.BestGenomes); ! ObjectArchiver.Archive((OptimizationOutput)this.account.OptimizationOutput, ! dirNameWhereToSaveBestGenomes + ! fileName + ".bgn"); ! //this.account.BestGenomes = this.endOfDayTimerHandler.BestGenomes; this.endOfDayTimer.Stop(); Index: EndOfDayTimerHandlerCTC.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTC.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** EndOfDayTimerHandlerCTC.cs 27 Jul 2005 22:30:55 -0000 1.11 --- EndOfDayTimerHandlerCTC.cs 1 Aug 2005 22:31:48 -0000 1.12 *************** *** 176,179 **** --- 176,181 ---- GO.Run(false); + this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForLiquidity), + currentDate); this.chosenTickers = (string[])GO.BestGenome.Meaning; } Index: EndOfDayTimerHandlerCTO.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTO.cs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** EndOfDayTimerHandlerCTO.cs 27 Jul 2005 22:30:55 -0000 1.15 --- EndOfDayTimerHandlerCTO.cs 1 Aug 2005 22:31:48 -0000 1.16 *************** *** 159,163 **** GO.Run(false); ! this.chosenTickers = (string[])GO.BestGenome.Meaning; } --- 159,164 ---- GO.Run(false); ! this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForLiquidity), ! currentDate); this.chosenTickers = (string[])GO.BestGenome.Meaning; } Index: RunTestOptimizedCTCPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunTestOptimizedCTCPortfolio.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RunTestOptimizedCTCPortfolio.cs 27 Jul 2005 22:30:56 -0000 1.4 --- RunTestOptimizedCTCPortfolio.cs 1 Aug 2005 22:31:48 -0000 1.5 *************** *** 40,43 **** --- 40,44 ---- using QuantProject.Presentation.Reporting.WindowsForm; using QuantProject.ADT.FileManaging; + using QuantProject.Scripts.WalkForwardTesting.LinearCombination; *************** *** 118,121 **** --- 119,125 ---- { this.endOfDayTimer.Stop(); + this.account.OptimizationOutput = (object) new OptimizationOutput(this.startDateTime.DateTime, + this.endDateTime.DateTime, + this.endOfDayTimerHandler.BestGenomes); } |