[Quantproject-developers] QuantProject/b7_Scripts/TickerSelectionTesting EndOfDayTimerHandler.cs,1.1
Brought to you by:
glauco_1
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3017/b7_Scripts/TickerSelectionTesting Modified Files: EndOfDayTimerHandler.cs EndOfDayTimerHandlerCTC.cs EndOfDayTimerHandlerCTCTest.cs EndOfDayTimerHandlerCTCWeekly.cs EndOfDayTimerHandlerCTO.cs EndOfDayTimerHandlerCTOTest.cs RunEfficientCTCPortfolio.cs RunEfficientCTCWeeklyPortfolio.cs RunEfficientCTOPortfolio.cs RunEfficientPortfolio.cs RunTestOptimizedCTCPortfolio.cs RunTestOptimizedCTOPortfolio.cs Log Message: numDaysForLiquidity has been named numDaysForOptimizationDays (due to the fact that SelectorByLiquidity is not used anymore) Index: RunTestOptimizedCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunTestOptimizedCTOPortfolio.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RunTestOptimizedCTOPortfolio.cs 3 Aug 2005 18:55:11 -0000 1.8 --- RunTestOptimizedCTOPortfolio.cs 18 Sep 2005 21:13:36 -0000 1.9 *************** *** 55,59 **** public RunTestOptimizedCTOPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, --- 55,59 ---- public RunTestOptimizedCTOPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, *************** *** 62,69 **** int numDaysBetweenEachOptimization): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, ! endDate.AddDays(-numDaysForLiquidity), endDate, targetReturn, portfolioType, maxRunningHours, numDaysBetweenEachOptimization) --- 62,69 ---- int numDaysBetweenEachOptimization): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, ! endDate.AddDays(-numDaysForOptimizationPeriod), endDate, targetReturn, portfolioType, maxRunningHours, numDaysBetweenEachOptimization) *************** *** 77,81 **** this.numberOfEligibleTickers, this.numberOfTickersToBeChosen, ! this.numDaysForLiquidity, this.account, this.generationNumberForGeneticOptimizer, --- 77,81 ---- this.numberOfEligibleTickers, this.numberOfTickersToBeChosen, ! this.numDaysForOptimizationPeriod, this.account, this.generationNumberForGeneticOptimizer, Index: EndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandler.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** EndOfDayTimerHandler.cs 28 Aug 2005 10:05:03 -0000 1.16 --- EndOfDayTimerHandler.cs 18 Sep 2005 21:13:36 -0000 1.17 *************** *** 31,34 **** --- 31,35 ---- using QuantProject.Data.DataProviders; using QuantProject.Data.Selectors; + using QuantProject.Data.DataTables; using QuantProject.ADT.Optimizing.Genetic; using QuantProject.Scripts.WalkForwardTesting.LinearCombination; *************** *** 45,54 **** protected DataTable eligibleTickers; protected string[] chosenTickers; ! protected string[] lastChosenTickers; protected string tickerGroupID; protected int numberOfEligibleTickers; protected int numberOfTickersToBeChosen; ! protected int numDaysForLiquidity; protected int generationNumberForGeneticOptimizer; protected int populationSizeForGeneticOptimizer; --- 46,55 ---- protected DataTable eligibleTickers; protected string[] chosenTickers; ! protected string[] lastOrderedTickers; protected string tickerGroupID; protected int numberOfEligibleTickers; protected int numberOfTickersToBeChosen; ! protected int numDaysForOptimizationPeriod; protected int generationNumberForGeneticOptimizer; protected int populationSizeForGeneticOptimizer; *************** *** 74,80 **** } ! public string[] LastChosenTickers { ! get { return this.chosenTickers; } } public int NumberOfEligibleTickers --- 75,81 ---- } ! public string[] LastOrderedTickers { ! get { return this.lastOrderedTickers; } } public int NumberOfEligibleTickers *************** *** 98,102 **** } public EndOfDayTimerHandler(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, --- 99,103 ---- } public EndOfDayTimerHandler(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, Account account, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, *************** *** 107,111 **** this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; ! this.numDaysForLiquidity = numDaysForLiquidity; this.account = account; this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; --- 108,112 ---- this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; ! this.numDaysForOptimizationPeriod = numDaysForOptimizationPeriod; this.account = account; this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; *************** *** 114,118 **** this.orders = new ArrayList(); this.chosenTickers = new string[numberOfTickersToBeChosen]; ! this.lastChosenTickers = new string[numberOfTickersToBeChosen]; this.targetReturn = targetReturn; this.portfolioType = portfolioType; --- 115,119 ---- this.orders = new ArrayList(); this.chosenTickers = new string[numberOfTickersToBeChosen]; ! this.lastOrderedTickers = new string[numberOfTickersToBeChosen]; this.targetReturn = targetReturn; this.portfolioType = portfolioType; *************** *** 131,135 **** this.chosenTickers = chosenTickers; this.numberOfTickersToBeChosen = chosenTickers.Length; ! this.lastChosenTickers = new string[chosenTickers.Length]; this.portfolioType = portfolioType; } --- 132,136 ---- this.chosenTickers = chosenTickers; this.numberOfTickersToBeChosen = chosenTickers.Length; ! this.lastOrderedTickers = new string[chosenTickers.Length]; this.portfolioType = portfolioType; } *************** *** 161,167 **** protected virtual void closePositions() { ! if(this.lastChosenTickers != null) { ! foreach( string ticker in this.lastChosenTickers) { for(int i = 0; i<this.account.Portfolio.Keys.Count; i++) --- 162,169 ---- protected virtual void closePositions() { ! ! if(this.lastOrderedTickers != null) { ! foreach( string ticker in this.lastOrderedTickers) { for(int i = 0; i<this.account.Portfolio.Keys.Count; i++) *************** *** 171,175 **** } } ! } } --- 173,179 ---- } } ! } ! ! } *************** *** 182,186 **** { this.addOrderForTicker( ticker ); ! this.lastChosenTickers[idx] = GenomeManagerForEfficientPortfolio.GetCleanTickerCode(ticker); } --- 186,190 ---- { this.addOrderForTicker( ticker ); ! this.lastOrderedTickers[idx] = GenomeManagerForEfficientPortfolio.GetCleanTickerCode(ticker); } *************** *** 188,191 **** --- 192,214 ---- } } + + protected bool openPositions_allChosenTickersQuotedAtCurrentDate() + { + bool returnValue = true; + DateTime currentDate = this.Account.EndOfDayTimer.GetCurrentTime().DateTime; + foreach(string ticker in this.chosenTickers) + { + if(ticker != null) + { + Quotes tickerQuotes = new Quotes(GenomeManagerForEfficientPortfolio.GetCleanTickerCode(ticker), + currentDate, currentDate); + if(tickerQuotes.Rows.Count == 0) + //no quote available for the current ticker + returnValue = false; + } + } + return returnValue; + } + protected virtual void openPositions() { *************** *** 193,203 **** if(this.orders.Count == 0 && this.account.Transactions.Count == 0) this.account.AddCash(17000); ! ! this.addChosenTickersToOrderList(); ! ! //execute orders actually ! foreach(object item in this.orders) { ! this.account.AddOrder((Order)item); } } --- 216,226 ---- if(this.orders.Count == 0 && this.account.Transactions.Count == 0) this.account.AddCash(17000); ! if(this.openPositions_allChosenTickersQuotedAtCurrentDate()) ! //all tickers have quotes at the current date, so orders can be filled { ! this.addChosenTickersToOrderList(); ! //execute orders actually ! foreach(object item in this.orders) ! this.account.AddOrder((Order)item); } } Index: RunEfficientCTCPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTCPortfolio.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** RunEfficientCTCPortfolio.cs 27 Jul 2005 22:30:55 -0000 1.10 --- RunEfficientCTCPortfolio.cs 18 Sep 2005 21:13:36 -0000 1.11 *************** *** 64,68 **** public RunEfficientCTCPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, --- 64,68 ---- public RunEfficientCTCPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, *************** *** 73,77 **** double maxRunningHours): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, --- 73,77 ---- double maxRunningHours): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, *************** *** 90,94 **** { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTC(this.tickerGroupID, this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, this.numDaysForLiquidity, this.account, this.generationNumberForGeneticOptimizer, --- 90,94 ---- { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTC(this.tickerGroupID, this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, this.numDaysForOptimizationPeriod, this.account, this.generationNumberForGeneticOptimizer, Index: RunTestOptimizedCTCPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunTestOptimizedCTCPortfolio.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RunTestOptimizedCTCPortfolio.cs 3 Aug 2005 18:55:11 -0000 1.6 --- RunTestOptimizedCTCPortfolio.cs 18 Sep 2005 21:13:36 -0000 1.7 *************** *** 62,66 **** public RunTestOptimizedCTCPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, --- 62,66 ---- public RunTestOptimizedCTCPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, *************** *** 71,78 **** double maxRunningHours): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, ! endDate.AddDays(-numDaysForLiquidity), endDate, numDaysOfPortfolioLife - 1, numDaysForReturnCalculation, targetReturn, --- 71,78 ---- double maxRunningHours): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, ! endDate.AddDays(-numDaysForOptimizationPeriod), endDate, numDaysOfPortfolioLife - 1, numDaysForReturnCalculation, targetReturn, *************** *** 87,91 **** { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTCTest(this.tickerGroupID, this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, this.numDaysForLiquidity, this.account, this.generationNumberForGeneticOptimizer, --- 87,91 ---- { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTCTest(this.tickerGroupID, this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, this.numDaysForOptimizationPeriod, this.account, this.generationNumberForGeneticOptimizer, Index: EndOfDayTimerHandlerCTO.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTO.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** EndOfDayTimerHandlerCTO.cs 28 Aug 2005 10:05:03 -0000 1.17 --- EndOfDayTimerHandlerCTO.cs 18 Sep 2005 21:13:36 -0000 1.18 *************** *** 46,52 **** protected int numDaysBetweenEachOptimization; private int numDaysElapsedSinceLastOptimization; public EndOfDayTimerHandlerCTO(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, --- 46,53 ---- protected int numDaysBetweenEachOptimization; private int numDaysElapsedSinceLastOptimization; + protected int seedForRandomGenerator; public EndOfDayTimerHandlerCTO(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, Account account, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, *************** *** 54,58 **** PortfolioType portfolioType, int numDaysBetweenEachOptimization): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, account, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, --- 55,59 ---- PortfolioType portfolioType, int numDaysBetweenEachOptimization): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, account, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, *************** *** 62,65 **** --- 63,67 ---- this.numDaysBetweenEachOptimization = numDaysBetweenEachOptimization; this.numDaysElapsedSinceLastOptimization = 0; + this.seedForRandomGenerator = ConstantsProvider.SeedForRandomGenerator; } *************** *** 105,121 **** */ ! SelectorByLiquidity mostLiquid = new SelectorByLiquidity(this.tickerGroupID, false, ! currentDate.AddDays(-this.numDaysForLiquidity), currentDate, ! this.numberOfEligibleTickers); ! /*SelectorByOpenToCloseVolatility lessVolatile = ! new SelectorByOpenToCloseVolatility(mostLiquid.GetTableOfSelectedTickers(), ! true, currentDate.AddDays(-5), ! currentDate, ! this.numberOfEligibleTickers/2);*/ ! this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromEligible = new SelectorByQuotationAtEachMarketDay( this.eligibleTickers, ! false, currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfEligibleTickers, this.benchmark); //SelectorByWinningOpenToClose winners = --- 107,122 ---- */ ! SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, currentDate); ! SelectorByOpenCloseCorrelationToBenchmark lessCorrelatedFromTemporizedGroup = ! new SelectorByOpenCloseCorrelationToBenchmark(temporizedGroup.GetTableOfSelectedTickers(), ! this.benchmark,true, ! currentDate.AddDays(-this.numDaysForOptimizationPeriod ), ! currentDate, ! this.numberOfEligibleTickers); ! this.eligibleTickers = lessCorrelatedFromTemporizedGroup.GetTableOfSelectedTickers(); SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromEligible = new SelectorByQuotationAtEachMarketDay( this.eligibleTickers, ! false, currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, this.numberOfEligibleTickers, this.benchmark); //SelectorByWinningOpenToClose winners = *************** *** 145,149 **** IGenomeManager genManEfficientCTOPortfolio = new GenomeManagerForEfficientCTOPortfolio(setOfTickersToBeOptimized, ! currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfTickersToBeChosen, --- 146,150 ---- IGenomeManager genManEfficientCTOPortfolio = new GenomeManagerForEfficientCTOPortfolio(setOfTickersToBeOptimized, ! currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, this.numberOfTickersToBeChosen, *************** *** 154,163 **** this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, ! ConstantsProvider.SeedForRandomGenerator); if(setGenomeCounter) this.genomeCounter = new GenomeCounter(GO); GO.Run(false); ! this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForLiquidity), currentDate); this.chosenTickers = (string[])GO.BestGenome.Meaning; --- 155,164 ---- this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, ! this.seedForRandomGenerator); if(setGenomeCounter) this.genomeCounter = new GenomeCounter(GO); GO.Run(false); ! this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate); this.chosenTickers = (string[])GO.BestGenome.Meaning; *************** *** 184,188 **** Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! ConstantsProvider.SeedForRandomGenerator++; this.orders.Clear(); //this.oneHourAfterMarketCloseEventHandler_updatePrices(); --- 185,189 ---- Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! this.seedForRandomGenerator++; this.orders.Clear(); //this.oneHourAfterMarketCloseEventHandler_updatePrices(); Index: EndOfDayTimerHandlerCTOTest.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTOTest.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** EndOfDayTimerHandlerCTOTest.cs 27 Jul 2005 22:30:55 -0000 1.6 --- EndOfDayTimerHandlerCTOTest.cs 18 Sep 2005 21:13:36 -0000 1.7 *************** *** 69,73 **** if(!EndOfDayTimerHandlerCTOTest.optimized) { ! base.setTickers(currentDate.AddDays(this.numDaysForLiquidity), true); EndOfDayTimerHandlerCTOTest.optimized = true; --- 69,73 ---- if(!EndOfDayTimerHandlerCTOTest.optimized) { ! base.setTickers(currentDate.AddDays(this.numDaysForOptimizationPeriod), true); EndOfDayTimerHandlerCTOTest.optimized = true; Index: RunEfficientPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientPortfolio.cs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** RunEfficientPortfolio.cs 28 Aug 2005 09:57:02 -0000 1.15 --- RunEfficientPortfolio.cs 18 Sep 2005 21:13:36 -0000 1.16 *************** *** 57,61 **** protected int numberOfEligibleTickers; protected int numberOfTickersToBeChosen; ! protected int numDaysForLiquidity; protected int generationNumberForGeneticOptimizer; protected int populationSizeForGeneticOptimizer; --- 57,61 ---- protected int numberOfEligibleTickers; protected int numberOfTickersToBeChosen; ! protected int numDaysForOptimizationPeriod; protected int generationNumberForGeneticOptimizer; protected int populationSizeForGeneticOptimizer; *************** *** 89,95 **** //is still running, it will be stopped. ! public string[] LastChosenTickers { ! get { return this.endOfDayTimerHandler.LastChosenTickers; } } public PortfolioType TypeOfPortfolio --- 89,95 ---- //is still running, it will be stopped. ! public string[] LastOrderedTickers { ! get { return this.endOfDayTimerHandler.LastOrderedTickers; } } public PortfolioType TypeOfPortfolio *************** *** 128,132 **** public RunEfficientPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, --- 128,132 ---- public RunEfficientPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, *************** *** 140,144 **** this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; ! this.numDaysForLiquidity = numDaysForLiquidity; this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; this.populationSizeForGeneticOptimizer = populationSizeForGeneticOptimizer; --- 140,144 ---- this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; ! this.numDaysForOptimizationPeriod = numDaysForOptimizationPeriod; this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; this.populationSizeForGeneticOptimizer = populationSizeForGeneticOptimizer; *************** *** 216,220 **** { string fileName = "From"+this.numberOfEligibleTickers + ! "LiqDays" + this.numDaysForLiquidity + "Portfolio" + this.numberOfTickersToBeChosen + "GenNum" + this.generationNumberForGeneticOptimizer + --- 216,220 ---- { string fileName = "From"+this.numberOfEligibleTickers + ! "OptDays" + this.numDaysForOptimizationPeriod + "Portfolio" + this.numberOfTickersToBeChosen + "GenNum" + this.generationNumberForGeneticOptimizer + Index: EndOfDayTimerHandlerCTCTest.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTCTest.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EndOfDayTimerHandlerCTCTest.cs 27 Jul 2005 22:30:55 -0000 1.3 --- EndOfDayTimerHandlerCTCTest.cs 18 Sep 2005 21:13:36 -0000 1.4 *************** *** 48,52 **** public EndOfDayTimerHandlerCTCTest(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, int generationNumberForGeneticOptimizer, --- 48,52 ---- public EndOfDayTimerHandlerCTCTest(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, Account account, int generationNumberForGeneticOptimizer, *************** *** 58,62 **** PortfolioType portfolioType, double maxAcceptableCloseToCloseDrawdown): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, account, generationNumberForGeneticOptimizer, --- 58,62 ---- PortfolioType portfolioType, double maxAcceptableCloseToCloseDrawdown): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, account, generationNumberForGeneticOptimizer, *************** *** 77,81 **** if(!EndOfDayTimerHandlerCTCTest.optimized) { ! base.setTickers(currentDate.AddDays(this.numDaysForLiquidity), true); EndOfDayTimerHandlerCTCTest.optimized = true; --- 77,81 ---- if(!EndOfDayTimerHandlerCTCTest.optimized) { ! base.setTickers(currentDate.AddDays(this.numDaysForOptimizationPeriod), true); EndOfDayTimerHandlerCTCTest.optimized = true; Index: RunEfficientCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTOPortfolio.cs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** RunEfficientCTOPortfolio.cs 27 Jul 2005 22:30:56 -0000 1.21 --- RunEfficientCTOPortfolio.cs 18 Sep 2005 21:13:36 -0000 1.22 *************** *** 58,62 **** protected int numDaysBetweenEachOptimization; public RunEfficientCTOPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, --- 58,62 ---- protected int numDaysBetweenEachOptimization; public RunEfficientCTOPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, *************** *** 65,69 **** int numDaysBetweenEachOptimization): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, --- 65,69 ---- int numDaysBetweenEachOptimization): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, *************** *** 94,98 **** this.numberOfEligibleTickers, this.numberOfTickersToBeChosen, ! this.numDaysForLiquidity, this.account, this.generationNumberForGeneticOptimizer, --- 94,98 ---- this.numberOfEligibleTickers, this.numberOfTickersToBeChosen, ! this.numDaysForOptimizationPeriod, this.account, this.generationNumberForGeneticOptimizer, *************** *** 106,109 **** --- 106,110 ---- { this.historicalQuoteProvider = new HistoricalRawQuoteProvider(); + //this.historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); } Index: RunEfficientCTCWeeklyPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTCWeeklyPortfolio.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RunEfficientCTCWeeklyPortfolio.cs 27 Jul 2005 22:22:02 -0000 1.1 --- RunEfficientCTCWeeklyPortfolio.cs 18 Sep 2005 21:13:36 -0000 1.2 *************** *** 58,62 **** public RunEfficientCTCWeeklyPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, --- 58,62 ---- public RunEfficientCTCWeeklyPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, *************** *** 67,71 **** double maxRunningHours): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, --- 67,71 ---- double maxRunningHours): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, *************** *** 83,87 **** { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTCWeekly(this.tickerGroupID, this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, this.numDaysForLiquidity, this.account, this.generationNumberForGeneticOptimizer, --- 83,87 ---- { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTCWeekly(this.tickerGroupID, this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, this.numDaysForOptimizationPeriod, this.account, this.generationNumberForGeneticOptimizer, Index: EndOfDayTimerHandlerCTCWeekly.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTCWeekly.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EndOfDayTimerHandlerCTCWeekly.cs 27 Jul 2005 22:22:02 -0000 1.1 --- EndOfDayTimerHandlerCTCWeekly.cs 18 Sep 2005 21:13:36 -0000 1.2 *************** *** 51,55 **** public EndOfDayTimerHandlerCTCWeekly(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, int generationNumberForGeneticOptimizer, --- 51,55 ---- public EndOfDayTimerHandlerCTCWeekly(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, Account account, int generationNumberForGeneticOptimizer, *************** *** 60,64 **** PortfolioType portfolioType, double maxAcceptableCloseToCloseDrawdown): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, account, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, --- 60,64 ---- PortfolioType portfolioType, double maxAcceptableCloseToCloseDrawdown): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, account, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, *************** *** 115,128 **** protected DataTable getSetOfTickersToBeOptimized(DateTime currentDate) { ! SelectorByLiquidity mostLiquid = new SelectorByLiquidity(this.tickerGroupID,false, ! currentDate.AddDays(-this.numDaysForLiquidity), ! currentDate, ! this.numberOfEligibleTickers); ! this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromMostLiquid = new SelectorByQuotationAtEachMarketDay(this.eligibleTickers, ! false, currentDate.AddDays(-this.numDaysForLiquidity),currentDate, this.numberOfEligibleTickers, this.benchmark); ! return quotedAtEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); } --- 115,127 ---- protected DataTable getSetOfTickersToBeOptimized(DateTime currentDate) { ! SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, ! currentDate); ! ! this.eligibleTickers = temporizedGroup.GetTableOfSelectedTickers(); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromEligible = new SelectorByQuotationAtEachMarketDay(this.eligibleTickers, ! false, currentDate.AddDays(-this.numDaysForOptimizationPeriod),currentDate, this.numberOfEligibleTickers, this.benchmark); ! return quotedAtEachMarketDayFromEligible.GetTableOfSelectedTickers(); } *************** *** 143,147 **** IGenomeManager genManEfficientCTCPortfolio = new GenomeManagerForEfficientCTCPortfolio(setOfTickersToBeOptimized, ! currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfTickersToBeChosen, this.numDaysForReturnCalculation, --- 142,146 ---- IGenomeManager genManEfficientCTCPortfolio = new GenomeManagerForEfficientCTCPortfolio(setOfTickersToBeOptimized, ! currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, this.numberOfTickersToBeChosen, this.numDaysForReturnCalculation, Index: EndOfDayTimerHandlerCTC.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTC.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** EndOfDayTimerHandlerCTC.cs 28 Aug 2005 10:05:03 -0000 1.13 --- EndOfDayTimerHandlerCTC.cs 18 Sep 2005 21:13:36 -0000 1.14 *************** *** 53,57 **** public EndOfDayTimerHandlerCTC(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, int generationNumberForGeneticOptimizer, --- 53,57 ---- public EndOfDayTimerHandlerCTC(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, Account account, int generationNumberForGeneticOptimizer, *************** *** 63,67 **** PortfolioType portfolioType, double maxAcceptableCloseToCloseDrawdown): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, account, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, --- 63,67 ---- PortfolioType portfolioType, double maxAcceptableCloseToCloseDrawdown): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, account, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, *************** *** 134,147 **** protected DataTable getSetOfTickersToBeOptimized(DateTime currentDate) { ! SelectorByLiquidity mostLiquid = new SelectorByLiquidity(this.tickerGroupID,false, ! currentDate.AddDays(-this.numDaysForLiquidity), ! currentDate, ! this.numberOfEligibleTickers); ! this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); ! SelectorByQuotationAtEachMarketDay quotedInEachMarketDayFromMostLiquid = new SelectorByQuotationAtEachMarketDay(this.eligibleTickers, ! false, currentDate.AddDays(-this.numDaysForLiquidity),currentDate, this.numberOfEligibleTickers, this.benchmark); ! return quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); } --- 134,146 ---- protected DataTable getSetOfTickersToBeOptimized(DateTime currentDate) { ! SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, ! currentDate); ! ! this.eligibleTickers = temporizedGroup.GetTableOfSelectedTickers(); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromEligible = new SelectorByQuotationAtEachMarketDay(this.eligibleTickers, ! false, currentDate.AddDays(-this.numDaysForOptimizationPeriod),currentDate, this.numberOfEligibleTickers, this.benchmark); ! return quotedAtEachMarketDayFromEligible.GetTableOfSelectedTickers(); } *************** *** 163,167 **** IGenomeManager genManEfficientCTCPortfolio = new GenomeManagerForEfficientCTCPortfolio(setOfTickersToBeOptimized, ! currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfTickersToBeChosen, this.numDaysForReturnCalculation, --- 162,166 ---- IGenomeManager genManEfficientCTCPortfolio = new GenomeManagerForEfficientCTCPortfolio(setOfTickersToBeOptimized, ! currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, this.numberOfTickersToBeChosen, this.numDaysForReturnCalculation, *************** *** 176,180 **** GO.Run(false); ! this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForLiquidity), currentDate); this.chosenTickers = (string[])GO.BestGenome.Meaning; --- 175,179 ---- GO.Run(false); ! this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate); this.chosenTickers = (string[])GO.BestGenome.Meaning; |