[Quantproject-developers] QuantProject/b7_Scripts/TickerSelectionTesting/TestingOTCTypes GenomeMan
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2008-01-14 23:38:40
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/TestingOTCTypes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21302/b7_Scripts/TickerSelectionTesting/TestingOTCTypes Modified Files: GenomeManagerForEfficientOTCTypes.cs Log Message: GenomeManagers have been updated (WeightedPositions have been used instead of CandidateProperties) Index: GenomeManagerForEfficientOTCTypes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/TestingOTCTypes/GenomeManagerForEfficientOTCTypes.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GenomeManagerForEfficientOTCTypes.cs 14 May 2006 18:36:37 -0000 1.2 --- GenomeManagerForEfficientOTCTypes.cs 14 Jan 2008 23:38:36 -0000 1.3 *************** *** 38,44 **** /// </summary> [Serializable] ! public class GenomeManagerForEfficientOTCTypes : GenomeManagerForEfficientPortfolio { ! private GenomeManagerForEfficientCTOPortfolio genManCTO; public GenomeManagerForEfficientOTCTypes(DataTable setOfInitialTickers, DateTime firstQuoteDate, --- 38,46 ---- /// </summary> [Serializable] ! public class GenomeManagerForEfficientOTCTypes : GenomeManagerForEfficientOTCCTOPortfolio { ! // private GenomeManagerForEfficientCTOPortfolio genManCTO; ! // private string benchmark; ! public GenomeManagerForEfficientOTCTypes(DataTable setOfInitialTickers, DateTime firstQuoteDate, *************** *** 46,50 **** int numberOfTickersInPortfolio, double targetPerformance, ! PortfolioType portfolioType) :base(setOfInitialTickers, firstQuoteDate, --- 48,53 ---- int numberOfTickersInPortfolio, double targetPerformance, ! PortfolioType portfolioType, ! string benchmark) :base(setOfInitialTickers, firstQuoteDate, *************** *** 52,115 **** numberOfTickersInPortfolio, targetPerformance, ! portfolioType) { ! this.retrieveData(); ! this.genManCTO = new GenomeManagerForEfficientCTOPortfolio(setOfInitialTickers, ! firstQuoteDate, ! lastQuoteDate, ! numberOfTickersInPortfolio, ! targetPerformance, ! portfolioType); } //rate of return = rawClose/rawOpen - 1 ! protected override float[] getArrayOfRatesOfReturn(string ticker) ! { ! float[] returnValue = null; ! Quotes tickerQuotes = new Quotes(ticker, this.firstQuoteDate, this.lastQuoteDate); ! returnValue = ExtendedDataTable.GetRatesOfReturnsFromColumns(tickerQuotes, "quClose", "quOpen"); ! this.numberOfExaminedReturns = returnValue.Length; ! ! return returnValue; ! } ! ! public override double GetFitnessValue(Genome genome) ! { ! double returnValue = 0; ! this.portfolioRatesOfReturn = this.getPortfolioRatesOfReturn(genome.Genes()); ! double averagePortfolioRateOfReturn = ! BasicFunctions.SimpleAverage(this.portfolioRatesOfReturn); ! ! double portfolioVariance = ! BasicFunctions.Variance(this.portfolioRatesOfReturn); ! ! if(!Double.IsInfinity(portfolioVariance) && ! !Double.IsInfinity(averagePortfolioRateOfReturn) && ! !Double.IsNaN(portfolioVariance) && ! !Double.IsNaN(averagePortfolioRateOfReturn) && ! portfolioVariance > 0.0) ! //both variance and rate of return are ! //double values computed in the right way: ! // so it's possible to assign fitness ! { ! this.variance = portfolioVariance; ! this.rateOfReturn = averagePortfolioRateOfReturn; ! //returnValue = this.getFitnessValue_calculate(); ! returnValue = this.getFitnessValue_calculate() - ! this.genManCTO.GetFitnessValue(genome); ! ! } ! ! return returnValue; ! } ! ! ! protected override double getFitnessValue_calculate() ! { ! return this.RateOfReturn/Math.Sqrt(this.Variance); ! } ! ! ! } ! } --- 55,118 ---- numberOfTickersInPortfolio, targetPerformance, ! portfolioType, ! benchmark) { ! // this.benchmark = benchmark; ! // this.retrieveData(); ! // this.genManCTO = new GenomeManagerForEfficientCTOPortfolio(setOfInitialTickers, ! // firstQuoteDate, ! // lastQuoteDate, ! // numberOfTickersInPortfolio, ! // targetPerformance, ! // portfolioType, ! // benchmark); } //rate of return = rawClose/rawOpen - 1 ! // protected override float[] getArrayOfRatesOfReturn(string ticker) ! // { ! // float[] returnValue = null; ! // Quotes tickerQuotes = new Quotes(ticker, this.firstQuoteDate, this.lastQuoteDate); ! // returnValue = ExtendedDataTable.GetRatesOfReturnsFromColumns(tickerQuotes, "quClose", "quOpen"); ! // this.numberOfExaminedReturns = returnValue.Length; ! // ! // return returnValue; ! // } ! // ! // public override double GetFitnessValue(Genome genome) ! // { ! // double returnValue = 0; ! // this.portfolioRatesOfReturn = this.getPortfolioRatesOfReturn(genome.Genes()); ! // double averagePortfolioRateOfReturn = ! // BasicFunctions.SimpleAverage(this.portfolioRatesOfReturn); ! // ! // double portfolioVariance = ! // BasicFunctions.Variance(this.portfolioRatesOfReturn); ! // ! // if(!Double.IsInfinity(portfolioVariance) && ! // !Double.IsInfinity(averagePortfolioRateOfReturn) && ! // !Double.IsNaN(portfolioVariance) && ! // !Double.IsNaN(averagePortfolioRateOfReturn) && ! // portfolioVariance > 0.0) ! // //both variance and rate of return are ! // //double values computed in the right way: ! // // so it's possible to assign fitness ! // { ! // this.variance = portfolioVariance; ! // this.rateOfReturn = averagePortfolioRateOfReturn; ! // //returnValue = this.getFitnessValue_calculate(); ! // returnValue = this.getFitnessValue_calculate() - ! // this.genManCTO.GetFitnessValue(genome); ! // ! // } ! // ! // return returnValue; ! // } ! // ! // ! // protected override double getFitnessValue_calculate() ! // { ! // return this.RateOfReturn/Math.Sqrt(this.Variance); ! // } ! } } |