[Quantproject-developers] QuantProject/b7_Scripts/TickerSelectionTesting EndOfDayTimerHandler.cs,1.5
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2005-01-06 18:58:48
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12918/b7_Scripts/TickerSelectionTesting Modified Files: EndOfDayTimerHandler.cs RunEfficientCTOPortfolio.cs Log Message: Updated script for TickerSelection Testing, using Efficient portfolio theory Index: EndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandler.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** EndOfDayTimerHandler.cs 27 Dec 2004 18:23:51 -0000 1.5 --- EndOfDayTimerHandler.cs 6 Jan 2005 18:58:36 -0000 1.6 *************** *** 45,51 **** private DataTable eligibleTickers; private string[] chosenTickers; ! private int numberOfEligibleTickers; private int numberOfTickersToBeChosen; private Account account; --- 45,53 ---- private DataTable eligibleTickers; private string[] chosenTickers; ! ! private string tickerGroupID; private int numberOfEligibleTickers; private int numberOfTickersToBeChosen; + private int generationNumberForGeneticOptimizer; private Account account; *************** *** 62,72 **** } ! public EndOfDayTimerHandler(int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, ! Account account ) { this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; this.account = account; this.orders = new ArrayList(); } --- 64,76 ---- } ! public EndOfDayTimerHandler(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, Account account, ! int generationNumberForGeneticOptimizer) { + this.tickerGroupID = tickerGroupID; this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; this.account = account; + this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; this.orders = new ArrayList(); } *************** *** 157,170 **** { TickerSelector mostLiquid = new TickerSelector(SelectionType.Liquidity, ! false, "STOCKMI", currentDate.AddDays(-30), currentDate, this.numberOfEligibleTickers); this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); IGenomeManager genManEfficientCTOPortfolio = ! new GenomeManagerForEfficientCTOPortfolio(this.eligibleTickers,currentDate.AddDays(-30), currentDate, this.numberOfTickersToBeChosen, 0.005, 0.05); GeneticOptimizer GO = new GeneticOptimizer(genManEfficientCTOPortfolio); //GO.KeepOnRunningUntilConvergenceIsReached = true; ! GO.GenerationNumber = 2; ! GO.MutationRate = 0.05; GO.Run(false); this.chosenTickers = (string[])GO.BestGenome.Meaning; --- 161,182 ---- { TickerSelector mostLiquid = new TickerSelector(SelectionType.Liquidity, ! false, this.tickerGroupID , currentDate.AddDays(-30), currentDate, this.numberOfEligibleTickers); this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); + TickerSelector quotedInEachMarketDayFromMostLiquid = + new TickerSelector( this.eligibleTickers, + SelectionType.QuotedInEachMarketDay, false, "", + currentDate.AddDays(-30),currentDate, + this.numberOfEligibleTickers); + quotedInEachMarketDayFromMostLiquid.MarketIndex = "^MIBTEL"; + DataTable setOfTickersToBeOptimized = + quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); + // to check this: it doesn't work ! IGenomeManager genManEfficientCTOPortfolio = ! new GenomeManagerForEfficientCTOPortfolio(setOfTickersToBeOptimized, currentDate.AddDays(-30), currentDate, this.numberOfTickersToBeChosen, 0.005, 0.05); GeneticOptimizer GO = new GeneticOptimizer(genManEfficientCTOPortfolio); //GO.KeepOnRunningUntilConvergenceIsReached = true; ! GO.GenerationNumber = this.generationNumberForGeneticOptimizer; GO.Run(false); this.chosenTickers = (string[])GO.BestGenome.Meaning; Index: RunEfficientCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTOPortfolio.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RunEfficientCTOPortfolio.cs 29 Dec 2004 17:17:04 -0000 1.5 --- RunEfficientCTOPortfolio.cs 6 Jan 2005 18:58:38 -0000 1.6 *************** *** 77,84 **** this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2004 , 10 , 4 ) , EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2004 , 10 , 20 ) , EndOfDaySpecificTime.OneHourAfterMarketClose ); ! this.numIntervalDays = 7; } #region Run --- 77,84 ---- this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2000 , 11 , 1 ) , EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2000 , 11 , 4 ) , EndOfDaySpecificTime.OneHourAfterMarketClose ); ! this.numIntervalDays = 2; } #region Run *************** *** 96,100 **** GeneticOptimizer GO = new GeneticOptimizer(genManEfficientCTOPortfolio); //GO.KeepOnRunningUntilConvergenceIsReached = true; ! GO.GenerationNumber = 7; GO.MutationRate = 0.05; GO.Run(true); --- 96,100 ---- GeneticOptimizer GO = new GeneticOptimizer(genManEfficientCTOPortfolio); //GO.KeepOnRunningUntilConvergenceIsReached = true; ! GO.GenerationNumber = 10; GO.MutationRate = 0.05; GO.Run(true); *************** *** 118,122 **** private void run_initializeEndOfDayTimerHandler() { ! this.endOfDayTimerHandler = new EndOfDayTimerHandler(70,6,this.account ); } /* --- 118,122 ---- private void run_initializeEndOfDayTimerHandler() { ! this.endOfDayTimerHandler = new EndOfDayTimerHandler("STOCKMI",70,6,this.account,10); } /* *************** *** 172,176 **** this.endOfDayTimer.Stop(); report = new Report( this.account ); ! report.Show("CTO_Portfolio" , this.numIntervalDays , this.endDateTime , "MSFT" ); } --- 172,177 ---- this.endOfDayTimer.Stop(); report = new Report( this.account ); ! report.Show("CTO_Portfolio" , this.numIntervalDays , this.endDateTime , "^MIBTEL" ); ! } |