[Quantproject-developers] QuantProject/b7_Scripts/TickerSelectionTesting GenomeManagerForEfficientCT
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2005-07-25 22:50:03
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25036/b7_Scripts/TickerSelectionTesting Modified Files: GenomeManagerForEfficientCTCPortfolio.cs GenomeManagerForEfficientCTOPortfolio.cs Log Message: Decode method is now inherited directly by the base class. Index: GenomeManagerForEfficientCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForEfficientCTOPortfolio.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GenomeManagerForEfficientCTOPortfolio.cs 13 Jul 2005 16:37:04 -0000 1.12 --- GenomeManagerForEfficientCTOPortfolio.cs 25 Jul 2005 22:49:54 -0000 1.13 *************** *** 55,98 **** { ! this.retrieveData(); } - - public override object Decode(Genome genome) - { - - string[] arrayOfTickers = new string[genome.Genes().Length]; - int indexOfTicker; - for(int index = 0; index < genome.Genes().Length; index++) - { - indexOfTicker = (int)genome.Genes().GetValue(index); - arrayOfTickers[index] = (string)this.setOfTickers.Rows[indexOfTicker][0]; - } - return arrayOfTickers; - - /*old implementation, to be used for output to console - string sequenceOfTickers = ""; - object returnValue; - foreach(int index in genome.Genes()) - { - sequenceOfTickers += (string)this.setOfTickers.Rows[index][0] + ";" ; - } - returnValue = sequenceOfTickers; - returnValue += "(rate: " + this.RateOfReturn + " std: " + - System.Math.Sqrt(this.Variance) + ")"; - return returnValue; - */ - } - protected override float[] getArrayOfRatesOfReturn(string ticker) { float[] returnValue = null; ! if(!ticker.StartsWith("-")) ! { ! string tickerCode = GenomeManagerForEfficientPortfolio.GetCleanTickerCode(ticker); ! Quotes tickerQuotes = new Quotes(tickerCode, this.firstQuoteDate, this.lastQuoteDate); ! returnValue = ExtendedDataTable.GetRatesOfReturnsFromColumns(tickerQuotes, "quClose", "quOpen"); ! this.numberOfExaminedReturns = returnValue.Length; ! } return returnValue; } --- 55,68 ---- { ! this.retrieveData(); } 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; } Index: GenomeManagerForEfficientCTCPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForEfficientCTCPortfolio.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GenomeManagerForEfficientCTCPortfolio.cs 13 Jul 2005 16:37:04 -0000 1.7 --- GenomeManagerForEfficientCTCPortfolio.cs 25 Jul 2005 22:49:54 -0000 1.8 *************** *** 66,105 **** } - - public override object Decode(Genome genome) - { - - string[] arrayOfTickers = new string[genome.Genes().Length]; - int indexOfTicker; - for(int index = 0; index < genome.Genes().Length; index++) - { - indexOfTicker = (int)genome.Genes().GetValue(index); - arrayOfTickers[index] = (string)this.setOfTickers.Rows[indexOfTicker][0]; - } - return arrayOfTickers; - - } - protected override float[] getArrayOfRatesOfReturn(string ticker) { float[] returnValue = null; ! if(!ticker.StartsWith("-")) ! { ! string tickerCode = GenomeManagerForEfficientPortfolio.GetCleanTickerCode(ticker); ! Quotes tickerQuotes = new Quotes(tickerCode, this.firstQuoteDate, this.lastQuoteDate); ! float[] allAdjValues = ExtendedDataTable.GetArrayOfFloatFromColumn(tickerQuotes, "quAdjustedClose"); ! returnValue = new float[allAdjValues.Length/this.numDaysForReturnCalculation + 1]; ! int i = 0; //index for ratesOfReturns array - for(int idx = 0; idx + this.numDaysForReturnCalculation < allAdjValues.Length; idx += this.numDaysForReturnCalculation ) - { - returnValue[i] = (allAdjValues[idx+this.numDaysForReturnCalculation]/ - allAdjValues[idx] - 1); - i++; - } - this.numberOfExaminedReturns = returnValue.Length; - } return returnValue; - } /* --- 66,85 ---- } protected override float[] getArrayOfRatesOfReturn(string ticker) { float[] returnValue = null; ! Quotes tickerQuotes = new Quotes(ticker, this.firstQuoteDate, this.lastQuoteDate); ! float[] allAdjValues = ExtendedDataTable.GetArrayOfFloatFromColumn(tickerQuotes, "quAdjustedClose"); ! returnValue = new float[allAdjValues.Length/this.numDaysForReturnCalculation + 1]; ! int i = 0; //index for ratesOfReturns array ! for(int idx = 0; idx + this.numDaysForReturnCalculation < allAdjValues.Length; idx += this.numDaysForReturnCalculation ) ! { ! returnValue[i] = (allAdjValues[idx+this.numDaysForReturnCalculation]/ ! allAdjValues[idx] - 1); ! i++; ! } ! this.numberOfExaminedReturns = returnValue.Length; return returnValue; } /* |