quantproject-developers Mailing List for QuantProject (Page 82)
Brought to you by:
glauco_1
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
(103) |
Dec
(67) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(52) |
Feb
(9) |
Mar
(69) |
Apr
(53) |
May
(80) |
Jun
(23) |
Jul
(24) |
Aug
(112) |
Sep
(9) |
Oct
|
Nov
(58) |
Dec
(93) |
| 2005 |
Jan
(90) |
Feb
(93) |
Mar
(61) |
Apr
(56) |
May
(37) |
Jun
(61) |
Jul
(55) |
Aug
(68) |
Sep
(25) |
Oct
(46) |
Nov
(41) |
Dec
(37) |
| 2006 |
Jan
(33) |
Feb
(7) |
Mar
(19) |
Apr
(27) |
May
(73) |
Jun
(49) |
Jul
(83) |
Aug
(66) |
Sep
(45) |
Oct
(16) |
Nov
(15) |
Dec
(7) |
| 2007 |
Jan
(14) |
Feb
(33) |
Mar
|
Apr
(21) |
May
|
Jun
(34) |
Jul
(18) |
Aug
(100) |
Sep
(39) |
Oct
(55) |
Nov
(12) |
Dec
(2) |
| 2008 |
Jan
(120) |
Feb
(133) |
Mar
(129) |
Apr
(104) |
May
(42) |
Jun
(2) |
Jul
(52) |
Aug
(99) |
Sep
(134) |
Oct
|
Nov
(137) |
Dec
(48) |
| 2009 |
Jan
(48) |
Feb
(55) |
Mar
(61) |
Apr
(3) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(51) |
Sep
|
Oct
(7) |
Nov
|
Dec
|
| 2010 |
Jan
(7) |
Feb
(1) |
Mar
(145) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(8) |
Dec
|
| 2011 |
Jan
(78) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(88) |
Sep
(6) |
Oct
(1) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Marco M. <mi...@us...> - 2006-08-07 21:10:45
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv25183/b7_Scripts/WalkForwardTesting/LinearCombination Modified Files: ExtremeCounterTrendStrategy.cs Log Message: Minor changes for ECT strategy. Index: ExtremeCounterTrendStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/ExtremeCounterTrendStrategy.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExtremeCounterTrendStrategy.cs 2 Jul 2006 19:22:12 -0000 1.2 --- ExtremeCounterTrendStrategy.cs 7 Aug 2006 21:10:36 -0000 1.3 *************** *** 47,55 **** private int numOfClosesElapsed = 0; private int numOfDaysWithOpenPosition = 0; public ExtremeCounterTrendStrategy( Account account , string[] signedTickers, double[] weightsForSignedTickers, ! int numDaysForReturnCalculation) { this.account = account; --- 47,57 ---- private int numOfClosesElapsed = 0; private int numOfDaysWithOpenPosition = 0; + private PortfolioType portfolioType; public ExtremeCounterTrendStrategy( Account account , string[] signedTickers, double[] weightsForSignedTickers, ! int numDaysForReturnCalculation, ! PortfolioType portfolioType) { this.account = account; *************** *** 57,60 **** --- 59,63 ---- this.weightsForSignedTickers = weightsForSignedTickers; this.numDaysForReturnCalculation = numDaysForReturnCalculation; + this.portfolioType = portfolioType; } *************** *** 125,135 **** if(lastHalfPeriodGain < 0.0) this.marketCloseEventHandler_addOrders(); ! else { SignedTicker.ChangeSignOfEachTicker(this.signedTickers); ! //short the portfolio ! try{this.marketCloseEventHandler_addOrders();} ! catch(Exception ex){ex = ex;} ! finally{SignedTicker.ChangeSignOfEachTicker(this.signedTickers);} } } --- 128,148 ---- if(lastHalfPeriodGain < 0.0) this.marketCloseEventHandler_addOrders(); ! else if (lastHalfPeriodGain > 0.0 && ! this.portfolioType == PortfolioType.ShortAndLong ) ! //if gain of the last half period is positive and ! //original positions can be reversed { SignedTicker.ChangeSignOfEachTicker(this.signedTickers); ! //short the portfolio (short --> long; long --> short) ! try{ ! this.marketCloseEventHandler_addOrders(); ! } ! catch(Exception ex) ! { ! ex = ex; ! } ! finally{ ! SignedTicker.ChangeSignOfEachTicker(this.signedTickers); ! } } } *************** *** 149,152 **** --- 162,167 ---- Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { + this.numOfClosesElapsed++; + if(this.account.Transactions.Count == 0) this.account.AddCash(30000); *************** *** 157,168 **** if(this.numOfDaysWithOpenPosition == this.numDaysForReturnCalculation) this.marketCloseEventHandler_closePositions(); ! if(this.account.Portfolio.Count == 0 && ! (this.numOfClosesElapsed + 1) >= this.numDaysForReturnCalculation) ! //portfolio is empty and previous closes can be now checked ! if(this.account.Portfolio.Count == 0) this.marketCloseEventHandler_openPositions((IndexBasedEndOfDayTimer)sender); - - this.numOfClosesElapsed++; } --- 172,180 ---- if(this.numOfDaysWithOpenPosition == this.numDaysForReturnCalculation) this.marketCloseEventHandler_closePositions(); ! if(this.account.Portfolio.Count == 0 && ! this.numOfClosesElapsed >= this.numDaysForReturnCalculation) ! //portfolio is empty and previous closes can be now checked this.marketCloseEventHandler_openPositions((IndexBasedEndOfDayTimer)sender); } |
|
From: Marco M. <mi...@us...> - 2006-08-07 21:09:18
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedPeriodOscillators In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24647/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedPeriodOscillators Modified Files: EndOfDayTimerHandlerFPOscillatorCTC.cs Log Message: Updated the base handler for tickerSelection strategies (OTC, etc.) and for other strategies (ECT, FixedPeriodOscillator, ImmediateTrendFollower). Index: EndOfDayTimerHandlerFPOscillatorCTC.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedPeriodOscillators/EndOfDayTimerHandlerFPOscillatorCTC.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EndOfDayTimerHandlerFPOscillatorCTC.cs 3 Aug 2006 21:31:16 -0000 1.2 --- EndOfDayTimerHandlerFPOscillatorCTC.cs 7 Aug 2006 21:09:15 -0000 1.3 *************** *** 61,64 **** --- 61,65 ---- private DateTime lastCloseDate; private IGenomeManager iGenomeManager; + private int seedForRandomGenerator; public EndOfDayTimerHandlerFPOscillatorCTC(string tickerGroupID, int numberOfEligibleTickers, *************** *** 87,90 **** --- 88,92 ---- this.numDaysBetweenEachOptimization = 2* numDaysForReturnCalculation; this.numDaysBetweenEachOptimization = numDaysForReturnCalculation; + this.seedForRandomGenerator = ConstantsProvider.SeedForRandomGenerator; } *************** *** 301,305 **** this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, ! ConstantsProvider.SeedForRandomGenerator); if(setGenomeCounter) this.genomeCounter = new GenomeCounter(GO); --- 303,307 ---- this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, ! this.seedForRandomGenerator); if(setGenomeCounter) this.genomeCounter = new GenomeCounter(GO); *************** *** 307,311 **** GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,((GenomeManagerForEfficientPortfolio)this.iGenomeManager).FirstQuoteDate, ! ((GenomeManagerForEfficientPortfolio)this.iGenomeManager).LastQuoteDate, setOfTickersToBeOptimized.Rows.Count); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; --- 309,314 ---- GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,((GenomeManagerForEfficientPortfolio)this.iGenomeManager).FirstQuoteDate, ! ((GenomeManagerForEfficientPortfolio)this.iGenomeManager).LastQuoteDate, setOfTickersToBeOptimized.Rows.Count, ! this.numDaysForReturnCalculation); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; *************** *** 324,328 **** { this.lastCloseDate = endOfDayTimingEventArgs.EndOfDayDateTime.DateTime; ! ConstantsProvider.SeedForRandomGenerator++; this.numDaysElapsedSinceLastOptimization++; this.orders.Clear(); --- 327,331 ---- { this.lastCloseDate = endOfDayTimingEventArgs.EndOfDayDateTime.DateTime; ! this.seedForRandomGenerator++; this.numDaysElapsedSinceLastOptimization++; this.orders.Clear(); |
|
From: Marco M. <mi...@us...> - 2006-08-07 21:09:18
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24647/b7_Scripts/TickerSelectionTesting Modified Files: EndOfDayTimerHandler.cs EndOfDayTimerHandlerOTCMultiday.cs Log Message: Updated the base handler for tickerSelection strategies (OTC, etc.) and for other strategies (ECT, FixedPeriodOscillator, ImmediateTrendFollower). Index: EndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandler.cs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** EndOfDayTimerHandler.cs 3 Aug 2006 21:31:15 -0000 1.21 --- EndOfDayTimerHandler.cs 7 Aug 2006 21:09:15 -0000 1.22 *************** *** 280,286 **** secondOptimizationDate, genome.Generation, ! eligibleTickers)); } public virtual void MarketOpenEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) --- 280,319 ---- secondOptimizationDate, genome.Generation, ! eligibleTickers) ); } + protected void addGenomeToBestGenomes(Genome genome, + DateTime firstOptimizationDate, + DateTime secondOptimizationDate, + int eligibleTickers, int halfPeriodDays) + { + if(this.bestGenomes == null) + this.bestGenomes = new ArrayList(); + + this.bestGenomes.Add(new GenomeRepresentation(genome, + firstOptimizationDate, + secondOptimizationDate, + genome.Generation, + eligibleTickers, + halfPeriodDays)); + } + + protected void addGenomeToBestGenomes(Genome genome, + DateTime firstOptimizationDate, + DateTime secondOptimizationDate, + int eligibleTickers, int halfPeriodDays, + PortfolioType portfolioType) + { + if(this.bestGenomes == null) + this.bestGenomes = new ArrayList(); + + this.bestGenomes.Add(new GenomeRepresentation(genome, + firstOptimizationDate, + secondOptimizationDate, + genome.Generation, + eligibleTickers, + halfPeriodDays, portfolioType)); + } + public virtual void MarketOpenEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) Index: EndOfDayTimerHandlerOTCMultiday.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerOTCMultiday.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** EndOfDayTimerHandlerOTCMultiday.cs 3 Aug 2006 21:31:15 -0000 1.5 --- EndOfDayTimerHandlerOTCMultiday.cs 7 Aug 2006 21:09:15 -0000 1.6 *************** *** 134,156 **** } ! private string[] setTickers_getBestTickersLosingAtLastDay(IGenomeManager genomeManager) ! { ! string[] returnValue = ! ((GenomeMeaning)genomeManager.CurrentGeneticOptimizer.BestGenome.Meaning).Tickers; ! int numOfGenomes = genomeManager.CurrentGeneticOptimizer.CurrentGeneration.Count; ! int i; ! for(i = 0;i<numOfGenomes; i++) ! { ! if(((GenomeMeaning)((Genome)genomeManager.CurrentGeneticOptimizer.CurrentGeneration[numOfGenomes - i - 1]).Meaning).ReturnAtLastDayInSample < 0) ! //the current portfolio has a negative return at the last day in sample ! { ! returnValue = ! ((GenomeMeaning)((Genome)genomeManager.CurrentGeneticOptimizer.CurrentGeneration[numOfGenomes - i - 1]).Meaning).Tickers; ! i = numOfGenomes; ! } ! } ! ! return returnValue; ! } protected virtual void setTickers(DateTime currentDate, --- 134,156 ---- } ! // private string[] setTickers_getBestTickersLosingAtLastDay(IGenomeManager genomeManager) ! // { ! // string[] returnValue = ! // ((GenomeMeaning)genomeManager.CurrentGeneticOptimizer.BestGenome.Meaning).Tickers; ! // int numOfGenomes = genomeManager.CurrentGeneticOptimizer.CurrentGeneration.Count; ! // int i; ! // for(i = 0;i<numOfGenomes; i++) ! // { ! // if(((GenomeMeaning)((Genome)genomeManager.CurrentGeneticOptimizer.CurrentGeneration[numOfGenomes - i - 1]).Meaning).ReturnAtLastDayInSample < 0) ! // //the current portfolio has a negative return at the last day in sample ! // { ! // returnValue = ! // ((GenomeMeaning)((Genome)genomeManager.CurrentGeneticOptimizer.CurrentGeneration[numOfGenomes - i - 1]).Meaning).Tickers; ! // i = numOfGenomes; ! // } ! // } ! // ! // return returnValue; ! // } protected virtual void setTickers(DateTime currentDate, |
|
From: Marco M. <mi...@us...> - 2006-08-07 21:09:18
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/TrendFollowing/ImmediateTrendFollower In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24647/b7_Scripts/TechnicalAnalysisTesting/TrendFollowing/ImmediateTrendFollower Modified Files: EndOfDayTimerHandlerITF.cs Log Message: Updated the base handler for tickerSelection strategies (OTC, etc.) and for other strategies (ECT, FixedPeriodOscillator, ImmediateTrendFollower). Index: EndOfDayTimerHandlerITF.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/TrendFollowing/ImmediateTrendFollower/EndOfDayTimerHandlerITF.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EndOfDayTimerHandlerITF.cs 3 Aug 2006 21:14:13 -0000 1.1 --- EndOfDayTimerHandlerITF.cs 7 Aug 2006 21:09:15 -0000 1.2 *************** *** 57,60 **** --- 57,61 ---- private DateTime lastCloseDate; private IGenomeManager iGenomeManager; + private int seedForRandomGenerator; public EndOfDayTimerHandlerITF(string tickerGroupID, int numberOfEligibleTickers, *************** *** 81,84 **** --- 82,86 ---- // this.numDaysBetweenEachOptimization = 2* numDaysForReturnCalculation; this.numDaysBetweenEachOptimization = numDaysBetweenEachOptimization; + this.seedForRandomGenerator = ConstantsProvider.SeedForRandomGenerator; } *************** *** 135,141 **** SignedTicker.ChangeSignOfEachTicker(this.chosenTickers); //short the portfolio ! try{ base.openPositions(); } ! catch(Exception ex){ ex = ex; } ! finally{SignedTicker.ChangeSignOfEachTicker(this.chosenTickers);} } } --- 137,150 ---- SignedTicker.ChangeSignOfEachTicker(this.chosenTickers); //short the portfolio ! try{ ! base.openPositions(); ! } ! catch(Exception ex) ! { ! ex = ex; ! } ! finally{ ! SignedTicker.ChangeSignOfEachTicker(this.chosenTickers); ! } } } *************** *** 144,148 **** private void marketCloseEventHandler_closePositions() { - this.daysCounterWithPositions++; if(this.daysCounterWithPositions == this.numDaysForReturnCalculation || this.stopLossConditionReached) --- 153,156 ---- *************** *** 158,161 **** --- 166,171 ---- { //this.marketCloseEventHandler_updateStopLossCondition(); + if(this.account.Portfolio.Count > 0) + this.daysCounterWithPositions++; this.marketCloseEventHandler_closePositions(); if(this.chosenTickers[0] != null) *************** *** 184,193 **** numOfTickersInGroupAtCurrentDate, 30,500, 0.0001,100); ! ! // SelectorByLiquidity mostLiquidSelector = ! // new SelectorByLiquidity(byPrice.GetTableOfSelectedTickers(), ! // false,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, ! // this.numberOfEligibleTickers); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromByPrice = new SelectorByQuotationAtEachMarketDay(byPrice.GetTableOfSelectedTickers(), --- 194,198 ---- numOfTickersInGroupAtCurrentDate, 30,500, 0.0001,100); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromByPrice = new SelectorByQuotationAtEachMarketDay(byPrice.GetTableOfSelectedTickers(), *************** *** 195,204 **** numOfTickersInGroupAtCurrentDate, this.benchmark); ! SelectorByCloseToCloseVolatility lessVolatile = ! new SelectorByCloseToCloseVolatility(quotedAtEachMarketDayFromByPrice.GetTableOfSelectedTickers(), ! true,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, ! this.numberOfEligibleTickers); ! return lessVolatile.GetTableOfSelectedTickers(); //OLD for etf // SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, --- 200,215 ---- numOfTickersInGroupAtCurrentDate, this.benchmark); ! // SelectorByCloseToCloseVolatility lessVolatile = ! // new SelectorByCloseToCloseVolatility(quotedAtEachMarketDayFromByPrice.GetTableOfSelectedTickers(), ! // true,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, ! // this.numberOfEligibleTickers); ! SelectorByLiquidity mostLiquidSelector = ! new SelectorByLiquidity(quotedAtEachMarketDayFromByPrice.GetTableOfSelectedTickers(), ! true,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, ! this.numberOfEligibleTickers); ! ! ! return mostLiquidSelector.GetTableOfSelectedTickers(); //OLD for etf // SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, *************** *** 247,251 **** this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, ! ConstantsProvider.SeedForRandomGenerator); if(setGenomeCounter) this.genomeCounter = new GenomeCounter(GO); --- 258,262 ---- this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, ! this.seedForRandomGenerator); if(setGenomeCounter) this.genomeCounter = new GenomeCounter(GO); *************** *** 253,257 **** GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,((GenomeManagerForEfficientPortfolio)this.iGenomeManager).FirstQuoteDate, ! ((GenomeManagerForEfficientPortfolio)this.iGenomeManager).LastQuoteDate, setOfTickersToBeOptimized.Rows.Count); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; --- 264,269 ---- GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,((GenomeManagerForEfficientPortfolio)this.iGenomeManager).FirstQuoteDate, ! ((GenomeManagerForEfficientPortfolio)this.iGenomeManager).LastQuoteDate, setOfTickersToBeOptimized.Rows.Count, ! this.numDaysForReturnCalculation); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; *************** *** 270,274 **** { this.lastCloseDate = endOfDayTimingEventArgs.EndOfDayDateTime.DateTime; ! ConstantsProvider.SeedForRandomGenerator++; this.numDaysElapsedSinceLastOptimization++; this.orders.Clear(); --- 282,286 ---- { this.lastCloseDate = endOfDayTimingEventArgs.EndOfDayDateTime.DateTime; ! this.seedForRandomGenerator++; this.numDaysElapsedSinceLastOptimization++; this.orders.Clear(); |
|
From: Marco M. <mi...@us...> - 2006-08-07 21:09:18
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/ExtremeCounterTrend In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24647/b7_Scripts/TechnicalAnalysisTesting/Oscillators/ExtremeCounterTrend Modified Files: EndOfDayTimerHandlerECT.cs Log Message: Updated the base handler for tickerSelection strategies (OTC, etc.) and for other strategies (ECT, FixedPeriodOscillator, ImmediateTrendFollower). Index: EndOfDayTimerHandlerECT.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/ExtremeCounterTrend/EndOfDayTimerHandlerECT.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EndOfDayTimerHandlerECT.cs 3 Aug 2006 21:31:16 -0000 1.3 --- EndOfDayTimerHandlerECT.cs 7 Aug 2006 21:09:15 -0000 1.4 *************** *** 61,64 **** --- 61,65 ---- private DateTime lastCloseDate; private IGenomeManager iGenomeManager; + private int seedForRandomGenerator; public EndOfDayTimerHandlerECT(string tickerGroupID, int numberOfEligibleTickers, *************** *** 88,91 **** --- 89,93 ---- // this.numDaysBetweenEachOptimization = 2* numDaysForReturnCalculation; this.numDaysBetweenEachOptimization = numDaysBetweenEachOptimization; + this.seedForRandomGenerator = ConstantsProvider.SeedForRandomGenerator; } *************** *** 138,148 **** if(lastHalfPeriodGain < 0.0) base.openPositions(); ! else { SignedTicker.ChangeSignOfEachTicker(this.chosenTickers); //short the portfolio ! try{ base.openPositions(); } ! catch(Exception ex){ ex = ex; } ! finally{SignedTicker.ChangeSignOfEachTicker(this.chosenTickers);} } } --- 140,158 ---- if(lastHalfPeriodGain < 0.0) base.openPositions(); ! else if (lastHalfPeriodGain > 0.0 && ! this.portfolioType == PortfolioType.ShortAndLong) { SignedTicker.ChangeSignOfEachTicker(this.chosenTickers); //short the portfolio ! try{ ! base.openPositions(); ! } ! catch(Exception ex) ! { ! ex = ex; ! } ! finally{ ! SignedTicker.ChangeSignOfEachTicker(this.chosenTickers); ! } } } *************** *** 151,155 **** private void marketCloseEventHandler_closePositions() { - this.daysCounterWithPositions++; if(this.daysCounterWithPositions == this.numDaysForReturnCalculation || this.stopLossConditionReached) --- 161,164 ---- *************** *** 164,167 **** --- 173,178 ---- Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { + if(this.account.Portfolio.Count > 0) + this.daysCounterWithPositions++; //this.marketCloseEventHandler_updateStopLossCondition(); this.marketCloseEventHandler_closePositions(); *************** *** 186,194 **** int numOfTickersInGroupAtCurrentDate = tickersFromGroup.Rows.Count; ! SelectorByAverageRawOpenPrice byPrice = ! new SelectorByAverageRawOpenPrice(tickersFromGroup,false,currentDate, ! currentDate.AddDays(-30), ! numOfTickersInGroupAtCurrentDate, ! 30,500, 0.0001,100); // SelectorByLiquidity mostLiquidSelector = --- 197,205 ---- int numOfTickersInGroupAtCurrentDate = tickersFromGroup.Rows.Count; ! // SelectorByAverageRawOpenPrice byPrice = ! // new SelectorByAverageRawOpenPrice(tickersFromGroup,false,currentDate, ! // currentDate.AddDays(-30), ! // numOfTickersInGroupAtCurrentDate, ! // 30,500, 0.0001,100); // SelectorByLiquidity mostLiquidSelector = *************** *** 197,211 **** // this.numberOfEligibleTickers); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromByPrice = ! new SelectorByQuotationAtEachMarketDay(byPrice.GetTableOfSelectedTickers(), false, currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, numOfTickersInGroupAtCurrentDate, this.benchmark); ! SelectorByCloseToCloseVolatility lessVolatile = ! new SelectorByCloseToCloseVolatility(quotedAtEachMarketDayFromByPrice.GetTableOfSelectedTickers(), ! true,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, ! this.numberOfEligibleTickers); ! ! return lessVolatile.GetTableOfSelectedTickers(); //OLD for etf // SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, --- 208,224 ---- // this.numberOfEligibleTickers); ! // SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromByPrice = ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromGroup = ! new SelectorByQuotationAtEachMarketDay(tickersFromGroup, false, currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, numOfTickersInGroupAtCurrentDate, this.benchmark); ! // SelectorByCloseToCloseVolatility lessVolatile = ! // new SelectorByCloseToCloseVolatility(quotedAtEachMarketDayFromByPrice.GetTableOfSelectedTickers(), ! // true,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, ! // this.numberOfEligibleTickers); ! // ! // return lessVolatile.GetTableOfSelectedTickers(); ! return quotedAtEachMarketDayFromGroup.GetTableOfSelectedTickers(); //OLD for etf // SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, *************** *** 254,258 **** this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, ! ConstantsProvider.SeedForRandomGenerator); if(setGenomeCounter) this.genomeCounter = new GenomeCounter(GO); --- 267,272 ---- this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, ! this.seedForRandomGenerator); ! GO.CrossoverRate = 0.50; if(setGenomeCounter) this.genomeCounter = new GenomeCounter(GO); *************** *** 260,264 **** GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,((GenomeManagerForEfficientPortfolio)this.iGenomeManager).FirstQuoteDate, ! ((GenomeManagerForEfficientPortfolio)this.iGenomeManager).LastQuoteDate, setOfTickersToBeOptimized.Rows.Count); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; --- 274,279 ---- GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,((GenomeManagerForEfficientPortfolio)this.iGenomeManager).FirstQuoteDate, ! ((GenomeManagerForEfficientPortfolio)this.iGenomeManager).LastQuoteDate, setOfTickersToBeOptimized.Rows.Count, ! this.numDaysForReturnCalculation, this.portfolioType); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; *************** *** 277,281 **** { this.lastCloseDate = endOfDayTimingEventArgs.EndOfDayDateTime.DateTime; ! ConstantsProvider.SeedForRandomGenerator++; this.numDaysElapsedSinceLastOptimization++; this.orders.Clear(); --- 292,296 ---- { this.lastCloseDate = endOfDayTimingEventArgs.EndOfDayDateTime.DateTime; ! this.seedForRandomGenerator++; this.numDaysElapsedSinceLastOptimization++; this.orders.Clear(); |
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22618/b7_Scripts/TickerSelectionTesting Modified Files: GenomeManagerForEfficientPortfolio.cs GenomeManagerForWeightedEfficientPortfolio.cs GenomeManipulator.cs Log Message: Changed IGenomeManager interface. Now, properties MinValueForGenes and MaxValueForGenes have been replaced by GetMinValueForGenes(int genePosition) and GetMaxValueForGenes(int genePosition) methods. Property CurrentGeneticOptimizer has been deleted from the interface. Modified the constructor of Genome class: now a GeneticOptimizer object is necessary for a creating a new instance of Genome. Some useless code has been deleted through out the classes used for genetic optimization. Index: GenomeManagerForEfficientPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForEfficientPortfolio.cs,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** GenomeManagerForEfficientPortfolio.cs 14 May 2006 18:35:46 -0000 1.23 --- GenomeManagerForEfficientPortfolio.cs 7 Aug 2006 21:03:24 -0000 1.24 *************** *** 73,84 **** } ! public int MinValueForGenes { ! get{return this.minValueForGenes;} } ! public int MaxValueForGenes { ! get{return this.maxValueForGenes;} } //end of implementation for properties --- 73,84 ---- } ! public int GetMinValueForGenes(int genePosition) { ! return this.minValueForGenes; } ! public int GetMaxValueForGenes(int genePosition) { ! return this.maxValueForGenes; } //end of implementation for properties *************** *** 100,108 **** } - public GeneticOptimizer CurrentGeneticOptimizer - { - get{return this.currentGeneticOptimizer;} - set{this.currentGeneticOptimizer = value;} - } public double[] PortfolioRatesOfReturn { --- 100,103 ---- *************** *** 145,154 **** private void setMinAndMaxValueForGenes() { ! this.minValueForGenes = 0; ! this.maxValueForGenes = this.originalNumOfTickers - 1; ! ! if(this.portfolioType == PortfolioType.ShortAndLong) ! this.minValueForGenes = - this.originalNumOfTickers; ! //if gene g is negative, it refers to the ticker |g|-1 to be shorted } --- 140,162 ---- private void setMinAndMaxValueForGenes() { ! switch (this.portfolioType) ! { ! case QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios.PortfolioType.OnlyLong : ! //OnlyLong orders are admitted ! this.minValueForGenes = 0; ! this.maxValueForGenes = this.originalNumOfTickers - 1; ! break; ! case QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios.PortfolioType.OnlyShort : ! //OnlyShort orders are admitted ! this.minValueForGenes = - this.originalNumOfTickers; ! //if gene g is negative, it refers to the ticker |g|-1 to be shorted ! this.maxValueForGenes = 0; ! break; ! case QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios.PortfolioType.ShortAndLong : ! //Both Long and Short orders are admitted ! this.minValueForGenes = - this.originalNumOfTickers; ! this.maxValueForGenes = this.originalNumOfTickers - 1; ! break; ! } } *************** *** 245,256 **** // the generation of new genes doesn't depend on gene's position // within the genome ! int returnValue = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); while(GenomeManipulator.IsTickerContainedInGenome(returnValue, genome) ) //the portfolio can't have a long position and a short one for the same ticker { ! returnValue = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); } --- 253,264 ---- // the generation of new genes doesn't depend on gene's position // within the genome ! int returnValue = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePosition), ! genome.GetMaxValueForGenes(genePosition) + 1); while(GenomeManipulator.IsTickerContainedInGenome(returnValue, genome) ) //the portfolio can't have a long position and a short one for the same ticker { ! returnValue = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePosition), ! genome.GetMaxValueForGenes(genePosition) + 1); } *************** *** 262,268 **** // in this implementation only one gene is mutated // the new value has to be different from all the other genes of the genome ! int newValueForGene = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes +1); ! int genePositionToBeMutated = GenomeManagement.RandomGenerator.Next(genome.Size); while(GenomeManipulator.IsTickerContainedInGenome(newValueForGene, genome) ) --- 270,277 ---- // in this implementation only one gene is mutated // the new value has to be different from all the other genes of the genome ! int genePositionToBeMutated = GenomeManagement.RandomGenerator.Next(genome.Size); ! int newValueForGene = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePositionToBeMutated), ! genome.GetMaxValueForGenes(genePositionToBeMutated) + 1); ! while(GenomeManipulator.IsTickerContainedInGenome(newValueForGene, genome) ) *************** *** 271,276 **** // for the same ticker { ! newValueForGene = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); } GenomeManagement.MutateOneGene(genome, mutationRate, --- 280,285 ---- // for the same ticker { ! newValueForGene = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePositionToBeMutated), ! genome.GetMaxValueForGenes(genePositionToBeMutated) + 1); } GenomeManagement.MutateOneGene(genome, mutationRate, Index: GenomeManipulator.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManipulator.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GenomeManipulator.cs 26 Mar 2006 20:07:17 -0000 1.6 --- GenomeManipulator.cs 7 Aug 2006 21:03:24 -0000 1.7 *************** *** 205,212 **** { initializeStaticMembers(parent1, parent2); - if(parent1.Size > (parent1.MaxValueForGenes - parent1.MinValueForGenes + 1)) - //it is impossible not to duplicate genes if size is too - // large for the range of variation of each gene - throw new Exception("Impossible to avoid duplicates with the given size!"); if(parent1.Size != parent2.Size) throw new Exception("Genomes must have the same size!"); --- 205,208 ---- Index: GenomeManagerForWeightedEfficientPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForWeightedEfficientPortfolio.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GenomeManagerForWeightedEfficientPortfolio.cs 25 Jul 2006 15:22:50 -0000 1.4 --- GenomeManagerForWeightedEfficientPortfolio.cs 7 Aug 2006 21:03:24 -0000 1.5 *************** *** 127,132 **** // in this implementation only new gene values pointing to tickers // must be different from the others already stored (in odd positions of genome) ! int returnValue = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); while(genePosition%2 == 1 && GenomeManipulator.IsTickerContainedInGenome(returnValue,genome)) --- 127,132 ---- // in this implementation only new gene values pointing to tickers // must be different from the others already stored (in odd positions of genome) ! int returnValue = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePosition), ! genome.GetMaxValueForGenes(genePosition) + 1); while(genePosition%2 == 1 && GenomeManipulator.IsTickerContainedInGenome(returnValue,genome)) *************** *** 137,142 **** { // a new returnValue has to be generated ! returnValue = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); } --- 137,142 ---- { // a new returnValue has to be generated ! returnValue = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePosition), ! genome.GetMaxValueForGenes(genePosition) + 1); } *************** *** 147,153 **** { // in this implementation only one gene is mutated ! int newValueForGene = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes +1); ! int genePositionToBeMutated = GenomeManagement.RandomGenerator.Next(genome.Size); while(genePositionToBeMutated%2 == 1 && GenomeManipulator.IsTickerContainedInGenome(newValueForGene,genome)) --- 147,154 ---- { // in this implementation only one gene is mutated ! int genePositionToBeMutated = GenomeManagement.RandomGenerator.Next(genome.Size); ! int newValueForGene = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePositionToBeMutated), ! genome.GetMaxValueForGenes(genePositionToBeMutated) +1); ! while(genePositionToBeMutated%2 == 1 && GenomeManipulator.IsTickerContainedInGenome(newValueForGene,genome)) *************** *** 157,162 **** //already stored in the given genome { ! newValueForGene = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); } GenomeManagement.MutateOneGene(genome, mutationRate, --- 158,163 ---- //already stored in the given genome { ! newValueForGene = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePositionToBeMutated), ! genome.GetMaxValueForGenes(genePositionToBeMutated) +1); } GenomeManagement.MutateOneGene(genome, mutationRate, |
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22618/b1_ADT/Optimizing/Genetic Modified Files: GeneticOptimizer.cs Genome.cs GenomeManagement.cs GenomeManagerTest.cs IGenomeManager.cs Log Message: Changed IGenomeManager interface. Now, properties MinValueForGenes and MaxValueForGenes have been replaced by GetMinValueForGenes(int genePosition) and GetMaxValueForGenes(int genePosition) methods. Property CurrentGeneticOptimizer has been deleted from the interface. Modified the constructor of Genome class: now a GeneticOptimizer object is necessary for a creating a new instance of Genome. Some useless code has been deleted through out the classes used for genetic optimization. Index: GenomeManagerTest.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/GenomeManagerTest.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GenomeManagerTest.cs 8 Nov 2005 18:32:25 -0000 1.5 --- GenomeManagerTest.cs 7 Aug 2006 21:03:24 -0000 1.6 *************** *** 37,42 **** private int minValueForGenes; private int maxValueForGenes; ! private GeneticOptimizer currentGeneticOptimizer; ! public int GenomeSize { --- 37,41 ---- private int minValueForGenes; private int maxValueForGenes; ! public int GenomeSize { *************** *** 44,62 **** } ! public int MinValueForGenes ! { ! get{return this.minValueForGenes;} ! } ! ! public int MaxValueForGenes ! { ! get{return this.maxValueForGenes;} ! } ! ! public GeneticOptimizer CurrentGeneticOptimizer ! { ! get{return this.currentGeneticOptimizer;} ! set{this.currentGeneticOptimizer = value;} ! } public GenomeManagerTest(int genomeSize, int minValueForGenes, int maxValueForGenes) --- 43,47 ---- } ! public GenomeManagerTest(int genomeSize, int minValueForGenes, int maxValueForGenes) *************** *** 68,75 **** } public int GetNewGeneValue(Genome genome, int genePosition) { ! return GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); } --- 53,70 ---- } + public int GetMinValueForGenes(int genePosition) + { + return this.minValueForGenes; + } + + public int GetMaxValueForGenes(int genePosition) + { + return this.maxValueForGenes; + } + public int GetNewGeneValue(Genome genome, int genePosition) { ! return GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePosition), ! genome.GetMaxValueForGenes(genePosition) + 1); } Index: Genome.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/Genome.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Genome.cs 2 Aug 2006 21:55:42 -0000 1.12 --- Genome.cs 7 Aug 2006 21:03:24 -0000 1.13 *************** *** 35,40 **** { private int[] genes; - private int minValueForGenes; - private int maxValueForGenes; private int size; private double fitness; --- 35,38 ---- *************** *** 44,47 **** --- 42,46 ---- private IGenomeManager genomeManager; + private GeneticOptimizer geneticOptimizer; private int generation; *************** *** 84,95 **** } ! public int MinValueForGenes { ! get{return this.minValueForGenes;} } ! ! public int MaxValueForGenes { ! get{return this.maxValueForGenes;} } --- 83,94 ---- } ! public int GetMinValueForGenes(int genePosition) { ! return this.genomeManager.GetMinValueForGenes(genePosition); } ! ! public int GetMaxValueForGenes(int genePosition) { ! return this.genomeManager.GetMaxValueForGenes(genePosition); } *************** *** 120,129 **** /// It creates a new genome object initialized by a IGenomeManager /// </summary> ! public Genome(IGenomeManager genomeManager) { this.genomeManager = genomeManager; this.size = this.genomeManager.GenomeSize; - this.minValueForGenes = this.genomeManager.MinValueForGenes; - this.maxValueForGenes = this.genomeManager.MaxValueForGenes; this.genes = new int[ this.size ]; } --- 119,128 ---- /// It creates a new genome object initialized by a IGenomeManager /// </summary> ! public Genome(IGenomeManager genomeManager, ! GeneticOptimizer geneticOptimizer) { this.genomeManager = genomeManager; + this.geneticOptimizer = geneticOptimizer; this.size = this.genomeManager.GenomeSize; this.genes = new int[ this.size ]; } *************** *** 140,144 **** //whenever at least one gene has been written, //the current generation number is stored ! this.generation = this.genomeManager.CurrentGeneticOptimizer.GenerationCounter; } --- 139,143 ---- //whenever at least one gene has been written, //the current generation number is stored ! this.generation = this.geneticOptimizer.GenerationCounter; } *************** *** 154,158 **** public Genome Clone() { ! Genome returnValue = new Genome(this.genomeManager); returnValue.CopyValuesInGenes(this.genes); returnValue.Fitness = this.Fitness; --- 153,157 ---- public Genome Clone() { ! Genome returnValue = new Genome(this.genomeManager, this.geneticOptimizer); returnValue.CopyValuesInGenes(this.genes); returnValue.Fitness = this.Fitness; *************** *** 175,190 **** //whenever at least one gene has been written, //the current generation number is stored ! this.generation = this.genomeManager.CurrentGeneticOptimizer.GenerationCounter; } public void SetGeneValue(int geneValue, int genePosition) { ! if(genePosition >= this.size || genePosition<0) ! throw new IndexOutOfRangeException("Gene position not valid for the genome! "); this.genes[genePosition] = geneValue; //whenever at least one gene has been written, //the current generation number is stored ! this.generation = this.genomeManager.CurrentGeneticOptimizer.GenerationCounter; this.hasBeenChanged = true; } --- 174,191 ---- //whenever at least one gene has been written, //the current generation number is stored ! this.generation = this.geneticOptimizer.GenerationCounter; } public void SetGeneValue(int geneValue, int genePosition) { ! if(geneValue < this.GetMinValueForGenes(genePosition) || ! geneValue > this.GetMaxValueForGenes(genePosition) ) ! throw new IndexOutOfRangeException("Gene value not valid for the gene at" + ! " the given position!"); this.genes[genePosition] = geneValue; //whenever at least one gene has been written, //the current generation number is stored ! this.generation = this.geneticOptimizer.GenerationCounter; this.hasBeenChanged = true; } *************** *** 192,198 **** public int GetGeneValue(int genePosition) { - if(genePosition >= this.size || genePosition<0) - throw new IndexOutOfRangeException("Gene position not valid for the genome! "); - return this.genes[genePosition]; } --- 193,196 ---- Index: IGenomeManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/IGenomeManager.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IGenomeManager.cs 8 Nov 2005 18:32:25 -0000 1.3 --- IGenomeManager.cs 7 Aug 2006 21:03:24 -0000 1.4 *************** *** 30,50 **** /// an instance of the GeneticOptimizer class. /// ! /// The interface determines the genome format and provides: /// - an objective function used to calculate genome's fitness; ! /// - a decode function used to calculate genome's meaning as an object; /// - a GetChilds method used by the genetic optimizer to generate new ! /// population; /// - a Mutate method used by the genetic optimizer to mutate a /// given genome /// </summary> public interface IGenomeManager { int GenomeSize{get;} ! int MinValueForGenes{get;} ! int MaxValueForGenes{get;} ! GeneticOptimizer CurrentGeneticOptimizer{get;set;} ! ! int GetNewGeneValue(Genome genome, int genePosition); // Used in generation of genes ! // by the Genome parameter double GetFitnessValue(Genome genome); object Decode(Genome genome); --- 30,49 ---- /// an instance of the GeneticOptimizer class. /// ! /// The interface determines the genome format (size and min and max vaules for genes) ! /// and provides: /// - an objective function used to calculate genome's fitness; ! /// - a decode function used to determine genome's meaning as an object; /// - a GetChilds method used by the genetic optimizer to generate new ! /// offspring; /// - a Mutate method used by the genetic optimizer to mutate a /// given genome + /// - a method for production of new genes value (GetNewGeneValue) /// </summary> public interface IGenomeManager { int GenomeSize{get;} ! int GetMaxValueForGenes(int genePosition); ! int GetMinValueForGenes(int genePosition); ! int GetNewGeneValue(Genome genome, int genePosition); double GetFitnessValue(Genome genome); object Decode(Genome genome); Index: GenomeManagement.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/GenomeManagement.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GenomeManagement.cs 2 Aug 2006 17:19:30 -0000 1.9 --- GenomeManagement.cs 7 Aug 2006 21:03:24 -0000 1.10 *************** *** 178,183 **** { if (GenomeManagement.RandomGenerator.Next(0,101) < (int)(mutationRate*100)) ! genome.SetGeneValue(GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1), pos); } } --- 178,183 ---- { if (GenomeManagement.RandomGenerator.Next(0,101) < (int)(mutationRate*100)) ! genome.SetGeneValue(GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(pos), ! genome.GetMaxValueForGenes(pos) + 1), pos); } } *************** *** 188,193 **** if (GenomeManagement.RandomGenerator.Next(0,101) < (int)(mutationRate*100)) ! genome.SetGeneValue(GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1), genePosition); } --- 188,193 ---- if (GenomeManagement.RandomGenerator.Next(0,101) < (int)(mutationRate*100)) ! genome.SetGeneValue(GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePosition), ! genome.GetMaxValueForGenes(genePosition) + 1), genePosition); } *************** *** 272,279 **** { initializeStaticMembers(parent1, parent2); - if(parent1.Size > (parent1.MaxValueForGenes - parent1.MinValueForGenes + 1)) - //it is impossible not to duplicate genes if size is too - // large for the range of variation of each gene - throw new Exception("Impossible to avoid duplicates with the given size!"); if(parent1.Size != parent2.Size) throw new Exception("Genomes must have the same size!"); --- 272,275 ---- Index: GeneticOptimizer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/GeneticOptimizer.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** GeneticOptimizer.cs 4 Aug 2006 15:30:41 -0000 1.16 --- GeneticOptimizer.cs 7 Aug 2006 21:03:24 -0000 1.17 *************** *** 51,56 **** private int generationNumber; private int genomeSize; - private int minValueForGenes; - private int maxValueForGenes; private double totalFitness; private Genome bestGenome; --- 51,54 ---- *************** *** 211,216 **** this.generationNumber = generationNumber; this.genomeSize = this.genomeManager.GenomeSize; - this.minValueForGenes = this.genomeManager.MinValueForGenes; - this.maxValueForGenes = this.genomeManager.MaxValueForGenes; this.genomeComparer = new GenomeComparer(); this.cumulativeFitnessList = new ArrayList(this.PopulationSize); --- 209,212 ---- *************** *** 221,225 **** eliteNumber); this.generationCounter = 1; - this.genomeManager.CurrentGeneticOptimizer = this; } --- 217,220 ---- *************** *** 393,397 **** for (int i = 0; i < this.populationSize; i++) { ! Genome g = new Genome(this.genomeManager); g.CreateGenes(); g.CalculateFitness(); --- 388,392 ---- for (int i = 0; i < this.populationSize; i++) { ! Genome g = new Genome(this.genomeManager, this); g.CreateGenes(); g.CalculateFitness(); |
|
From: Marco M. <mi...@us...> - 2006-08-07 21:03:30
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/PairTrading/SimplePairTrading In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22618/b7_Scripts/ArbitrageTesting/PairTrading/SimplePairTrading Modified Files: GenomeManagerForSimplePT.cs SimplePTGenomeManipulator.cs Log Message: Changed IGenomeManager interface. Now, properties MinValueForGenes and MaxValueForGenes have been replaced by GetMinValueForGenes(int genePosition) and GetMaxValueForGenes(int genePosition) methods. Property CurrentGeneticOptimizer has been deleted from the interface. Modified the constructor of Genome class: now a GeneticOptimizer object is necessary for a creating a new instance of Genome. Some useless code has been deleted through out the classes used for genetic optimization. Index: SimplePTGenomeManipulator.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/PairTrading/SimplePairTrading/SimplePTGenomeManipulator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SimplePTGenomeManipulator.cs 14 May 2006 15:25:30 -0000 1.1 --- SimplePTGenomeManipulator.cs 7 Aug 2006 21:03:24 -0000 1.2 *************** *** 106,113 **** { initializeStaticMembers(parent1, parent2); - if(parent1.Size > (parent1.MaxValueForGenes - parent1.MinValueForGenes + 1)) - //it is impossible not to duplicate genes if size is too - // large for the range of variation of each gene - throw new Exception("Impossible to avoid duplicates with the given size!"); if(parent1.Size != parent2.Size) throw new Exception("Genomes must have the same size!"); --- 106,109 ---- Index: GenomeManagerForSimplePT.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/PairTrading/SimplePairTrading/GenomeManagerForSimplePT.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GenomeManagerForSimplePT.cs 14 May 2006 15:25:30 -0000 1.1 --- GenomeManagerForSimplePT.cs 7 Aug 2006 21:03:24 -0000 1.2 *************** *** 51,55 **** private int minValueForGenes; private int maxValueForGenes; - private GeneticOptimizer currentGeneticOptimizer; private float[] gaps; //it will contain absolute gaps of gain for tickers --- 51,54 ---- *************** *** 62,80 **** } ! public int MinValueForGenes { ! get{return this.minValueForGenes;} } ! public int MaxValueForGenes { ! get{return this.maxValueForGenes;} } - public GeneticOptimizer CurrentGeneticOptimizer - { - get{return this.currentGeneticOptimizer;} - set{this.currentGeneticOptimizer = value;} - } //end of interface implementation for properties --- 61,74 ---- } ! public int GetMinValueForGenes(int genePosition) { ! return this.minValueForGenes; } ! public int GetMaxValueForGenes(int genePosition) { ! return this.maxValueForGenes; } //end of interface implementation for properties *************** *** 189,194 **** // the one contained in 3° or 2° position { ! returnValue = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); while(genePosition>0 && SimplePTGenomeManipulator.IsTickerContainedInGenome(returnValue, --- 183,188 ---- // the one contained in 3° or 2° position { ! returnValue = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePosition), ! genome.GetMaxValueForGenes(genePosition) + 1); while(genePosition>0 && SimplePTGenomeManipulator.IsTickerContainedInGenome(returnValue, *************** *** 200,205 **** { // a new returnValue has to be generated ! returnValue = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); } } --- 194,199 ---- { // a new returnValue has to be generated ! returnValue = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePosition), ! genome.GetMaxValueForGenes(genePosition) + 1); } } *************** *** 220,225 **** else { ! newValueForGene = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); while(genePositionToBeMutated>0 && SimplePTGenomeManipulator.IsTickerContainedInGenome(newValueForGene, --- 214,219 ---- else { ! newValueForGene = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePositionToBeMutated), ! genome.GetMaxValueForGenes(genePositionToBeMutated) + 1); while(genePositionToBeMutated>0 && SimplePTGenomeManipulator.IsTickerContainedInGenome(newValueForGene, *************** *** 230,235 **** //already stored in the given genome { ! newValueForGene = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); } --- 224,229 ---- //already stored in the given genome { ! newValueForGene = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePositionToBeMutated), ! genome.GetMaxValueForGenes(genePositionToBeMutated) + 1); } |
|
From: Marco M. <mi...@us...> - 2006-08-07 21:03:30
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors/ByLinearIndipendence In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22618/b3_Data/Selectors/ByLinearIndipendence Modified Files: GenomeManagerForMaxLinearIndipendenceSelector.cs Log Message: Changed IGenomeManager interface. Now, properties MinValueForGenes and MaxValueForGenes have been replaced by GetMinValueForGenes(int genePosition) and GetMaxValueForGenes(int genePosition) methods. Property CurrentGeneticOptimizer has been deleted from the interface. Modified the constructor of Genome class: now a GeneticOptimizer object is necessary for a creating a new instance of Genome. Some useless code has been deleted through out the classes used for genetic optimization. Index: GenomeManagerForMaxLinearIndipendenceSelector.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/ByLinearIndipendence/GenomeManagerForMaxLinearIndipendenceSelector.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GenomeManagerForMaxLinearIndipendenceSelector.cs 2 Jul 2006 19:17:20 -0000 1.1 --- GenomeManagerForMaxLinearIndipendenceSelector.cs 7 Aug 2006 21:03:24 -0000 1.2 *************** *** 46,50 **** private int minValueForGenes; private int maxValueForGenes; - private GeneticOptimizer currentGeneticOptimizer; private double[,] correlationMatrix; --- 46,49 ---- *************** *** 55,73 **** } - public int MinValueForGenes - { - get{return this.minValueForGenes;} - } - - public int MaxValueForGenes - { - get{return this.maxValueForGenes;} - } - - public GeneticOptimizer CurrentGeneticOptimizer - { - get{return this.currentGeneticOptimizer;} - set{this.currentGeneticOptimizer = value;} - } //end of interface implementation for properties --- 54,57 ---- *************** *** 86,89 **** --- 70,83 ---- } + public int GetMinValueForGenes(int genePosition) + { + return this.minValueForGenes; + } + + public int GetMaxValueForGenes(int genePosition) + { + return this.maxValueForGenes; + } + private void setMinAndMaxValueForGenes() { *************** *** 135,145 **** public int GetNewGeneValue(Genome genome, int genePosition) { ! int returnValue = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); while( genome.HasGene(returnValue) ) //the genome to be examined shouldn't have a duplicate { ! returnValue = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); } return returnValue; --- 129,139 ---- public int GetNewGeneValue(Genome genome, int genePosition) { ! int returnValue = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePosition), ! genome.GetMaxValueForGenes(genePosition) + 1); while( genome.HasGene(returnValue) ) //the genome to be examined shouldn't have a duplicate { ! returnValue = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePosition), ! genome.GetMaxValueForGenes(genePosition) + 1); } return returnValue; *************** *** 148,159 **** public void Mutate(Genome genome, double mutationRate) { ! int newValueForGene = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes +1); ! int genePositionToBeMutated = GenomeManagement.RandomGenerator.Next(genome.Size); while( genome.HasGene(newValueForGene) ) //genome shouldn't have a duplicated gene { ! newValueForGene = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); } GenomeManagement.MutateOneGene(genome, mutationRate, --- 142,154 ---- public void Mutate(Genome genome, double mutationRate) { ! ! int genePositionToBeMutated = GenomeManagement.RandomGenerator.Next(genome.Size); ! int newValueForGene = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePositionToBeMutated), ! genome.GetMaxValueForGenes(genePositionToBeMutated) + 1); while( genome.HasGene(newValueForGene) ) //genome shouldn't have a duplicated gene { ! newValueForGene = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePositionToBeMutated), ! genome.GetMaxValueForGenes(genePositionToBeMutated) + 1); } GenomeManagement.MutateOneGene(genome, mutationRate, |
|
From: Marco M. <mi...@us...> - 2006-08-07 21:03:30
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/ExtremeCounterTrend In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22618/b7_Scripts/TechnicalAnalysisTesting/Oscillators/ExtremeCounterTrend Modified Files: GenomeManagerECT.cs Log Message: Changed IGenomeManager interface. Now, properties MinValueForGenes and MaxValueForGenes have been replaced by GetMinValueForGenes(int genePosition) and GetMaxValueForGenes(int genePosition) methods. Property CurrentGeneticOptimizer has been deleted from the interface. Modified the constructor of Genome class: now a GeneticOptimizer object is necessary for a creating a new instance of Genome. Some useless code has been deleted through out the classes used for genetic optimization. Index: GenomeManagerECT.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/ExtremeCounterTrend/GenomeManagerECT.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GenomeManagerECT.cs 2 Jul 2006 19:55:58 -0000 1.2 --- GenomeManagerECT.cs 7 Aug 2006 21:03:24 -0000 1.3 *************** *** 38,42 **** /// </summary> [Serializable] ! public class GenomeManagerECT : GenomeManagerForWeightedEfficientPortfolio { private int numDaysForReturnCalculation; --- 38,42 ---- /// </summary> [Serializable] ! public class GenomeManagerECT : GenomeManagerForEfficientPortfolio { private int numDaysForReturnCalculation; *************** *** 113,117 **** // return sharpeRatioAll;//*sharpeRatioSecondHalf; // return modifiedSharpeRatioAll; ! return AdvancedFunctions.GetExpectancyScore(equityLine); } --- 113,118 ---- // return sharpeRatioAll;//*sharpeRatioSecondHalf; // return modifiedSharpeRatioAll; ! //return AdvancedFunctions.GetExpectancyScore(equityLine); ! return AdvancedFunctions.GetSharpeRatio(equityLine); } *************** *** 135,143 **** for(int t=1;t<this.numDaysForReturnCalculation + 1;t++) { ! if(gainForTheLastHalfPeriod<0.0) // if gain of first half period is negative returnValue[i+t] = this.PortfolioRatesOfReturn[i+t]; ! else ! returnValue[i+t] = - this.PortfolioRatesOfReturn[i+t]; } --- 136,152 ---- for(int t=1;t<this.numDaysForReturnCalculation + 1;t++) { ! if(gainForTheLastHalfPeriod < 0.0) // if gain of first half period is negative returnValue[i+t] = this.PortfolioRatesOfReturn[i+t]; ! else if(gainForTheLastHalfPeriod > 0.0 && ! this.PortfolioType == PortfolioType.ShortAndLong) ! //if gain of first half period is positive and ! //original positions can be reversed ! returnValue[i+t] = - this.PortfolioRatesOfReturn[i+t]; ! else if(gainForTheLastHalfPeriod > 0.0 && ! this.PortfolioType != PortfolioType.ShortAndLong) ! //if gain of first half period is positive and ! //original positions can't be reversed ! returnValue[i+t] = 0.0;//out of the market } |
|
From: Marco M. <mi...@us...> - 2006-08-04 15:30:44
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24699/b1_ADT/Optimizing/Genetic Modified Files: GeneticOptimizer.cs Log Message: Fixed bug: now parameters elitismRate, mutationRate and crossoverRate are properly used by constructors Index: GeneticOptimizer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/GeneticOptimizer.cs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** GeneticOptimizer.cs 2 Jul 2006 19:53:26 -0000 1.15 --- GeneticOptimizer.cs 4 Aug 2006 15:30:41 -0000 1.16 *************** *** 33,37 **** /// The class needs to be initialized by an object implementing /// IGenomeManager interface ! /// Default GO parameters: crossoverRate = 0.85, mutationRate = 0.02, elitismRate = 0.01, /// populationSize = 1000, generationNumber = 100 /// keepOnRunningUntilConvergenceIsReached = false, minConvergenceRate = 0.80 --- 33,37 ---- /// The class needs to be initialized by an object implementing /// IGenomeManager interface ! /// Default GO parameters: crossoverRate = 0.85, mutationRate = 0.05, elitismRate = 0.01, /// populationSize = 1000, generationNumber = 100 /// keepOnRunningUntilConvergenceIsReached = false, minConvergenceRate = 0.80 *************** *** 164,172 **** int generationNumber) { ! this.genomeManager = genomeManager; ! this.populationSize = populationSize; ! this.generationNumber = generationNumber; this.random = new Random(ConstantsProvider.SeedForRandomGenerator); - this.commonInitialization(); } --- 164,169 ---- int generationNumber) { ! this.commonInitialization(genomeManager, populationSize, generationNumber); this.random = new Random(ConstantsProvider.SeedForRandomGenerator); } *************** *** 174,182 **** int generationNumber, int seedForRandomGenerator) { ! this.genomeManager = genomeManager; ! this.populationSize = populationSize; ! this.generationNumber = generationNumber; this.random = new Random(seedForRandomGenerator); - this.commonInitialization(); } --- 171,176 ---- int generationNumber, int seedForRandomGenerator) { ! this.commonInitialization(genomeManager, populationSize, generationNumber); this.random = new Random(seedForRandomGenerator); } *************** *** 185,196 **** IGenomeManager genomeManager) { this.crossoverRate = crossoverRate; this.mutationRate = mutationRate; this.elitismRate = elitismRate; - this.populationSize = populationSize; - this.generationNumber = generationNumber; - this.genomeManager = genomeManager; this.random = new Random(ConstantsProvider.SeedForRandomGenerator); - this.commonInitialization(); } --- 179,187 ---- IGenomeManager genomeManager) { + this.commonInitialization(genomeManager, populationSize, generationNumber); this.crossoverRate = crossoverRate; this.mutationRate = mutationRate; this.elitismRate = elitismRate; this.random = new Random(ConstantsProvider.SeedForRandomGenerator); } *************** *** 199,219 **** IGenomeManager genomeManager, int seedForRandomGenerator) { this.crossoverRate = crossoverRate; this.mutationRate = mutationRate; this.elitismRate = elitismRate; - this.populationSize = populationSize; - this.generationNumber = generationNumber; - this.genomeManager = genomeManager; this.random = new Random(seedForRandomGenerator); - this.commonInitialization(); } ! private void commonInitialization() { ! this.mutationRate = 0.20; ! this.crossoverRate = 0.99; ! this.elitismRate = 0.0; this.minConvergenceRate = 0.80; this.keepOnRunningUntilConvergenceIsReached = false; this.genomeSize = this.genomeManager.GenomeSize; this.minValueForGenes = this.genomeManager.MinValueForGenes; --- 190,213 ---- IGenomeManager genomeManager, int seedForRandomGenerator) { + this.commonInitialization(genomeManager, populationSize, generationNumber); this.crossoverRate = crossoverRate; this.mutationRate = mutationRate; this.elitismRate = elitismRate; this.random = new Random(seedForRandomGenerator); } ! private void commonInitialization(IGenomeManager genomeManager, ! int populationSize, int generationNumber) { ! //default parameters for the GO ! this.mutationRate = 0.05; ! this.crossoverRate = 0.85; ! this.elitismRate = 0.01; this.minConvergenceRate = 0.80; this.keepOnRunningUntilConvergenceIsReached = false; + + this.genomeManager = genomeManager; + this.populationSize = populationSize; + this.generationNumber = generationNumber; this.genomeSize = this.genomeManager.GenomeSize; this.minValueForGenes = this.genomeManager.MinValueForGenes; |
|
From: Marco M. <mi...@us...> - 2006-08-03 21:37:19
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23087/b7_Scripts Modified Files: Scripts_SD.csproj Log Message: Updated new SharpDevelop project files Index: Scripts_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/Scripts_SD.csproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Scripts_SD.csproj 2 Jul 2006 20:07:59 -0000 1.1 --- Scripts_SD.csproj 3 Aug 2006 21:37:15 -0000 1.2 *************** *** 163,166 **** --- 163,178 ---- <None Include="SimpleTesting\MSFTSimpleTest_2\TsMSFTsimpleTest_2.cs" /> <Compile Include="SimpleScriptsContainer.cs" /> + <Compile Include="WalkForwardTesting\WalkForwardLag\WFLagLogDebugger\WFLagLogDebugger.cs" /> + <Compile Include="WalkForwardTesting\WalkForwardLag\WFLagGenomesDebugger\WFLagChosenPositionsDebugInfo.cs" /> + <Compile Include="WalkForwardTesting\WalkForwardLag\WFLagGenomesDebugger\WFLagDebugChosenPositionsCollection.cs" /> + <Compile Include="WalkForwardTesting\WalkForwardLag\WFLagGenomesDebugger\WFLagRunGenomesDebugger.cs" /> + <Compile Include="WalkForwardTesting\WalkForwardLag\WFLagGenomesDebugger\WFLagSharpeRatioComputer.cs" /> + <Compile Include="TechnicalAnalysisTesting\TrendFollowing\ImmediateTrendFollower\EndOfDayTimerHandlerITF.cs" /> + <Compile Include="TechnicalAnalysisTesting\TrendFollowing\ImmediateTrendFollower\GenomeManagerITF.cs" /> + <Compile Include="TechnicalAnalysisTesting\TrendFollowing\ImmediateTrendFollower\RunImmediateTrendFollower.cs" /> + <Compile Include="WalkForwardTesting\WalkForwardLag\WeightedPositions.cs" /> + <Compile Include="WalkForwardTesting\WalkForwardLag\WFLagGenomeManagerWithWeights.cs" /> + <Compile Include="WalkForwardTesting\WalkForwardLag\WFLagWeightedPositions.cs" /> + <Compile Include="WalkForwardTesting\LinearCombination\ImmediateTrendFollowerStrategy.cs" /> </ItemGroup> <ItemGroup> *************** *** 193,196 **** --- 205,212 ---- <Name>b5_Presentation</Name> </ProjectReference> + <Folder Include="WalkForwardTesting\WalkForwardLag\WFLagLogDebugger" /> + <Folder Include="WalkForwardTesting\WalkForwardLag\WFLagGenomesDebugger" /> + <Folder Include="TechnicalAnalysisTesting\TrendFollowing" /> + <Folder Include="TechnicalAnalysisTesting\TrendFollowing\ImmediateTrendFollower" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
|
From: Marco M. <mi...@us...> - 2006-08-03 21:37:19
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23087/b4_Business Modified Files: Business_SD.csproj Log Message: Updated new SharpDevelop project files Index: Business_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/Business_SD.csproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Business_SD.csproj 2 Jul 2006 20:07:59 -0000 1.1 --- Business_SD.csproj 3 Aug 2006 21:37:15 -0000 1.2 *************** *** 153,156 **** --- 153,157 ---- <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\NumberNegativePeriods.cs" /> <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\NumberPositivePeriods.cs" /> + <Compile Include="a2_Strategies\WeightedPosition.cs" /> </ItemGroup> <ItemGroup> |
|
From: Marco M. <mi...@us...> - 2006-08-03 21:35:46
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22330/b4_Business Modified Files: Business.prjx Log Message: Updated old SharpDevelop project files (just to reduce the number of commitable files in WinCvs ...) Index: Business.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/Business.prjx,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Business.prjx 14 May 2006 08:59:15 -0000 1.9 --- Business.prjx 3 Aug 2006 21:35:42 -0000 1.10 *************** *** 100,103 **** --- 100,107 ---- <File name=".\a1_Financial\a2_Accounting\RebuildableAccount.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\a2_Strategies\SignedTicker.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\PercentagePositivePeriods.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\ExpectancyScore.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\NumberNegativePeriods.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\NumberPositivePeriods.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References> |
|
From: Marco M. <mi...@us...> - 2006-08-03 21:35:46
|
Update of /cvsroot/quantproject/QuantProject/b91_QuantProject In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22330/b91_QuantProject Modified Files: QuantProject.prjx Log Message: Updated old SharpDevelop project files (just to reduce the number of commitable files in WinCvs ...) Index: QuantProject.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b91_QuantProject/QuantProject.prjx,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** QuantProject.prjx 16 May 2006 15:50:43 -0000 1.6 --- QuantProject.prjx 3 Aug 2006 21:35:42 -0000 1.7 *************** *** 6,9 **** --- 6,10 ---- <File name=".\app.config" subtype="Code" buildaction="Nothing" dependson="" data="" /> <File name=".\App.ico" subtype="Code" buildaction="Nothing" dependson="" data="" /> + <File name=".\QuantProject.Principale.Principale.resources" subtype="Code" buildaction="EmbedAsResource" dependson="" data="" /> </Contents> <References> |
|
From: Marco M. <mi...@us...> - 2006-08-03 21:35:45
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22330/b7_Scripts Modified Files: Scripts.prjx Log Message: Updated old SharpDevelop project files (just to reduce the number of commitable files in WinCvs ...) Index: Scripts.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/Scripts.prjx,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Scripts.prjx 16 May 2006 15:50:43 -0000 1.20 --- Scripts.prjx 3 Aug 2006 21:35:42 -0000 1.21 *************** *** 98,102 **** <File name=".\ArbitrageTesting\PairTrading\SimplePairTrading\InSample\RunSimplePairTradingIS.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\EvaluatingOptimizationTechnique\EfficientPortfolio\RunTestingOptimizationOpenToCloseFitnessCombined.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> ! <File name=".\EvaluatingOptimizationTechnique\TechnicalAnalysis\RunTestingOptimizationExtremeCounterTrend.cs" subtype="Code" buildaction="Nothing" dependson="" data="" /> <File name=".\TechnicalAnalysisTesting\Oscillators\FixedPeriodOscillators\RunFPOscillatorCTC.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\TechnicalAnalysisTesting\Oscillators\FixedPeriodOscillators\EndOfDayTimerHandlerFPOscillatorCTC.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> --- 98,102 ---- <File name=".\ArbitrageTesting\PairTrading\SimplePairTrading\InSample\RunSimplePairTradingIS.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\EvaluatingOptimizationTechnique\EfficientPortfolio\RunTestingOptimizationOpenToCloseFitnessCombined.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> ! <File name=".\EvaluatingOptimizationTechnique\TechnicalAnalysis\RunTestingOptimizationExtremeCounterTrend.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\TechnicalAnalysisTesting\Oscillators\FixedPeriodOscillators\RunFPOscillatorCTC.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\TechnicalAnalysisTesting\Oscillators\FixedPeriodOscillators\EndOfDayTimerHandlerFPOscillatorCTC.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> *************** *** 131,134 **** --- 131,137 ---- <File name=".\WalkForwardTesting\LinearCombination\FixedPeriodOscillatorStrategy.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagDebugGenome.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\QuantProject.Scripts.WalkForwardTesting.LinearCombination.TestDisplayer.resources" subtype="Code" buildaction="EmbedAsResource" dependson="" data="" /> + <File name=".\TickerSelectionTesting\GenomeManagerForEfficientOTCCTOPortfolio.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\LinearCombination\OTC_CTODailyStrategy.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References> |
|
From: Marco M. <mi...@us...> - 2006-08-03 21:33:19
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv21499/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: Added ImmediateTrendFollower strategy to the project. ITF strategy is just the reversal of the ECT (ExtremeCounterTrend strategy). Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** b7_Scripts.csproj 31 Jul 2006 16:39:47 -0000 1.59 --- b7_Scripts.csproj 3 Aug 2006 21:33:16 -0000 1.60 *************** *** 279,282 **** --- 279,297 ---- /> <File + RelPath = "TechnicalAnalysisTesting\TrendFollowing\ImmediateTrendFollower\EndOfDayTimerHandlerITF.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "TechnicalAnalysisTesting\TrendFollowing\ImmediateTrendFollower\GenomeManagerITF.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "TechnicalAnalysisTesting\TrendFollowing\ImmediateTrendFollower\RunImmediateTrendFollower.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TickerSelectionTesting\CandidateProperties.cs" SubType = "Code" *************** *** 514,517 **** --- 529,537 ---- /> <File + RelPath = "WalkForwardTesting\LinearCombination\ImmediateTrendFollowerStrategy.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "WalkForwardTesting\LinearCombination\LinearCombinationTest.cs" SubType = "Code" |
|
From: Marco M. <mi...@us...> - 2006-08-03 21:31:19
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/ExtremeCounterTrend In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20639/b7_Scripts/TechnicalAnalysisTesting/Oscillators/ExtremeCounterTrend Modified Files: EndOfDayTimerHandlerECT.cs Log Message: Added field numberOfEligibleTicker to GenomeRepresentation, in order to store the effective number of tickers used in optimization process. Index: EndOfDayTimerHandlerECT.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/ExtremeCounterTrend/EndOfDayTimerHandlerECT.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EndOfDayTimerHandlerECT.cs 2 Jul 2006 19:55:58 -0000 1.2 --- EndOfDayTimerHandlerECT.cs 3 Aug 2006 21:31:16 -0000 1.3 *************** *** 184,206 **** SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, currentDate); DataTable tickersFromGroup = temporizedGroup.GetTableOfSelectedTickers(); ! SelectorByAverageRawOpenPrice byPrice = new SelectorByAverageRawOpenPrice(tickersFromGroup,false,currentDate, currentDate.AddDays(-30), ! tickersFromGroup.Rows.Count, 30,500, 0.0001,100); ! ! ! SelectorByLiquidity mostLiquidSelector = ! new SelectorByLiquidity(byPrice.GetTableOfSelectedTickers(), ! false,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, ! this.numberOfEligibleTickers); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromMostLiquid = ! new SelectorByQuotationAtEachMarketDay(mostLiquidSelector.GetTableOfSelectedTickers(), false, currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, ! this.numberOfEligibleTickers, this.benchmark); ! return quotedAtEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); //OLD for etf // SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, --- 184,211 ---- SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, currentDate); DataTable tickersFromGroup = temporizedGroup.GetTableOfSelectedTickers(); + int numOfTickersInGroupAtCurrentDate = tickersFromGroup.Rows.Count; ! SelectorByAverageRawOpenPrice byPrice = new SelectorByAverageRawOpenPrice(tickersFromGroup,false,currentDate, currentDate.AddDays(-30), ! numOfTickersInGroupAtCurrentDate, 30,500, 0.0001,100); ! ! // SelectorByLiquidity mostLiquidSelector = ! // new SelectorByLiquidity(byPrice.GetTableOfSelectedTickers(), ! // false,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, ! // this.numberOfEligibleTickers); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromByPrice = ! new SelectorByQuotationAtEachMarketDay(byPrice.GetTableOfSelectedTickers(), false, currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, ! numOfTickersInGroupAtCurrentDate, this.benchmark); ! SelectorByCloseToCloseVolatility lessVolatile = ! new SelectorByCloseToCloseVolatility(quotedAtEachMarketDayFromByPrice.GetTableOfSelectedTickers(), ! true,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, ! this.numberOfEligibleTickers); ! ! return lessVolatile.GetTableOfSelectedTickers(); //OLD for etf // SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, *************** *** 255,259 **** GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,((GenomeManagerForEfficientPortfolio)this.iGenomeManager).FirstQuoteDate, ! ((GenomeManagerForEfficientPortfolio)this.iGenomeManager).LastQuoteDate); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; --- 260,264 ---- GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,((GenomeManagerForEfficientPortfolio)this.iGenomeManager).FirstQuoteDate, ! ((GenomeManagerForEfficientPortfolio)this.iGenomeManager).LastQuoteDate, setOfTickersToBeOptimized.Rows.Count); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; |
|
From: Marco M. <mi...@us...> - 2006-08-03 21:31:19
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20639/b7_Scripts/TickerSelectionTesting Modified Files: EndOfDayTimerHandlerOTCMultiday.cs EndOfDayTimerHandlerOTCCTO.cs EndOfDayTimerHandlerOTC.cs EndOfDayTimerHandlerCTO.cs EndOfDayTimerHandlerCTC.cs EndOfDayTimerHandler.cs Log Message: Added field numberOfEligibleTicker to GenomeRepresentation, in order to store the effective number of tickers used in optimization process. Index: EndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandler.cs,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** EndOfDayTimerHandler.cs 7 Jan 2006 10:35:39 -0000 1.20 --- EndOfDayTimerHandler.cs 3 Aug 2006 21:31:15 -0000 1.21 *************** *** 269,274 **** protected void addGenomeToBestGenomes(Genome genome, ! DateTime firstOptimizationDate, ! DateTime secondOptimizationDate) { if(this.bestGenomes == null) --- 269,275 ---- protected void addGenomeToBestGenomes(Genome genome, ! DateTime firstOptimizationDate, ! DateTime secondOptimizationDate, ! int eligibleTickers) { if(this.bestGenomes == null) *************** *** 278,282 **** firstOptimizationDate, secondOptimizationDate, ! genome.Generation)); } --- 279,284 ---- firstOptimizationDate, secondOptimizationDate, ! genome.Generation, ! eligibleTickers)); } Index: EndOfDayTimerHandlerOTC.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerOTC.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EndOfDayTimerHandlerOTC.cs 2 Jul 2006 19:57:34 -0000 1.3 --- EndOfDayTimerHandlerOTC.cs 3 Aug 2006 21:31:15 -0000 1.4 *************** *** 191,195 **** GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForOptimizationPeriod), ! currentDate); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; --- 191,195 ---- GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForOptimizationPeriod), ! currentDate, setOfTickersToBeOptimized.Rows.Count); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; Index: EndOfDayTimerHandlerOTCCTO.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerOTCCTO.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EndOfDayTimerHandlerOTCCTO.cs 2 Jul 2006 19:57:34 -0000 1.4 --- EndOfDayTimerHandlerOTCCTO.cs 3 Aug 2006 21:31:15 -0000 1.5 *************** *** 167,171 **** GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForOptimizationPeriod), ! currentDate); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; --- 167,171 ---- GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForOptimizationPeriod), ! currentDate, setOfTickersToBeOptimized.Rows.Count); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; Index: EndOfDayTimerHandlerOTCMultiday.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerOTCMultiday.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EndOfDayTimerHandlerOTCMultiday.cs 7 Jan 2006 10:35:39 -0000 1.4 --- EndOfDayTimerHandlerOTCMultiday.cs 3 Aug 2006 21:31:15 -0000 1.5 *************** *** 181,185 **** GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForOptimizationPeriod), ! currentDate); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; --- 181,185 ---- GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForOptimizationPeriod), ! currentDate, setOfTickersToBeOptimized.Rows.Count); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; Index: EndOfDayTimerHandlerCTO.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTO.cs,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** EndOfDayTimerHandlerCTO.cs 7 Jan 2006 10:35:39 -0000 1.23 --- EndOfDayTimerHandlerCTO.cs 3 Aug 2006 21:31:15 -0000 1.24 *************** *** 141,145 **** GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForOptimizationPeriod), ! currentDate); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; --- 141,145 ---- GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForOptimizationPeriod), ! currentDate, setOfTickersToBeOptimized.Rows.Count); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; Index: EndOfDayTimerHandlerCTC.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTC.cs,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** EndOfDayTimerHandlerCTC.cs 14 May 2006 18:39:14 -0000 1.20 --- EndOfDayTimerHandlerCTC.cs 3 Aug 2006 21:31:15 -0000 1.21 *************** *** 214,218 **** GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,((GenomeManagerForEfficientCTCPortfolio)genManEfficientCTCPortfolio).FirstQuoteDate, ! ((GenomeManagerForEfficientCTCPortfolio)genManEfficientCTCPortfolio).LastQuoteDate); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; --- 214,219 ---- GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,((GenomeManagerForEfficientCTCPortfolio)genManEfficientCTCPortfolio).FirstQuoteDate, ! ((GenomeManagerForEfficientCTCPortfolio)genManEfficientCTCPortfolio).LastQuoteDate, ! setOfTickersToBeOptimized.Rows.Count); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; |
|
From: Marco M. <mi...@us...> - 2006-08-03 21:31:19
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedPeriodOscillators In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20639/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedPeriodOscillators Modified Files: EndOfDayTimerHandlerFPOscillatorCTC.cs Log Message: Added field numberOfEligibleTicker to GenomeRepresentation, in order to store the effective number of tickers used in optimization process. Index: EndOfDayTimerHandlerFPOscillatorCTC.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedPeriodOscillators/EndOfDayTimerHandlerFPOscillatorCTC.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EndOfDayTimerHandlerFPOscillatorCTC.cs 14 May 2006 15:29:22 -0000 1.1 --- EndOfDayTimerHandlerFPOscillatorCTC.cs 3 Aug 2006 21:31:16 -0000 1.2 *************** *** 307,311 **** GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,((GenomeManagerForEfficientPortfolio)this.iGenomeManager).FirstQuoteDate, ! ((GenomeManagerForEfficientPortfolio)this.iGenomeManager).LastQuoteDate); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; --- 307,311 ---- GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,((GenomeManagerForEfficientPortfolio)this.iGenomeManager).FirstQuoteDate, ! ((GenomeManagerForEfficientPortfolio)this.iGenomeManager).LastQuoteDate, setOfTickersToBeOptimized.Rows.Count); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; |
|
From: Marco M. <mi...@us...> - 2006-08-03 21:31:18
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/TestingOTCTypes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20639/b7_Scripts/TickerSelectionTesting/TestingOTCTypes Modified Files: EndOfDayTimerHandlerOTCTypes.cs Log Message: Added field numberOfEligibleTicker to GenomeRepresentation, in order to store the effective number of tickers used in optimization process. Index: EndOfDayTimerHandlerOTCTypes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/TestingOTCTypes/EndOfDayTimerHandlerOTCTypes.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EndOfDayTimerHandlerOTCTypes.cs 2 Jul 2006 19:57:34 -0000 1.3 --- EndOfDayTimerHandlerOTCTypes.cs 3 Aug 2006 21:31:15 -0000 1.4 *************** *** 265,269 **** GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForOptimizationPeriod), ! currentDate); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; --- 265,269 ---- GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForOptimizationPeriod), ! currentDate,setOfTickersToBeOptimized.Rows.Count); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; |
|
From: Marco M. <mi...@us...> - 2006-08-03 21:26:13
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18567/b7_Scripts/WalkForwardTesting/LinearCombination Modified Files: GenomeRepresentation.cs Log Message: Implemented ISerializable interface for managing serialization / deserialization Index: GenomeRepresentation.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/GenomeRepresentation.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GenomeRepresentation.cs 2 Jul 2006 19:22:12 -0000 1.5 --- GenomeRepresentation.cs 3 Aug 2006 21:26:10 -0000 1.6 *************** *** 22,25 **** --- 22,27 ---- using System; + using System.Reflection; + using System.Runtime.Serialization; using QuantProject.ADT; *************** *** 34,45 **** /// </summary> [Serializable] ! public class GenomeRepresentation { private double fitness; private string signedTickers; private int generationCounter; private DateTime firstOptimizationDate; private DateTime lastOptimizationDate; ! public string SignedTickers { --- 36,49 ---- /// </summary> [Serializable] ! public class GenomeRepresentation : ISerializable { private double fitness; private string signedTickers; + private string weights; private int generationCounter; private DateTime firstOptimizationDate; private DateTime lastOptimizationDate; ! private int eligibleTickers = -1; ! public string SignedTickers { *************** *** 49,52 **** --- 53,72 ---- } } + + public int EligibleTickers + { + get + { + return this.eligibleTickers; + } + } + + public string WeightsForSignedTickers + { + get + { + return this.weights; + } + } public double Fitness { *************** *** 75,78 **** --- 95,110 ---- // } + public static double[] GetWeightsArray( string weightsWithSeparator ) + { + double[] returnValue; + string[] returnValueString = weightsWithSeparator.Split( ";".ToCharArray()); + returnValue = new double[returnValueString.Length]; + for(int i = 0; i<returnValue.Length; i++) + { + returnValue[i] = Convert.ToDouble(returnValueString[i]); + } + return returnValue; + } + public static string[] GetSignedTickers( string signedTickersWithWeights ) { *************** *** 91,95 **** return returnValue; } ! public static double[] GetWeightsForSignedTickers( string signedTickersWithWeights ) { --- 123,127 ---- return returnValue; } ! public static double[] GetWeightsForSignedTickers( string signedTickersWithWeights ) { *************** *** 142,172 **** return signedTickers; } ! private string getSignedTickersWithWeights( Genome genome ) { ! string signedTickersWithWeights = ""; ! for ( int i = 0; i<((GenomeMeaning)genome.Meaning).Tickers.Length; i++ ) { ! signedTickersWithWeights += ! ((GenomeMeaning)genome.Meaning).Tickers[i] + ! ConstantsProvider.SeparatorForWeights + ! ((GenomeMeaning)genome.Meaning).TickersPortfolioWeights[i] + ! ConstantsProvider.SeparatorForTickers; } ! signedTickersWithWeights = signedTickersWithWeights.Substring( 0 , ! signedTickersWithWeights.Length - 1 ); ! ! return signedTickersWithWeights; } private void genomeRepresentation( Genome genome , DateTime firstOptimizationDate , DateTime lastOptimizationDate , ! int generationCounter ) { this.fitness = genome.Fitness; ! this.signedTickers = this.getSignedTickersWithWeights( genome ); ! //this.signedTickers = this.getSignedTickers( genome ); ! this.firstOptimizationDate = firstOptimizationDate; this.lastOptimizationDate = lastOptimizationDate; this.generationCounter = generationCounter; } public GenomeRepresentation( Genome genome , --- 174,264 ---- return signedTickers; } ! ! private string getWeights( Genome genome ) ! { ! string weights = ""; ! foreach ( double weight in ((GenomeMeaning)genome.Meaning).TickersPortfolioWeights ) ! weights += weight.ToString() + ";"; ! weights = weights.Substring( 0, weights.Length - 1 ); ! return weights; ! } ! ! // private string getSignedTickersWithWeights( Genome genome ) ! // { ! // string signedTickersWithWeights = ""; ! // for ( int i = 0; i<((GenomeMeaning)genome.Meaning).Tickers.Length; i++ ) ! // { ! // signedTickersWithWeights += ! // ((GenomeMeaning)genome.Meaning).Tickers[i] + ! // ConstantsProvider.SeparatorForWeights + ! // ((GenomeMeaning)genome.Meaning).TickersPortfolioWeights[i] + ! // ConstantsProvider.SeparatorForTickers; ! // } ! // signedTickersWithWeights = signedTickersWithWeights.Substring( 0 , ! // signedTickersWithWeights.Length - 1 ); ! // ! // return signedTickersWithWeights; ! // } ! ! private void genomeRepresentation_synchronizeOldWithNew() ! { ! if(this.weights == null) ! //for old genomes saved to disk not having "weights" field ! { ! foreach(double weight in GenomeRepresentation.GetWeightsForSignedTickers(this.signedTickers)) ! this.weights += weight.ToString() + ";"; ! this.weights = this.weights.Substring( 0, this.weights.Length - 1 ); ! // ! string newRepresentationForSignedTickers = null; ! foreach(string ticker in GenomeRepresentation.GetSignedTickers(this.signedTickers)) ! newRepresentationForSignedTickers += ticker + ";"; ! this.signedTickers = newRepresentationForSignedTickers.Substring(0, newRepresentationForSignedTickers.Length -1); ! } ! ! } ! ! /// <summary> ! /// This constructor allows custom deserialization (see the ISerializable ! /// interface documentation) ! /// </summary> ! /// <param name="info"></param> ! /// <param name="context"></param> ! protected GenomeRepresentation( SerializationInfo info , StreamingContext context ) { ! // get the set of serializable members for this class and its base classes ! Type thisType = this.GetType(); ! MemberInfo[] mi = FormatterServices.GetSerializableMembers( ! thisType , context); ! ! // deserialize the fields from the info object ! for (Int32 i = 0 ; i < mi.Length; i++) { ! FieldInfo fieldInfo = (FieldInfo) mi[i]; ! ! // set the field to the deserialized value ! try{ ! fieldInfo.SetValue( this , ! info.GetValue( fieldInfo.Name, fieldInfo.FieldType ) ); ! } ! catch(Exception ex) ! {ex = ex;} } ! ! this.genomeRepresentation_synchronizeOldWithNew(); ! } private void genomeRepresentation( Genome genome , DateTime firstOptimizationDate , DateTime lastOptimizationDate , ! int generationCounter, int eligibleTickers ) { this.fitness = genome.Fitness; ! //this.signedTickers = this.getSignedTickersWithWeights( genome ); ! this.signedTickers = this.getSignedTickers( genome ); ! this.weights = this.getWeights( genome ); ! this.firstOptimizationDate = firstOptimizationDate; this.lastOptimizationDate = lastOptimizationDate; this.generationCounter = generationCounter; + this.eligibleTickers = eligibleTickers; } public GenomeRepresentation( Genome genome , *************** *** 174,178 **** { this.genomeRepresentation( genome , ! firstOptimizationDate , lastOptimizationDate , -1 ); } public GenomeRepresentation( Genome genome , --- 266,270 ---- { this.genomeRepresentation( genome , ! firstOptimizationDate , lastOptimizationDate , -1, -1 ); } public GenomeRepresentation( Genome genome , *************** *** 181,186 **** { this.genomeRepresentation( genome , firstOptimizationDate , ! lastOptimizationDate , generationCounter ); } } } --- 273,308 ---- { this.genomeRepresentation( genome , firstOptimizationDate , ! lastOptimizationDate , generationCounter, -1 ); } + + public GenomeRepresentation( Genome genome , + DateTime firstOptimizationDate , DateTime lastOptimizationDate , + int generationCounter, int eligibleTickers ) + { + this.genomeRepresentation( genome , firstOptimizationDate , + lastOptimizationDate , generationCounter, eligibleTickers ); + } + + #region GetObjectData + /// <summary> + /// serialize the set of serializable members for this class and base classes + /// </summary> + /// <param name="info"></param> + /// <param name="context"></param> + void ISerializable.GetObjectData( + SerializationInfo info, StreamingContext context) + { + // get the set of serializable members for this class and base classes + Type thisType = this.GetType(); + MemberInfo[] mi = + FormatterServices.GetSerializableMembers( thisType , context); + + // serialize the fields to the info object + for (Int32 i = 0 ; i < mi.Length; i++) + { + info.AddValue(mi[i].Name, ((FieldInfo) mi[i]).GetValue(this)); + } + } + #endregion } } |
|
From: Marco M. <mi...@us...> - 2006-08-03 21:24:39
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv17804/b7_Scripts/WalkForwardTesting/LinearCombination Modified Files: OptimizationOutput.cs Log Message: Implemented ISerializable interface for managing serialization / deserialization Index: OptimizationOutput.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/OptimizationOutput.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OptimizationOutput.cs 22 Aug 2005 22:21:39 -0000 1.2 --- OptimizationOutput.cs 3 Aug 2006 21:24:36 -0000 1.3 *************** *** 22,25 **** --- 22,27 ---- using System; + using System.Reflection; + using System.Runtime.Serialization; using System.Collections; *************** *** 31,35 **** /// </summary> [Serializable] ! public class OptimizationOutput : ArrayList { // public ArrayList BestGenomes --- 33,37 ---- /// </summary> [Serializable] ! public class OptimizationOutput : ArrayList, ISerializable { // public ArrayList BestGenomes *************** *** 37,42 **** --- 39,46 ---- // get { return this.bestGenomes; } // } + public OptimizationOutput() { + } /// <summary> *************** *** 48,51 **** --- 52,107 ---- base.Add( genomeRepresentation ); } + + /// <summary> + /// This constructor allows custom deserialization (see the ISerializable + /// interface documentation) + /// </summary> + /// <param name="info"></param> + /// <param name="context"></param> + protected OptimizationOutput( SerializationInfo info , StreamingContext context ) + { + // get the set of serializable members for this class and its base classes + Type thisType = this.GetType(); + MemberInfo[] mi = FormatterServices.GetSerializableMembers( + thisType , context); + + // deserialize the fields from the info object + for (Int32 i = 0 ; i < mi.Length; i++) + { + FieldInfo fieldInfo = (FieldInfo) mi[i]; + + // set the field to the deserialized value + try{ + fieldInfo.SetValue( this , + info.GetValue( fieldInfo.Name, fieldInfo.FieldType ) ); + } + catch(Exception ex) + {ex = ex;} + } + + } + + #region GetObjectData + /// <summary> + /// serialize the set of serializable members for this class and base classes + /// </summary> + /// <param name="info"></param> + /// <param name="context"></param> + void ISerializable.GetObjectData( + SerializationInfo info, StreamingContext context) + { + // get the set of serializable members for this class and base classes + Type thisType = this.GetType(); + MemberInfo[] mi = + FormatterServices.GetSerializableMembers( thisType , context); + + // serialize the fields to the info object + for (Int32 i = 0 ; i < mi.Length; i++) + { + info.AddValue(mi[i].Name, ((FieldInfo) mi[i]).GetValue(this)); + } + } + #endregion + } } |
|
From: Marco M. <mi...@us...> - 2006-08-03 21:21:38
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv16562/b3_Data/DataTables Modified Files: Quotes.cs Log Message: Minor changes (changed names for some variables and some private methods) Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/Quotes.cs,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Quotes.cs 30 Jul 2006 13:55:39 -0000 1.29 --- Quotes.cs 3 Aug 2006 21:21:34 -0000 1.30 *************** *** 271,275 **** } ! private static void getTickersByAdjCloseToClosePearsonCorrelationCoefficient_setTickersReturns(out float[][] tickersReturns, DataTable setOfTickers, DateTime firstQuoteDate, DateTime lastQuoteDate) --- 271,275 ---- } ! private static void getTickersByAdjCloseToClosePearsonCorrelationCoefficient_setTickersAdjCloses(out float[][] tickersReturns, DataTable setOfTickers, DateTime firstQuoteDate, DateTime lastQuoteDate) *************** *** 303,308 **** setOfTickers.Columns.Add("PearsonCorrelationCoefficient", System.Type.GetType("System.Double")); int initialNumberOfRows = setOfTickers.Rows.Count; ! float[][] tickersReturns; ! getTickersByAdjCloseToClosePearsonCorrelationCoefficient_setTickersReturns(out tickersReturns, setOfTickers, firstQuoteDate, lastQuoteDate); for(int j=0; j!= initialNumberOfRows; j++) { --- 303,308 ---- setOfTickers.Columns.Add("PearsonCorrelationCoefficient", System.Type.GetType("System.Double")); int initialNumberOfRows = setOfTickers.Rows.Count; ! float[][] tickersAdjCloses; ! getTickersByAdjCloseToClosePearsonCorrelationCoefficient_setTickersAdjCloses(out tickersAdjCloses, setOfTickers, firstQuoteDate, lastQuoteDate); for(int j=0; j!= initialNumberOfRows; j++) { *************** *** 320,324 **** rowToAdd["PearsonCorrelationCoefficient"] = QuantProject.ADT.Statistics.BasicFunctions.PearsonCorrelationCoefficient( ! tickersReturns[j],tickersReturns[i]); } catch(Exception ex) --- 320,324 ---- rowToAdd["PearsonCorrelationCoefficient"] = QuantProject.ADT.Statistics.BasicFunctions.PearsonCorrelationCoefficient( ! tickersAdjCloses[j],tickersAdjCloses[i]); } catch(Exception ex) |
|
From: Marco M. <mi...@us...> - 2006-08-03 21:19:28
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv15734/b7_Scripts/TickerSelectionTesting Modified Files: RunEfficientPortfolio.cs Log Message: Enriched the name for the output file. Index: RunEfficientPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientPortfolio.cs,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** RunEfficientPortfolio.cs 14 May 2006 18:23:38 -0000 1.19 --- RunEfficientPortfolio.cs 3 Aug 2006 21:19:25 -0000 1.20 *************** *** 216,225 **** public virtual void SaveScriptResults() { ! string fileName = "From"+this.numberOfEligibleTickers + ! "OptDays" + this.numDaysForOptimizationPeriod + "Portfolio" + this.numberOfTickersToBeChosen + "GenNum" + this.generationNumberForGeneticOptimizer + "PopSize" + this.populationSizeForGeneticOptimizer + - "Target" + Convert.ToString(this.targetReturn) + Convert.ToString(this.portfolioType); string dirNameWhereToSaveReports = System.Configuration.ConfigurationSettings.AppSettings["ReportsArchive"] + --- 216,225 ---- public virtual void SaveScriptResults() { ! string fileName = "From_" + this.tickerGroupID + "_" + ! + this.numberOfEligibleTickers + ! "_OptDays" + this.numDaysForOptimizationPeriod + "_Port" + this.numberOfTickersToBeChosen + "GenNum" + this.generationNumberForGeneticOptimizer + "PopSize" + this.populationSizeForGeneticOptimizer + Convert.ToString(this.portfolioType); string dirNameWhereToSaveReports = System.Configuration.ConfigurationSettings.AppSettings["ReportsArchive"] + |