quantproject-developers Mailing List for QuantProject (Page 74)
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: Glauco S. <gl...@my...> - 2007-06-19 22:05:23
|
Mi sembra ci sia un problema nel codice: la get dovrebbe essere cosi'
(spero ti arrivi formattato in modo decente):
>+ if ( ! this.hasFitnessBeenAssigned )
{
>+ // the genome's fitness has not been
>assigned yet
>+ this.fitness =
>this.genomeManager.GetFitnessValue(this);
this.hasFitnessBeenAssigned = true;
}
> return this.fitness;
Confermi?
At 07:18 PM 6/19/2007 +0000, you wrote:
>Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic
>In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10974
>
>Modified Files:
> GeneticOptimizer.cs Genome.cs
>Log Message:
>AssignMeaning and CalculateFitness have been deleted from the
>GeneticOptimizer.
>Now the calculation of fitness and the meaning's assigning are controlled
>by the get method inside Fitness and Meaning properties.
>
>Index: Genome.cs
>===================================================================
>RCS file:
>/cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/Genome.cs,v
>retrieving revision 1.15
>retrieving revision 1.16
>diff -C2 -d -r1.15 -r1.16
>*** Genome.cs 3 Jan 2007 22:56:49 -0000 1.15
>--- Genome.cs 19 Jun 2007 19:18:38 -0000 1.16
>***************
>*** 44,47 ****
>--- 44,48 ----
> private GeneticOptimizer geneticOptimizer;
> private int generation;
>+ private bool hasFitnessBeenAssigned;
>
> public bool HasBeenCloned
>***************
>*** 67,79 ****
> throw new Exception(
> "The fitness for this
> genome is not a number!" );
> return this.fitness;
> }
>! set{this.fitness = value;}
> }
>
> public object Meaning
> {
>! get{return this.meaning;}
>! set{this.meaning = value;}
> }
>
>--- 68,96 ----
> throw new Exception(
> "The fitness for this
> genome is not a number!" );
>+ if ( ! this.hasFitnessBeenAssigned )
>+ // the genome's fitness has not been
>assigned yet
>+ this.fitness =
>this.genomeManager.GetFitnessValue(this);
> return this.fitness;
> }
>! set
>! {
>! this.fitness = value;
>! this.hasFitnessBeenAssigned = true;
>! }
> }
>
> public object Meaning
> {
>! get
>! {
>! if ( this.meaning == null )
>! // the genome's meaning has not been
>assigned yet
>! this.meaning = this.genomeManager.Decode(
>this );
>! return this.meaning;
>! }
>! set
>! {
>! this.meaning = value;
>! }
> }
>
>
>Index: GeneticOptimizer.cs
>===================================================================
>RCS file:
>/cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/GeneticOptimizer.cs,v
>retrieving revision 1.23
>retrieving revision 1.24
>diff -C2 -d -r1.23 -r1.24
>*** GeneticOptimizer.cs 3 Jan 2007 23:20:11 -0000 1.23
>--- GeneticOptimizer.cs 19 Jun 2007 19:18:38 -0000 1.24
>***************
>*** 421,426 ****
> Genome g = new Genome(this.genomeManager, this);
> g.CreateGenes();
>- g.CalculateFitness();
>- g.AssignMeaning();
> this.currentGeneration.Add(g);
> }
>--- 421,424 ----
>***************
>*** 480,484 ****
> this.mutateGenomes();
> this.createNextGeneration_transmitEliteToNextGeneration();
>- this.calculateFitnessAndMeaningForAllGenomes();
> this.updateCurrentGeneration();
> this.sortCurrentGenerationAndFireNewGenerationEvent();
>--- 478,481 ----
>***************
>*** 494,513 ****
> }
> }
>!
>! private void calculateFitnessAndMeaningForAllGenomes()
>! {
>! foreach(Genome g in this.nextGeneration)
>! {
>! if(!g.HasBeenCloned || g.HasBeenChanged)
>! //if it has been cloned and it has not been changed,
>! //it's useless
>! //to calculate again fitness and meaning
>! {
>! g.CalculateFitness();
>! g.AssignMeaning();
>! }
>! }
>! }
>!
> private void updateCurrentGeneration()
> {
>--- 491,495 ----
> }
> }
>!
> private void updateCurrentGeneration()
> {
>
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by DB2 Express
>Download DB2 Express C - the FREE version of DB2 express and take
>control of your XML. No limits. Just data. Click to get it now.
>http://sourceforge.net/powerbar/db2/
>_______________________________________________
>Quantproject-developers mailing list
>Qua...@li...
>https://lists.sourceforge.net/lists/listinfo/quantproject-developers
|
|
From: Marco M. <mi...@us...> - 2007-06-19 19:18:44
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10974 Modified Files: GeneticOptimizer.cs Genome.cs Log Message: AssignMeaning and CalculateFitness have been deleted from the GeneticOptimizer. Now the calculation of fitness and the meaning's assigning are controlled by the get method inside Fitness and Meaning properties. Index: Genome.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/Genome.cs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Genome.cs 3 Jan 2007 22:56:49 -0000 1.15 --- Genome.cs 19 Jun 2007 19:18:38 -0000 1.16 *************** *** 44,47 **** --- 44,48 ---- private GeneticOptimizer geneticOptimizer; private int generation; + private bool hasFitnessBeenAssigned; public bool HasBeenCloned *************** *** 67,79 **** throw new Exception( "The fitness for this genome is not a number!" ); return this.fitness; } ! set{this.fitness = value;} } public object Meaning { ! get{return this.meaning;} ! set{this.meaning = value;} } --- 68,96 ---- throw new Exception( "The fitness for this genome is not a number!" ); + if ( ! this.hasFitnessBeenAssigned ) + // the genome's fitness has not been assigned yet + this.fitness = this.genomeManager.GetFitnessValue(this); return this.fitness; } ! set ! { ! this.fitness = value; ! this.hasFitnessBeenAssigned = true; ! } } public object Meaning { ! get ! { ! if ( this.meaning == null ) ! // the genome's meaning has not been assigned yet ! this.meaning = this.genomeManager.Decode( this ); ! return this.meaning; ! } ! set ! { ! this.meaning = value; ! } } Index: GeneticOptimizer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/GeneticOptimizer.cs,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** GeneticOptimizer.cs 3 Jan 2007 23:20:11 -0000 1.23 --- GeneticOptimizer.cs 19 Jun 2007 19:18:38 -0000 1.24 *************** *** 421,426 **** Genome g = new Genome(this.genomeManager, this); g.CreateGenes(); - g.CalculateFitness(); - g.AssignMeaning(); this.currentGeneration.Add(g); } --- 421,424 ---- *************** *** 480,484 **** this.mutateGenomes(); this.createNextGeneration_transmitEliteToNextGeneration(); - this.calculateFitnessAndMeaningForAllGenomes(); this.updateCurrentGeneration(); this.sortCurrentGenerationAndFireNewGenerationEvent(); --- 478,481 ---- *************** *** 494,513 **** } } ! ! private void calculateFitnessAndMeaningForAllGenomes() ! { ! foreach(Genome g in this.nextGeneration) ! { ! if(!g.HasBeenCloned || g.HasBeenChanged) ! //if it has been cloned and it has not been changed, ! //it's useless ! //to calculate again fitness and meaning ! { ! g.CalculateFitness(); ! g.AssignMeaning(); ! } ! } ! } ! private void updateCurrentGeneration() { --- 491,495 ---- } } ! private void updateCurrentGeneration() { |
|
From: Glauco S. <gla...@us...> - 2007-06-13 21:32:15
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4438/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: WalkForwardTesting\WalkForwardLag\WeightedPositionsChoosers\WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio\WFLagGenomeManagerForFixedPortfolioWithNormalDrivingAndPortfolio.cs has been added Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** b7_Scripts.csproj 11 Jun 2007 17:57:40 -0000 1.72 --- b7_Scripts.csproj 13 Jun 2007 21:32:11 -0000 1.73 *************** *** 809,812 **** --- 809,817 ---- /> <File + RelPath = "WalkForwardTesting\WalkForwardLag\WeightedPositionsChoosers\WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio\WFLagGenomeManagerForFixedPortfolioWithNormalDrivingAndPortfolio.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "WalkForwardTesting\WalkForwardLag\WFLagBruteForceOptimizableItemManager\WFLagBruteForceOptimizableParametersManager.cs" SubType = "Code" |
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WeightedPositionsChoosers/WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4017/b7_Scripts/WalkForwardTesting/WalkForwardLag/WeightedPositionsChoosers/WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio Added Files: WFLagGenomeManagerForFixedPortfolioWithNormalDrivingAndPortfolio.cs Log Message: This class implements IGenomeManager, in order to find the best driving position group and the best portfolio position group with respect to the lag strategy. It uses fixed portfolio tickers and it is designed to optimize the driving portfolio. Normalized weights are used both for the driving and for the portfolio tickers. --- NEW FILE: WFLagGenomeManagerForFixedPortfolioWithNormalDrivingAndPortfolio.cs --- /* QuantProject - Quantitative Finance Library WFLagGenomeManagerForFixedPortfolioWithNormalDrivingAndPortfolio.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.Data; using QuantProject.ADT.Optimizing.Genetic; using QuantProject.ADT.Statistics; using QuantProject.Business.Strategies; using QuantProject.Business.Strategies.EquityEvaluation; namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardLag { /// <summary> /// This class implements IGenomeManager, in order to find the /// best driving position group and the best /// portfolio position group with respect to the lag strategy. /// It uses fixed portfolio tickers and it /// is designed to optimize the driving portfolio. /// Normalized weights are used both for the driving and for the /// portfolio tickers. /// </summary> public class WFLagGenomeManagerForFixedPortfolioWithNormalDrivingAndPortfolio : IGenomeManager { private int numberOfDrivingPositions; private int numberOfTickersInPortfolio; private int numberOfEligibleTickersForDrivingWeightedPositions; protected DataTable eligibleTickersForDrivingWeightedPositions; protected DataTable eligibleTickersForPortfolioWeightedPositions; private DateTime firstOptimizationDate; private DateTime lastOptimizationDate; private double minimumPositionWeight; protected WFLagCandidates wFLagCandidates; private IEquityEvaluator equityEvaluator; public int GenomeSize { get { return ( this.numberOfDrivingPositions + this.numberOfTickersInPortfolio ); } } // public int MinValueForGenes // { // get { return -this.numberOfEligibleTickersForDrivingWeightedPositions; } // } // public int MaxValueForGenes // { // get { return this.numberOfEligibleTickersForDrivingWeightedPositions - 1; } // } // public GeneticOptimizer CurrentGeneticOptimizer // { // get{ return this.currentGeneticOptimizer; } // set{ this.currentGeneticOptimizer = value; } // } /// <summary> /// This class implements IGenomeManager, in order to find the /// best driving position group and the best /// portfolio position group with respect to the lag strategy. /// Weighted positions are used for both the driving positions /// and the portfolio positions /// </summary> /// <param name="eligibleTickersForDrivingWeightedPositions">weighted positions /// for driving positions will be chosen among these tickers</param> /// <param name="eligibleTickersForPortfolioWeightedPositions">weighted positions /// for portfolio positions will be chosen among these tickers</param> /// <param name="firstOptimizationDate"></param> /// <param name="lastQuoteDate"></param> /// <param name="numberOfDrivingPositions"></param> /// <param name="numberOfTickersInPortfolio"></param> public WFLagGenomeManagerForFixedPortfolioWithNormalDrivingAndPortfolio( DataTable eligibleTickersForDrivingWeightedPositions , DataTable eligibleTickersForPortfolioWeightedPositions , DateTime firstOptimizationDate , DateTime lastOptimizationDate , int numberOfDrivingPositions , int numberOfTickersInPortfolio , IEquityEvaluator equityEvaluator , int seedForRandomGenerator ) { this.numberOfDrivingPositions = numberOfDrivingPositions; this.numberOfTickersInPortfolio = numberOfTickersInPortfolio; this.numberOfEligibleTickersForDrivingWeightedPositions = eligibleTickersForDrivingWeightedPositions.Rows.Count; this.eligibleTickersForDrivingWeightedPositions = eligibleTickersForDrivingWeightedPositions; this.eligibleTickersForPortfolioWeightedPositions = eligibleTickersForPortfolioWeightedPositions; this.firstOptimizationDate = firstOptimizationDate; this.lastOptimizationDate = lastOptimizationDate; this.minimumPositionWeight = 0.2; // TO DO this value should become a constructor parameter this.equityEvaluator = equityEvaluator; // GenomeManagement.SetRandomGenerator( // QuantProject.ADT.ConstantsProvider.SeedForRandomGenerator // + this.firstOptimizationDate.DayOfYear ); // GenomeManagement.SetRandomGenerator( // 11 ); GenomeManagement.SetRandomGenerator( seedForRandomGenerator ); this.wFLagCandidates = new WFLagCandidates( this.eligibleTickersForDrivingWeightedPositions , this.firstOptimizationDate , this.lastOptimizationDate ); } public int GetMinValueForGenes( int genePosition ) { int minValueForGene = -this.numberOfEligibleTickersForDrivingWeightedPositions; return minValueForGene; } public int GetMaxValueForGenes( int genePosition ) { return this.numberOfEligibleTickersForDrivingWeightedPositions - 1; } #region GetFitnessValue private string[] getTickers( WeightedPositions weightedPositions ) { string[] tickers = new string[ weightedPositions.Count ]; for ( int i = 0 ; i < weightedPositions.Count ; i++ ) { WeightedPosition weightedPosition = weightedPositions.GetWeightedPosition( i ); tickers[ i ] = weightedPosition.Ticker; } return tickers; } private float[] getMultipliers( WeightedPositions weightedPositions ) { float[] multipliers = new float[ weightedPositions.Count ]; for ( int i = 0 ; i < weightedPositions.Count ; i++ ) { WeightedPosition weightedPosition = weightedPositions.GetWeightedPosition( i ); multipliers[ i ] = Convert.ToSingle( weightedPosition.Weight ); } return multipliers; } private double[] getFitnessValue_getLinearCombinationReturns( WeightedPositions weightedPositions ) { // ArrayList enumeratedweightedPositions = // this.getEnumeratedWeightedPositions( weightedPositions ); int numberOfWeightedPositions = weightedPositions.Count; string[] tickers = this.getTickers( weightedPositions ); float[] multipliers = this.getMultipliers( weightedPositions ); // arrays of close to close returns, one for each signed ticker float[][] tickersReturns = this.wFLagCandidates.GetTickersReturns( tickers ); double[] linearCombinationReturns = new double[ tickersReturns[ 0 ].Length ]; for( int i = 0; i < linearCombinationReturns.Length ; i++ ) // computes linearCombinationReturns[ i ] { linearCombinationReturns[ i ] = 0; for ( int j=0 ; j < weightedPositions.Count ; j++ ) { double weightedPositionReturn = tickersReturns[ j ][ i ] * multipliers[ j ]; linearCombinationReturns[ i ] += weightedPositionReturn; } } return linearCombinationReturns; } private double[] getFitnessValue_getStrategyReturn( double[] drivingPositionsReturns , double[] portfolioPositionsReturns ) { // strategyReturns contains one element less than drivingPositionsReturns, // because there is no strategy for the very first period (at least // one day signal is needed) double[] strategyReturns = new double[ portfolioPositionsReturns.Length - 1 ]; for ( int i = 0 ; i < portfolioPositionsReturns.Length - 1 ; i++ ) if ( drivingPositionsReturns[ i ] < 0 ) // the current linear combination of tickers, at period i // has a negative return // go short tomorrow strategyReturns[ i ] = -portfolioPositionsReturns[ i + 1 ]; else // the current linear combination of tickers, at period i // has a positive return // go long tomorrow strategyReturns[ i ] = portfolioPositionsReturns[ i + 1 ]; return strategyReturns; } private double getFitnessValue( double[] strategyReturns ) { // double fitnessValue = // AdvancedFunctions.GetSharpeRatio( // strategyReturns ); // double fitnessValue = // AdvancedFunctions.GetExpectancyScore( // strategyReturns ); double fitnessValue = this.equityEvaluator.GetReturnsEvaluation( strategyReturns ); // double fitnessValue = // this.getFitnessValue_withGoodFinal( strategyReturns ); // double fitnessValue = // BasicFunctions.GetSimpleAverage( strategyReturns ) / // ( Math.Pow( BasicFunctions.GetStdDev( strategyReturns ) , 1.3 ) ); return fitnessValue; } public double GetFitnessValue( WFLagWeightedPositions wFLagWeightedPositions ) { double[] drivingPositionsReturns = this.getFitnessValue_getLinearCombinationReturns( wFLagWeightedPositions.DrivingWeightedPositions ); double[] portfolioPositionsReturns = this.getFitnessValue_getLinearCombinationReturns( wFLagWeightedPositions.PortfolioWeightedPositions ); double[] strategyReturns = this.getFitnessValue_getStrategyReturn( drivingPositionsReturns , portfolioPositionsReturns ); double fitnessValue = this.getFitnessValue( strategyReturns ); return fitnessValue; } public double GetFitnessValue( Genome genome ) { double fitnessValue; WFLagWeightedPositions wFLagWeightedPositions = ( WFLagWeightedPositions )this.Decode( genome ); int genomeLength = genome.Genes().Length; int decodedWeightedPositions = wFLagWeightedPositions.DrivingWeightedPositions.Count + wFLagWeightedPositions.PortfolioWeightedPositions.Count; if ( decodedWeightedPositions < genomeLength ) // genome contains a duplicate gene either for // driving positions or for portfolio positions //fitnessValue = double.MinValue; fitnessValue = -0.2; else // all driving positions genes are distinct and // all portfolio positions genes are distinct fitnessValue = this.GetFitnessValue( wFLagWeightedPositions ); return fitnessValue; } #endregion public Genome[] GetChilds( Genome parent1 , Genome parent2 ) { return GenomeManagement.AlternateFixedCrossover(parent1, parent2); } public void Mutate( Genome genome ) { // int newValueForGene = GenomeManagement.RandomGenerator.Next( // genome.MinValueForGenes , // genome.MaxValueForGenes + 1 ); int genePositionToBeMutated = GenomeManagement.RandomGenerator.Next( genome.Size ); int newValueForGene = this.GetNewGeneValue( genome , genePositionToBeMutated ); GenomeManagement.MutateOneGene( genome , genePositionToBeMutated , newValueForGene ); } #region Decode private int getWeight( Genome genome , int genePosition ) { int geneValue = 1; if ( genome.GetGeneValue( genePosition ) < 0 ) // the position is short geneValue = -1; return geneValue; } private int[] getWeightRelatedGeneValuesForDrivingPositions( Genome genome ) { int[] weightRelatedGeneValuesForDrivingPositions = new int[ this.numberOfDrivingPositions ]; for ( int genePosition = 0 ; genePosition < this.numberOfDrivingPositions ; genePosition++ ) weightRelatedGeneValuesForDrivingPositions[ genePosition ] = this.getWeight( genome , genePosition ); return weightRelatedGeneValuesForDrivingPositions; } private int getTickerIndex( Genome genome , int genePosition ) { int tickerIndex = genome.GetGeneValue( genePosition ); if ( tickerIndex < 0 ) // the position is short tickerIndex += -this.GetMinValueForGenes( genePosition ); return tickerIndex; } private int[] getTickerRelatedGeneValuesForDrivingPositions( Genome genome ) { int[] tickerRelatedGeneValuesForDrivingPositions = new int[ this.numberOfDrivingPositions ]; for ( int genePosition = 0 ; genePosition < this.numberOfDrivingPositions ; genePosition++ ) tickerRelatedGeneValuesForDrivingPositions[ genePosition ] = this.getTickerIndex( genome , genePosition ); return tickerRelatedGeneValuesForDrivingPositions; } private int[] getWeightRelatedGeneValuesForPortfolioPositions( Genome genome ) { int[] weightRelatedGeneValuesForPortfolioPositions = new int[ this.numberOfTickersInPortfolio ]; int firstPositionForPortfolioRelatedGenomes = this.numberOfDrivingPositions; for ( int i = 0 ; i < this.numberOfTickersInPortfolio ; i++ ) { int genePosition = firstPositionForPortfolioRelatedGenomes + i; weightRelatedGeneValuesForPortfolioPositions[ i ] = this.getWeight( genome , genePosition ); } return weightRelatedGeneValuesForPortfolioPositions; } private int[] getTickerRelatedGeneValuesForPortfolioPositions( Genome genome ) { int[] tickerRelatedGeneValuesForPortfolioPositions = new int[ this.numberOfTickersInPortfolio ]; int firstPositionForPortfolioRelatedGenomes = this.numberOfDrivingPositions; for ( int i = 0 ; i < this.numberOfTickersInPortfolio ; i++ ) { int genePosition = firstPositionForPortfolioRelatedGenomes + i; tickerRelatedGeneValuesForPortfolioPositions[ i ] = this.getTickerIndex( genome , genePosition ); } return tickerRelatedGeneValuesForPortfolioPositions; } #region decodeWeightedPositions #region getNormalizedWeightValues private double getAdditionalWeight( int weightRelatedGeneValue ) { double midrangeValue = ( this.GetMinValueForGenes( 0 ) + this.GetMaxValueForGenes( 0 ) ) / 2; double singleWeightFreeRange = 1 - this.minimumPositionWeight; double scaleRange = Convert.ToDouble( this.GetMinValueForGenes( 0 ) - this.GetMaxValueForGenes( 0 ) ); double nonScaledAdditionalWeight = Convert.ToDouble( weightRelatedGeneValue ) - midrangeValue; double scaledAdditionalWeight = nonScaledAdditionalWeight * singleWeightFreeRange / scaleRange; return scaledAdditionalWeight; } private double getNonNormalizedWeightValue( int weightRelatedGeneValue ) { double additionalWeight = this.getAdditionalWeight( weightRelatedGeneValue ); double nonNormalizedWeightValue = 0; if ( additionalWeight >= 0 ) // the gene value represents a long position nonNormalizedWeightValue = this.minimumPositionWeight + additionalWeight; else // additionalWeight < 0 , i.e. the gene value represents a short position nonNormalizedWeightValue = -this.minimumPositionWeight + additionalWeight; return nonNormalizedWeightValue; } private double[] getNonNormalizedWeightValues( int[] weightRelatedGeneValues ) { double[] nonNormalizedWeightValues = new double[ weightRelatedGeneValues.Length ]; for ( int i = 0 ; i < weightRelatedGeneValues.Length ; i++ ) nonNormalizedWeightValues[ i ] = this.getNonNormalizedWeightValue( weightRelatedGeneValues[ i ] ); return nonNormalizedWeightValues; } private double getNormalizingFactor( double[] nonNormalizedWeightValues ) { // the absolute value for each nonNormalizedWeightValue is between // this.minimumPositionWeight and 1 double totalForNonNormalizedWeightValues = BasicFunctions.SumOfAbs( nonNormalizedWeightValues ); double normalizingFactor = 1 / totalForNonNormalizedWeightValues; return normalizingFactor; } private double[] getNormalizedWeightValues( double[] nonNormalizedWeightValues , double normalizingFactor ) { return BasicFunctions.MultiplyBy( nonNormalizedWeightValues , normalizingFactor ); } private double[] getNormalizedWeightValues( double[] nonNormalizedWeightValues ) { double normalizingFactor = this.getNormalizingFactor( nonNormalizedWeightValues ); return getNormalizedWeightValues( nonNormalizedWeightValues , normalizingFactor ); } private double[] getNormalizedWeightValues( int[] weightRelatedGeneValues ) { double[] nonNormalizedWeightValues = this.getNonNormalizedWeightValues( weightRelatedGeneValues ); return this.getNormalizedWeightValues( nonNormalizedWeightValues ); } #endregion private string[] decodeTickers( int[] tickerRelatedGeneValues , DataTable eligibleTickers ) { string[] tickers = new string[ tickerRelatedGeneValues.Length ]; for( int i = 0 ; i < tickerRelatedGeneValues.Length ; i++ ) { int currentGeneValue = tickerRelatedGeneValues[ i ]; tickers[ i ] = ( string )eligibleTickers.Rows[ currentGeneValue ][ 0 ]; } return tickers; } private WeightedPositions decodeWeightedPositions( int[] weightRelatedGeneValues , int[] tickerRelatedGeneValues , DataTable eligibleTickers ) { double[] normalizedWeightValues = this.getNormalizedWeightValues( weightRelatedGeneValues ); string[] tickers = this.decodeTickers( tickerRelatedGeneValues , eligibleTickers ); WeightedPositions weightedPositions = new WeightedPositions( normalizedWeightValues , tickers ); return weightedPositions; } #endregion private WeightedPositions decodeDrivingWeightedPositions( Genome genome ) { int[] weightRelatedGeneValuesForDrivingPositions = this.getWeightRelatedGeneValuesForDrivingPositions( genome ); int[] tickerRelatedGeneValuesForDrivingPositions = this.getTickerRelatedGeneValuesForDrivingPositions( genome ); return decodeWeightedPositions( weightRelatedGeneValuesForDrivingPositions , tickerRelatedGeneValuesForDrivingPositions , this.eligibleTickersForDrivingWeightedPositions ); // // double weight = this.decodeDrivingWeight( genome , geneIndex ); // string ticker = this.decodeDrivingTicker( genome , geneIndex ); // WeightedPosition weightedPosition = new WeightedPosition( // weight , ticker ); // wFLagWeightedPositions.DrivingWeightedPositions.AddWeightedPosition( // weightedPosition ); } private WeightedPositions decodePortfolioWeightedPositions( Genome genome ) { int[] weightRelatedGeneValuesForPortfolioPositions = this.getWeightRelatedGeneValuesForPortfolioPositions( genome ); int[] tickerRelatedGeneValuesForPortfolioPositions = this.getTickerRelatedGeneValuesForPortfolioPositions( genome ); return decodeWeightedPositions( weightRelatedGeneValuesForPortfolioPositions , tickerRelatedGeneValuesForPortfolioPositions , this.eligibleTickersForPortfolioWeightedPositions ); // // double weight = this.decodeDrivingWeight( genome , geneIndex ); // string ticker = this.decodeDrivingTicker( genome , geneIndex ); // WeightedPosition weightedPosition = new WeightedPosition( // weight , ticker ); // wFLagWeightedPositions.DrivingWeightedPositions.AddWeightedPosition( // weightedPosition ); } public virtual object Decode(Genome genome) { WeightedPositions drivingWeightedPositions = this.decodeDrivingWeightedPositions( genome ); WeightedPositions portfolioWeightedPositions = this.decodePortfolioWeightedPositions( genome ); WFLagWeightedPositions wFLagWeightedPositions = new WFLagWeightedPositions( drivingWeightedPositions , portfolioWeightedPositions ); // int[] drivingGeneValues = this.getDrivingGeneValues( genome ); // for ( int geneIndex = 0 ; geneIndex < this.numberOfDrivingPositions * 2 ; // geneIndex += 2 ) // this.decode_addDrivingPosition( genome , geneIndex , wFLagWeightedPositions ); // for ( int geneIndex = this.numberOfDrivingPositions * 2 ; // geneIndex < // ( this.numberOfDrivingPositions + this.numberOfTickersInPortfolio ) * 2 ; // geneIndex += 2 ) // this.decode_addPortfolioPosition( genome , geneIndex , wFLagSignedTickers ); // 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] = // this.decode_getSignedTickerForGeneValue(indexOfTicker); // } return wFLagWeightedPositions; } #endregion #region GetNewGeneValue public int GetNewGeneValue( Genome genome , int genePosition ) { int minGeneValue = this.GetMinValueForGenes( genePosition ); int maxGeneValue = this.GetMaxValueForGenes( genePosition ); int returnValue = GenomeManagement.RandomGenerator.Next( minGeneValue , maxGeneValue + 1); return returnValue; } #endregion } } |
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WeightedPositionsChoosers/WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2636/b7_Scripts/WalkForwardTesting/WalkForwardLag/WeightedPositionsChoosers/WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio Modified Files: WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio.cs Log Message: A WFLagGenomeManagerForFixedPortfolioWithNormalDrivingAndPortfolio genome manager is used now, instead of a general WFLagGenomeManager Index: WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WeightedPositionsChoosers/WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio/WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio.cs 11 Jun 2007 17:56:59 -0000 1.1 --- WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio.cs 13 Jun 2007 21:29:01 -0000 1.2 *************** *** 160,165 **** now.DateTime; ! WFLagGenomeManager genomeManager = ! new WFLagGenomeManager( eligibleTickersForDrivingPositions.EligibleTickers , eligibleTickersForDrivingPositions.EligibleTickers , --- 160,166 ---- now.DateTime; ! WFLagGenomeManagerForFixedPortfolioWithNormalDrivingAndPortfolio ! genomeManager = ! new WFLagGenomeManagerForFixedPortfolioWithNormalDrivingAndPortfolio( eligibleTickersForDrivingPositions.EligibleTickers , eligibleTickersForDrivingPositions.EligibleTickers , |
|
From: Glauco S. <gla...@us...> - 2007-06-11 18:56:58
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28444/b3_Data Modified Files: b3_Data.csproj Log Message: Automatic changes applied by VSNet. Index: b3_Data.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/b3_Data.csproj,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** b3_Data.csproj 9 Apr 2007 18:19:09 -0000 1.46 --- b3_Data.csproj 11 Jun 2007 17:54:02 -0000 1.47 *************** *** 125,128 **** --- 125,136 ---- Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> + <Reference + Name = "Microsoft.Office.Core" + Guid = "{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}" + VersionMajor = "2" + VersionMinor = "3" + Lcid = "0" + WrapperTool = "primary" + /> </References> </Build> |
|
From: Glauco S. <gla...@us...> - 2007-06-11 18:56:57
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27662/b7_Scripts/WalkForwardTesting/WalkForwardLag Modified Files: WFLagEndOfDayTimerHandler.cs Log Message: - the QuantProject.Scripts.SimpleTesting namespace is not used anymore - the QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WeightedPositionsChoosers is added to those used Index: WFLagEndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WFLagEndOfDayTimerHandler.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** WFLagEndOfDayTimerHandler.cs 18 Feb 2007 01:00:11 -0000 1.7 --- WFLagEndOfDayTimerHandler.cs 11 Jun 2007 17:52:04 -0000 1.8 *************** *** 32,36 **** using QuantProject.Business.Strategies.EquityEvaluation; using QuantProject.Business.Timing; ! using QuantProject.Scripts.SimpleTesting; namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardLag --- 32,37 ---- using QuantProject.Business.Strategies.EquityEvaluation; using QuantProject.Business.Timing; ! using QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WeightedPositionsChoosers; ! namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardLag *************** *** 49,52 **** --- 50,54 ---- private string benchmark; private int numberEligibleTickers; + QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WeightedPositionsChoosers. IWFLagWeightedPositionsChooser wFLagWeightedPositionsChooser; private int outOfSampleWindowDays; |
|
From: Glauco S. <gla...@us...> - 2007-06-11 18:56:56
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26794/b7_Scripts/WalkForwardTesting/WalkForwardLag Modified Files: WFLagCandidates.cs Log Message: Minor fixing applied to an exception message Index: WFLagCandidates.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WFLagCandidates.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** WFLagCandidates.cs 8 Oct 2006 16:10:45 -0000 1.5 --- WFLagCandidates.cs 11 Jun 2007 17:50:47 -0000 1.6 *************** *** 65,69 **** "two rows. It has less than two rows!" ); if ( firstQuoteDate >= lastQuoteDate ) ! throw new Exception( "firstQuoteDate has to be less than" + "lastQuoteDate!" ); } --- 65,69 ---- "two rows. It has less than two rows!" ); if ( firstQuoteDate >= lastQuoteDate ) ! throw new Exception( "firstQuoteDate has to be less than " + "lastQuoteDate!" ); } |
|
From: Glauco S. <gla...@us...> - 2007-06-11 18:56:56
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WeightedPositionsChoosers In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26259/b7_Scripts/WalkForwardTesting/WalkForwardLag/WeightedPositionsChoosers Modified Files: WFLagBruteForceFixedPortfolioWeightedPositionsChooser.cs Log Message: The namespace has been changed from QuantProject.Scripts.WalkForwardTesting.WalkForwardLag to QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WeightedPositionsChoosers Index: WFLagBruteForceFixedPortfolioWeightedPositionsChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WeightedPositionsChoosers/WFLagBruteForceFixedPortfolioWeightedPositionsChooser.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WFLagBruteForceFixedPortfolioWeightedPositionsChooser.cs 18 Feb 2007 01:16:30 -0000 1.1 --- WFLagBruteForceFixedPortfolioWeightedPositionsChooser.cs 11 Jun 2007 17:50:01 -0000 1.2 *************** *** 34,38 **** ! namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardLag { /// <summary> --- 34,38 ---- ! namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WeightedPositionsChoosers { /// <summary> |
|
From: Glauco S. <gla...@us...> - 2007-06-11 18:56:55
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WeightedPositionsChoosers In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21602 Modified Files: IWFLagWeightedPositionsChooser.cs Log Message: The namespace has been changed from QuantProject.Scripts.WalkForwardTesting.WalkForwardLag to QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WeightedPositionsChoosers Index: IWFLagWeightedPositionsChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WeightedPositionsChoosers/IWFLagWeightedPositionsChooser.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IWFLagWeightedPositionsChooser.cs 18 Feb 2007 01:15:48 -0000 1.1 --- IWFLagWeightedPositionsChooser.cs 11 Jun 2007 17:39:04 -0000 1.2 *************** *** 29,33 **** ! namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardLag { /// <summary> --- 29,33 ---- ! namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WeightedPositionsChoosers { /// <summary> |
|
From: Glauco S. <gla...@us...> - 2007-06-11 18:56:52
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23621/b7_Scripts/WalkForwardTesting/WalkForwardLag Modified Files: RunWalkForwardLag.cs Log Message: - it now uses the QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WeightedPositionsChoosers namespace - private IEquityEvaluator equityEvaluator has been removed (the IWFLagWeightedPositionsChooser now handels such low level details) Index: RunWalkForwardLag.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/RunWalkForwardLag.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RunWalkForwardLag.cs 18 Feb 2007 01:04:59 -0000 1.8 --- RunWalkForwardLag.cs 11 Jun 2007 17:43:51 -0000 1.9 *************** *** 33,36 **** --- 33,37 ---- using QuantProject.Presentation; using QuantProject.Presentation.Reporting.WindowsForm; + using QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WeightedPositionsChoosers; using QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WFLagDebugger; *************** *** 56,60 **** private DateTime firstDateTime; private DateTime lastDateTime; - private IEquityEvaluator equityEvaluator; private double maxRunningHours; --- 57,60 ---- *************** *** 90,94 **** this.firstDateTime = firstDateTime; this.lastDateTime = lastDateTime; - this.equityEvaluator = equityEvaluator; this.maxRunningHours = maxRunningHours; --- 90,93 ---- |
|
From: Glauco S. <gla...@us...> - 2007-06-11 18:55:15
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28404/b7_Scripts/WalkForwardTesting/WalkForwardLag Modified Files: WFLagMain.cs Log Message: The code has been changed to test a WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio object. Index: WFLagMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WFLagMain.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** WFLagMain.cs 18 Feb 2007 00:57:34 -0000 1.7 --- WFLagMain.cs 11 Jun 2007 17:53:29 -0000 1.8 *************** *** 28,31 **** --- 28,32 ---- using QuantProject.Presentation; + using QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WeightedPositionsChoosers; using QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WFLagDebugger; *************** *** 140,147 **** 4 , new string[]{ "IWM" , "SPY" } , 100 , "EWQ" , new QuantProject.Business.Strategies.EquityEvaluation.WinningPeriods() ); new RunWalkForwardLag( "DrvPstns" , 200 , ! wFLagWeightedPositionsChooser , 9 , new DateTime( 2001 , 1 , 1 ) , ! new DateTime( 2001 , 6 , 1 ) , 0.5 ).Run(); --- 141,153 ---- 4 , new string[]{ "IWM" , "SPY" } , 100 , "EWQ" , new QuantProject.Business.Strategies.EquityEvaluation.WinningPeriods() ); + wFLagWeightedPositionsChooser = + new WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio( + 4 , new string[]{ "IWM" , "SPY" } , 100 , "EWQ" , + new QuantProject.Business.Strategies.EquityEvaluation.WinningPeriods() , + 1000 , 15 ); new RunWalkForwardLag( "DrvPstns" , 200 , ! wFLagWeightedPositionsChooser , 13 , new DateTime( 2001 , 1 , 1 ) , ! new DateTime( 2001 , 1 , 8 ) , 0.5 ).Run(); |
|
From: Glauco S. <gla...@us...> - 2007-06-11 18:55:15
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28844/b4_Business Modified Files: b4_Business.csproj Log Message: Automatic changes applied by VSNet. Index: b4_Business.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** b4_Business.csproj 27 Feb 2007 23:06:34 -0000 1.39 --- b4_Business.csproj 11 Jun 2007 17:54:20 -0000 1.40 *************** *** 130,133 **** --- 130,141 ---- Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> + <Reference + Name = "Microsoft.Office.Core" + Guid = "{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}" + VersionMajor = "2" + VersionMinor = "3" + Lcid = "0" + WrapperTool = "primary" + /> </References> </Build> |
|
From: Glauco S. <gla...@us...> - 2007-06-11 18:55:15
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28898/b5_Presentation Modified Files: b5_Presentation.csproj Log Message: Automatic changes applied by VSNet. Index: b5_Presentation.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/b5_Presentation.csproj,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** b5_Presentation.csproj 27 Feb 2007 23:06:34 -0000 1.35 --- b5_Presentation.csproj 11 Jun 2007 17:54:59 -0000 1.36 *************** *** 135,138 **** --- 135,146 ---- HintPath = "..\..\..\..\..\Documents and Settings\Glauco\Desktop\NPlot\NPlot.dll" /> + <Reference + Name = "Microsoft.Office.Core" + Guid = "{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}" + VersionMajor = "2" + VersionMinor = "3" + Lcid = "0" + WrapperTool = "primary" + /> </References> </Build> |
|
From: Glauco S. <gla...@us...> - 2007-06-11 18:55:15
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WeightedPositionsChoosers/WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29312/WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WeightedPositionsChoosers/WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio added to the repository |
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WeightedPositionsChoosers/WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29765 Added Files: WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio.cs Log Message: Computes the best driving positions using the genetic optimizer. Portfolio positions are fixed. Only normal weights are considered, both for driving positions and for portfolio positions --- NEW FILE: WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio.cs --- /* QuantProject - Quantitative Finance Library WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using QuantProject.ADT; using QuantProject.ADT.Optimizing.Genetic; using QuantProject.Business.Strategies.EquityEvaluation; using QuantProject.Business.Timing; using QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WFLagDebugger; namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WeightedPositionsChoosers { /// <summary> /// Computes the best driving positions using the genetic /// optimizer. Portfolio positions are fixed. Only normal weights are considered, /// both for driving positions and for portfolio positions /// </summary> public class WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio : IWFLagWeightedPositionsChooser { public event NewProgressEventHandler NewProgress; protected int numberOfDrivingPositions; protected int numberOfPortfolioPositions; protected int inSampleDays; protected string benchmark; protected IEquityEvaluator equityEvaluator; protected int populationSizeForGeneticOptimizer; protected int generationNumberForGeneticOptimizer; protected WFLagChosenPositions wFLagChosenPositions; // first in sample quote date for driving positions protected DateTime firstInSampleDrivingDate; // last in sample quote date for equity evaluation protected DateTime lastInSampleOptimizationDate; public int NumberOfDrivingPositions { get { return this.numberOfDrivingPositions; } } public int NumberOfPortfolioPositions { get { return this.numberOfPortfolioPositions; } } public int NumberDaysForInSampleOptimization { get { return this.inSampleDays; } } public string Benchmark { get { return this.benchmark; } } public WFLagChosenPositions WFLagChosenPositions { get { return this.wFLagChosenPositions; } } /// <summary> /// /// </summary> /// <param name="numberOfDrivingPositions"></param> /// <param name="numberOfPortfolioPositions"></param> /// <param name="inSampleDays">the number of in sample /// data required. Since one more driving day is needed, the max number of /// possible trades will be numberDaysForInSampleOptimization-1</param></param> public WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio( int numberOfDrivingPositions , string[] portfolioPositionTickers , int inSampleDays , string benchmark , IEquityEvaluator equityEvaluator , int populationSizeForGeneticOptimizer , int generationNumberForGeneticOptimizer ) { this.numberOfDrivingPositions = numberOfDrivingPositions; this.numberOfPortfolioPositions = portfolioPositionTickers.Length; this.inSampleDays = inSampleDays; this.benchmark = benchmark; this.equityEvaluator = equityEvaluator; this.populationSizeForGeneticOptimizer = populationSizeForGeneticOptimizer; this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; } #region setWeightedPositions_usingTheGeneticOptimizer private void newGenerationEventHandler( object sender , NewGenerationEventArgs e ) { this.NewProgress( sender , new NewProgressEventArgs( e.GenerationCounter , e.GenerationNumber ) ); } // private void setWeightedPositions( // WFLagWeightedPositions wFLagWeightedPositions ) // { // this.drivingWeightedPositions = // wFLagWeightedPositions.DrivingWeightedPositions; // this.portfolioWeightedPositions = // wFLagWeightedPositions.PortfolioWeightedPositions; // } private void setSignedTickers_setTickersFromGenome( IGenomeManager genomeManager , Genome genome ) { this.wFLagChosenPositions = ( WFLagChosenPositions )genomeManager.Decode( genome ); // this.setWeightedPositions( wFLagWeightedPositions ); // this.drivingWeightedPositions = // wFLagWeightedPositions.DrivingWeightedPositions; // this.portfolioWeightedPositions = // wFLagWeightedPositions.PortfolioWeightedPositions; } public virtual void setWeightedPositions_usingTheGeneticOptimizer( WFLagEligibleTickers eligibleTickersForDrivingPositions , EndOfDayDateTime now ) { this.firstInSampleDrivingDate = now.DateTime.AddDays( -( this.NumberDaysForInSampleOptimization - 1 ) ); this.lastInSampleOptimizationDate = now.DateTime; WFLagGenomeManager genomeManager = new WFLagGenomeManager( eligibleTickersForDrivingPositions.EligibleTickers , eligibleTickersForDrivingPositions.EligibleTickers , this.firstInSampleDrivingDate , this.lastInSampleOptimizationDate , this.numberOfDrivingPositions , this.numberOfPortfolioPositions , this.equityEvaluator , QuantProject.ADT.ConstantsProvider.SeedForRandomGenerator ); GeneticOptimizer geneticOptimizer = new GeneticOptimizer( 0.85 , 0.02 , 0.001 , this.populationSizeForGeneticOptimizer , this.generationNumberForGeneticOptimizer , genomeManager , ConstantsProvider.SeedForRandomGenerator ); geneticOptimizer.NewGeneration += new NewGenerationEventHandler( this.newGenerationEventHandler ); geneticOptimizer.Run( false ); this.setSignedTickers_setTickersFromGenome( genomeManager , geneticOptimizer.BestGenome ); // this.generation = geneticOptimizer.BestGenome.Generation; } #endregion private void chosePositions_checkParameters( WFLagEligibleTickers eligibleTickersForDrivingPositions , EndOfDayDateTime now ) { if ( now.EndOfDaySpecificTime != EndOfDaySpecificTime.OneHourAfterMarketClose ) throw new Exception( "The 'now' parameter must be one hour after market " + "close. It is not." ); if ( eligibleTickersForDrivingPositions.EligibleTickers.Rows.Count < this.NumberOfDrivingPositions ) throw new Exception( "Eligilbe tickers for driving positions contains " + "only " + eligibleTickersForDrivingPositions.EligibleTickers.Rows.Count + " elements, while NumberOfDrivingPositions is " + this.NumberOfDrivingPositions ); } /// <summary> /// Sets the best WFLagChosenPositions, with respecto to in sample data. /// </summary> /// <param name="eligibleTickersForDrivingPositions"></param> /// <param name="eligibleTickersForPortfolioPositions"></param> /// <param name="now">Last in sample EndOfDayDateTime. It is expected to be /// one hour after market close</param> public void ChosePositions( WFLagEligibleTickers eligibleTickersForDrivingPositions , WFLagEligibleTickers eligibleTickersForPortfolioPositions , EndOfDayDateTime now ) { this.chosePositions_checkParameters( eligibleTickersForDrivingPositions , now ); this.setWeightedPositions_usingTheGeneticOptimizer( eligibleTickersForDrivingPositions , now ); } } } |
|
From: Glauco S. <gla...@us...> - 2007-06-11 18:55:13
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30189/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: WalkForwardTesting\WalkForwardLag\WeightedPositionsChoosers\WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio\WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio.cs has been added Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** b7_Scripts.csproj 9 Apr 2007 18:19:08 -0000 1.71 --- b7_Scripts.csproj 11 Jun 2007 17:57:40 -0000 1.72 *************** *** 804,807 **** --- 804,812 ---- /> <File + RelPath = "WalkForwardTesting\WalkForwardLag\WeightedPositionsChoosers\WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio\WFLagGeneticFixedPortfolioWithNormalDrivingAndPortfolio.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "WalkForwardTesting\WalkForwardLag\WFLagBruteForceOptimizableItemManager\WFLagBruteForceOptimizableParametersManager.cs" SubType = "Code" |
|
From: Marco M. <mi...@us...> - 2007-04-09 18:23:53
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/OverReactionHypothesis/SimpleOHTest In directory sc8-pr-cvs16:/tmp/cvs-serv14643 Added Files: RunSimpleOHTest.cs EndOfDayTimerHandlerSimpleOHTest.cs Log Message: Added files for the SimpleOHTest, a simple strategy based on the OverReaction Hypothesis. --- NEW FILE: RunSimpleOHTest.cs --- /* QuantProject - Quantitative Finance Library RunSimpleOHTest.cs Copyright (C) 2007 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.IO; using QuantProject.ADT.FileManaging; using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Accounting.Reporting; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Timing; using QuantProject.Presentation.Reporting.WindowsForm; namespace QuantProject.Scripts.ArbitrageTesting.OverReactionHypothesis.SimpleOHTest { /// <summary> /// Script that implements the SimpleOHTest strategy: /// at each open, l long positions and s short positions will be open, /// buying and shorting, accordingly, the l tickers among the /// b best that more moves down (at open) and the s tickers among the w worst /// that more moves up (at open). /// The fundamental of the strategy should be the fact (to be verified ...) /// that overreactions may be followed by opposite overreactions. /// For chosing the b best and w worst tickers it is considered just the /// previous close. /// At each close, open positions are closed. /// </summary> [Serializable] public class RunSimpleOHTest { private string scriptName; private string tickerGroupID; private string benchmark; private int numberOfEligibleTickers; private int numOfBestTickers; private int numOfWorstTickers; private int numOfTickersForBuying; private int numOfTickersForShortSelling; private DateTime startDate; private DateTime endDate; private double maxRunningHours; private DateTime startingTimeForScript; private Account account; private IHistoricalQuoteProvider historicalQuoteProvider; private IEndOfDayTimer endOfDayTimer; public RunSimpleOHTest(string tickerGroupID, string benchmark, int numberOfEligibleTickers, int numOfBestTickers, int numOfWorstTickers, int numOfTickersForBuying, int numOfTickersForShortSelling, DateTime startDate, DateTime endDate, double maxRunningHours) { this.tickerGroupID = tickerGroupID; this.benchmark = benchmark; this.numberOfEligibleTickers = numberOfEligibleTickers; this.numOfBestTickers = numOfBestTickers; this.numOfWorstTickers = numOfWorstTickers; this.numOfTickersForBuying = numOfTickersForBuying; this.numOfTickersForShortSelling = numOfTickersForShortSelling; this.startDate = startDate; this.endDate = endDate; this.maxRunningHours = maxRunningHours; this.scriptName = "SimpleOHTest"; this.historicalQuoteProvider = new HistoricalRawQuoteProvider(); this.endOfDayTimer = new IndexBasedEndOfDayTimer( new EndOfDayDateTime( this.startDate , EndOfDaySpecificTime.MarketOpen ) , this.benchmark ); } public void Run() { this.startingTimeForScript = DateTime.Now; this.account = new Account( "SimpleOH" , this.endOfDayTimer , new HistoricalEndOfDayDataStreamer( this.endOfDayTimer , this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , this.historicalQuoteProvider ) ); EndOfDayTimerHandlerSimpleOHTest endOfDayTimerHandler = new EndOfDayTimerHandlerSimpleOHTest(this.tickerGroupID, this.numberOfEligibleTickers, this.numOfBestTickers, this.numOfWorstTickers, this.numOfTickersForBuying, this.numOfTickersForShortSelling, this.account, this.benchmark); this.endOfDayTimer.MarketOpen += new MarketOpenEventHandler( endOfDayTimerHandler.MarketOpenEventHandler ); this.endOfDayTimer.MarketClose += new MarketCloseEventHandler( endOfDayTimerHandler.MarketCloseEventHandler ); this.endOfDayTimer.MarketClose += new MarketCloseEventHandler( this.checkDateForReport); this.endOfDayTimer.OneHourAfterMarketClose += new OneHourAfterMarketCloseEventHandler( endOfDayTimerHandler.OneHourAfterMarketCloseEventHandler ); this.endOfDayTimer.Start(); } private void checkDateForReport(Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs) { if(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime>=this.endDate || DateTime.Now >= this.startingTimeForScript.AddHours(this.maxRunningHours)) //last date is reached by the timer or maxRunning hours //are elapsed from the time script started this.SaveScriptResults(); } private void checkDateForReport_createDirIfNotPresent(string dirPath) { if(!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath); } public void SaveScriptResults() { string fileName = DateTime.Now.Hour.ToString().PadLeft(2,'0') + "_" + DateTime.Now.Minute.ToString().PadLeft(2,'0') + "_" + this.scriptName + "_From_" + this.tickerGroupID + "_elig_" + this.numberOfEligibleTickers + "_best_" + this.numOfBestTickers + "_worst_" + this.numOfWorstTickers + "_forLong_" + this.numOfTickersForBuying + "_forShort_" + this.numOfTickersForShortSelling; string dirNameWhereToSaveReports = System.Configuration.ConfigurationSettings.AppSettings["ReportsArchive"] + "\\" + this.scriptName + "\\"; //default report with numIntervalDays = 1 AccountReport accountReport = this.account.CreateReport(fileName,1, this.endOfDayTimer.GetCurrentTime(), this.benchmark, new HistoricalRawQuoteProvider() ); // new HistoricalAdjustedQuoteProvider()); this.checkDateForReport_createDirIfNotPresent(dirNameWhereToSaveReports); ObjectArchiver.Archive(accountReport, dirNameWhereToSaveReports + fileName + ".qPr"); this.endOfDayTimer.Stop(); } } } --- NEW FILE: EndOfDayTimerHandlerSimpleOHTest.cs --- /* QuantProject - Quantitative Finance Library EndOfDayTimerHandlerSimpleOHTest.cs Copyright (C) 2007 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Data; using System.Collections; using QuantProject.ADT; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Timing; using QuantProject.Business.Strategies; using QuantProject.Data; using QuantProject.Data.DataProviders; using QuantProject.Data.Selectors; namespace QuantProject.Scripts.ArbitrageTesting.OverReactionHypothesis.SimpleOHTest { /// <summary> /// Implements MarketOpenEventHandler and MarketCloseEventHandler /// These handlers contain the core strategy for the Simple OH Test, /// based on the OverReaction Hypothesis /// </summary> [Serializable] public class EndOfDayTimerHandlerSimpleOHTest { private string tickerGroupID; private int numberOfEligibleTickers; private string benchmark; private Account account; private int numOfWorstTickers; private int numOfBestTickers; private int numOfTickersForBuying; private int numOfTickersForShortSelling; private string[] bestTickers; private string[] worstTickers; private string[] chosenTickers; private string[] lastOrderedTickers; private ArrayList orders; public EndOfDayTimerHandlerSimpleOHTest(string tickerGroupID, int numberOfEligibleTickers, int numOfBestTickers, int numOfWorstTickers, int numOfTickersForBuying, int numOfTickersForShortSelling, Account account, string benchmark) { this.tickerGroupID = tickerGroupID; this.numberOfEligibleTickers = numberOfEligibleTickers; this.account = account; this.benchmark = benchmark; this.numOfBestTickers = numOfBestTickers; this.bestTickers = new string[this.numOfBestTickers]; this.numOfWorstTickers = numOfWorstTickers; this.worstTickers = new string[this.numOfWorstTickers]; this.numOfTickersForBuying = numOfTickersForBuying; this.numOfTickersForShortSelling = numOfTickersForShortSelling; this.chosenTickers = new string[this.numOfTickersForBuying + this.numOfTickersForShortSelling]; this.lastOrderedTickers = new string[this.chosenTickers.Length]; this.orders = new ArrayList(); } #region MarketOpenEventHandler private void addOrderForTicker(string[] tickers, int tickerPosition ) { string ticker = SignedTicker.GetTicker(tickers[tickerPosition]); double cashForSinglePosition = this.account.CashAmount / this.chosenTickers.Length; long quantity = Convert.ToInt64( Math.Floor( cashForSinglePosition / this.account.DataStreamer.GetCurrentBid( ticker ) ) ); Order order = new Order( SignedTicker.GetMarketOrderType(tickers[tickerPosition]), new Instrument( ticker ) , quantity ); this.orders.Add(order); } private void addChosenTickersToOrderList(string[] tickers) { for( int i = 0; i<tickers.Length; i++) { if(tickers[i] != null) { this.addOrderForTicker( tickers, i ); this.lastOrderedTickers[i] = SignedTicker.GetTicker(tickers[i]); } } } private void openPositions(string[] tickers) { this.addChosenTickersToOrderList(tickers); //execute orders actually foreach(object item in this.orders) this.account.AddOrder((Order)item); } private double setChosenTickers_getGainOrLossFromPreviousClose(string signedTicker) { IndexBasedEndOfDayTimer currentTimer = (IndexBasedEndOfDayTimer)this.account.EndOfDayTimer; ExtendedDateTime nowAtOpen = new ExtendedDateTime(currentTimer.GetCurrentTime().DateTime, BarComponent.Open); ExtendedDateTime previousClose = new ExtendedDateTime(currentTimer.GetPreviousDateTime(), BarComponent.Close); double currentValueAtOpen = HistoricalDataProvider.GetAdjustedMarketValue(SignedTicker.GetTicker(signedTicker), nowAtOpen); double previousValueAtClose = HistoricalDataProvider.GetAdjustedMarketValue(SignedTicker.GetTicker(signedTicker), previousClose); return (currentValueAtOpen - previousValueAtClose) / previousValueAtClose; } private void setChosenTickers_addTickersForShorting() { DataTable worstTickersOrderedByGainAtOpen = new DataTable(); worstTickersOrderedByGainAtOpen.Columns.Add("ticker", Type.GetType("System.String")); worstTickersOrderedByGainAtOpen.Columns.Add("gainAtOpen", Type.GetType("System.Double")); object[] values = new object[2]; for (int i = 0; i<this.worstTickers.Length; i++) { values[0] = this.worstTickers[i]; values[1] = this.setChosenTickers_getGainOrLossFromPreviousClose(this.worstTickers[i]); worstTickersOrderedByGainAtOpen.Rows.Add(values); } DataRow[] orderedRows = new DataRow[this.bestTickers.Length]; orderedRows = worstTickersOrderedByGainAtOpen.Select("", "gainAtOpen DESC"); for(int i = 0;i<this.numOfTickersForBuying; i++) if( (double)orderedRows[i]["gainAtOpen"] > 0 ) //at open, current ticker is gaining this.chosenTickers[this.numOfTickersForBuying + i] = "-" + (string)orderedRows[i]["ticker"]; } private void setChosenTickers_addTickersForBuying() { DataTable bestTickersOrderedByLossAtOpen = new DataTable(); bestTickersOrderedByLossAtOpen.Columns.Add("ticker", Type.GetType("System.String")); bestTickersOrderedByLossAtOpen.Columns.Add("lossAtOpen", Type.GetType("System.Double")); object[] values = new object[2]; for (int i = 0; i<this.bestTickers.Length; i++) { values[0] = this.bestTickers[i]; values[1] = - this.setChosenTickers_getGainOrLossFromPreviousClose(this.bestTickers[i]); bestTickersOrderedByLossAtOpen.Rows.Add(values); } DataRow[] orderedRows = new DataRow[this.bestTickers.Length]; orderedRows = bestTickersOrderedByLossAtOpen.Select("", "lossAtOpen DESC"); for( int i = 0; i<this.numOfTickersForShortSelling; i++) if( (double)orderedRows[i]["lossAtOpen"] > 0 ) //at open, current ticker is losing this.chosenTickers[i] = (string)orderedRows[i]["ticker"]; } private void setChosenTickers() { for(int i = 0; i<this.chosenTickers.Length;i++) this.chosenTickers[i] = null; if( this.bestTickers[0] != null && this.worstTickers[0] != null ) { this.setChosenTickers_addTickersForBuying(); this.setChosenTickers_addTickersForShorting(); } } /// <summary> /// Handles a "Market Open" event. /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> public void MarketOpenEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { if(this.orders.Count == 0 && this.account.Transactions.Count == 0) this.account.AddCash(30000); this.setChosenTickers(); bool allTickerHasBeenChosen = true; for( int i = 0; i<this.chosenTickers.Length; i++) { if(this.chosenTickers[i] == null) allTickerHasBeenChosen = false; } if(allTickerHasBeenChosen) this.openPositions(this.chosenTickers); } #endregion #region MarketCloseEventHandler private void closePosition( string ticker ) { this.account.ClosePosition( ticker ); } private void closePositions() { if(this.lastOrderedTickers != null) foreach( string ticker in this.lastOrderedTickers ) for( int i = 0; i<this.account.Portfolio.Keys.Count; i++ ) if( this.account.Portfolio[ticker]!=null ) closePosition( ticker ); } public void MarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { this.closePositions(); } #endregion #region OneHourAfterMarketCloseEventHandler /// <summary> /// Handles a "One hour after market close" event. /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> public void OneHourAfterMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { this.orders.Clear(); DateTime currentDate = endOfDayTimingEventArgs.EndOfDayDateTime.DateTime; SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, currentDate); DataTable tickersFromGroup = temporizedGroup.GetTableOfSelectedTickers(); //remark from here for DEBUG SelectorByAverageRawOpenPrice byPrice = new SelectorByAverageRawOpenPrice( tickersFromGroup,false,currentDate.AddDays(-10), currentDate, tickersFromGroup.Rows.Count, 25 ); SelectorByLiquidity mostLiquidSelector = new SelectorByLiquidity(byPrice.GetTableOfSelectedTickers(), false,currentDate.AddDays(-30), currentDate, this.numberOfEligibleTickers); SelectorByOpenToCloseVolatility lessVolatile = new SelectorByOpenToCloseVolatility(mostLiquidSelector.GetTableOfSelectedTickers(), true,currentDate.AddDays(-30), currentDate, this.numberOfEligibleTickers/2); SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromMostLiquid = new SelectorByQuotationAtEachMarketDay(lessVolatile.GetTableOfSelectedTickers(), false, currentDate.AddDays(-30), currentDate, this.numberOfEligibleTickers/2, this.benchmark); SelectorByAverageCloseToClosePerformance bestTickersFromQuoted = new SelectorByAverageCloseToClosePerformance(quotedAtEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(), false,currentDate,currentDate,this.bestTickers.Length); SelectorByAverageCloseToClosePerformance worstTickersFromQuoted = new SelectorByAverageCloseToClosePerformance(quotedAtEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(), true,currentDate,currentDate,this.worstTickers.Length); DataTable tableOfBestTickers = bestTickersFromQuoted.GetTableOfSelectedTickers(); for(int i = 0;i<this.bestTickers.Length;i++) if(tableOfBestTickers.Rows[i][0] != null) this.bestTickers[i] = (string)tableOfBestTickers.Rows[i][0]; DataTable tableOfWorstTickers = worstTickersFromQuoted.GetTableOfSelectedTickers(); for(int i = 0;i<this.worstTickers.Length;i++) if(tableOfWorstTickers.Rows[i][0] != null) this.worstTickers[i] = (string)tableOfWorstTickers.Rows[i][0]; // //for DEBUG // //remark from here for real running // SelectorByLiquidity mostLiquidSelector = // new SelectorByLiquidity(tickersFromGroup, // false,currentDate.AddDays(-30), currentDate, // this.numberOfEligibleTickers); // // SelectorByAverageCloseToClosePerformance bestTickersFromMostLiquid = // new SelectorByAverageCloseToClosePerformance(mostLiquidSelector.GetTableOfSelectedTickers(), // false,currentDate,currentDate,this.bestTickers.Length); // // SelectorByAverageCloseToClosePerformance worstTickersFromMostLiquid = // new SelectorByAverageCloseToClosePerformance(mostLiquidSelector.GetTableOfSelectedTickers(), // true,currentDate,currentDate,this.worstTickers.Length); // // DataTable tableOfBestTickers = bestTickersFromMostLiquid.GetTableOfSelectedTickers(); // for(int i = 0;i<this.bestTickers.Length;i++) // if(tableOfBestTickers.Rows[i][0] != null) // this.bestTickers[i] = (string)tableOfBestTickers.Rows[i][0]; // // DataTable tableOfWorstTickers = worstTickersFromMostLiquid.GetTableOfSelectedTickers(); // for(int i = 0;i<this.worstTickers.Length;i++) // if(tableOfWorstTickers.Rows[i][0] != null) // this.worstTickers[i] = (string)tableOfWorstTickers.Rows[i][0]; } #endregion } } |
|
From: Marco M. <mi...@us...> - 2007-04-09 18:22:26
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/OverReactionHypothesis In directory sc8-pr-cvs16:/tmp/cvs-serv13099/OverReactionHypothesis Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/OverReactionHypothesis added to the repository |
|
From: Marco M. <mi...@us...> - 2007-04-09 18:22:26
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/OverReactionHypothesis/SimpleOHTest In directory sc8-pr-cvs16:/tmp/cvs-serv13129/SimpleOHTest Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/OverReactionHypothesis/SimpleOHTest added to the repository |
|
From: Marco M. <mi...@us...> - 2007-04-09 18:20:39
|
Update of /cvsroot/quantproject/QuantProject/b3_Data
In directory sc8-pr-cvs16:/tmp/cvs-serv12493/b3_Data
Modified Files:
b3_Data.csproj
Log Message:
Updated VisualStudio and SharpDevelop project's files
Index: b3_Data.csproj
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b3_Data/b3_Data.csproj,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** b3_Data.csproj 27 Feb 2007 23:06:34 -0000 1.45
--- b3_Data.csproj 9 Apr 2007 18:19:09 -0000 1.46
***************
*** 136,140 ****
<File
RelPath = "ExtendedDataTable.cs"
! SubType = "Code"
BuildAction = "Compile"
/>
--- 136,140 ----
<File
RelPath = "ExtendedDataTable.cs"
! SubType = "Component"
BuildAction = "Compile"
/>
|
|
From: Marco M. <mi...@us...> - 2007-04-09 18:20:23
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts
In directory sc8-pr-cvs16:/tmp/cvs-serv12493/b7_Scripts
Modified Files:
Scripts_SD.csproj b7_Scripts.csproj
Log Message:
Updated VisualStudio and SharpDevelop project's files
Index: Scripts_SD.csproj
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/Scripts_SD.csproj,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Scripts_SD.csproj 27 Feb 2007 23:06:34 -0000 1.5
--- Scripts_SD.csproj 9 Apr 2007 18:19:08 -0000 1.6
***************
*** 144,148 ****
<Compile Include="WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagReportDebugger.cs" />
<Compile Include="WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagDebugPositions\WFLagDebugPositionsEndOfDayTimerHandler.cs" />
- <Compile Include="WalkForwardTesting\WalkForwardLag\WFLagNewChosenTickersEventArgs.cs" />
<Compile Include="WalkForwardTesting\WalkForwardLag\WFLagMain.cs" />
<Compile Include="ArbitrageTesting\PairTrading\SimplePairTrading\InSample\OutputDisplayer.cs" />
--- 144,147 ----
***************
*** 204,207 ****
--- 203,211 ----
<Compile Include="TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\BiasedPVO\BiasedOTC_PVONoThresholds\RunBiasedOTC_PVONoThresholds.cs" />
<Compile Include="WalkForwardTesting\LinearCombination\FixedLevelOscBiasedOTC_PVONoThresholdsStrategy.cs" />
+ <Compile Include="WalkForwardTesting\WalkForwardLag\WFLagNewChosenPositionsEventArgs.cs" />
+ <Compile Include="WalkForwardTesting\WalkForwardLag\WeightedPositionsChoosers\IWFLagWeightedPositionsChooser.cs" />
+ <Compile Include="WalkForwardTesting\WalkForwardLag\WeightedPositionsChoosers\WFLagBruteForceFixedPortfolioWeightedPositionsChooser.cs" />
+ <Compile Include="ArbitrageTesting\OverReactionHypothesis\SimpleOHTest\EndOfDayTimerHandlerSimpleOHTest.cs" />
+ <Compile Include="ArbitrageTesting\OverReactionHypothesis\SimpleOHTest\RunSimpleOHTest.cs" />
</ItemGroup>
<ItemGroup>
***************
*** 248,251 ****
--- 252,258 ----
<Folder Include="TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\BiasedPVO\BiasedPVONoThresholds" />
<Folder Include="TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\BiasedPVO\BiasedOTC_PVONoThresholds" />
+ <Folder Include="WalkForwardTesting\WalkForwardLag\WeightedPositionsChoosers" />
+ <Folder Include="ArbitrageTesting\OverReactionHypothesis" />
+ <Folder Include="ArbitrageTesting\OverReactionHypothesis\SimpleOHTest" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
Index: b7_Scripts.csproj
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v
retrieving revision 1.70
retrieving revision 1.71
diff -C2 -d -r1.70 -r1.71
*** b7_Scripts.csproj 27 Feb 2007 23:09:35 -0000 1.70
--- b7_Scripts.csproj 9 Apr 2007 18:19:08 -0000 1.71
***************
*** 123,126 ****
--- 123,136 ----
/>
<File
+ RelPath = "ArbitrageTesting\OverReactionHypothesis\SimpleOHTest\EndOfDayTimerHandlerSimpleOHTest.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ArbitrageTesting\OverReactionHypothesis\SimpleOHTest\RunSimpleOHTest.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "ArbitrageTesting\PairTrading\PairTradingCandidate.cs"
SubType = "Code"
|
|
From: Marco M. <mi...@us...> - 2007-04-09 18:16:30
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT
In directory sc8-pr-cvs16:/tmp/cvs-serv10945/b1_ADT
Modified Files:
ConstantsProvider.cs
Log Message:
Changes to constants for testing purposes
Index: ConstantsProvider.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ConstantsProvider.cs,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** ConstantsProvider.cs 25 Jul 2006 15:22:50 -0000 1.18
--- ConstantsProvider.cs 9 Apr 2007 18:16:26 -0000 1.19
***************
*** 33,37 ****
public static int CachePages = 1000;
public static int PagesToBeRemovedFromCache = 500; // for Garbage Collection
! public static int SeedForRandomGenerator = 333; // for GeneticOptimizer and
// GenomeManagement
public static int NumGenomesForRandomFitnessComputation = 100;
--- 33,37 ----
public static int CachePages = 1000;
public static int PagesToBeRemovedFromCache = 500; // for Garbage Collection
! public static int SeedForRandomGenerator = 33; // for GeneticOptimizer and
// GenomeManagement
public static int NumGenomesForRandomFitnessComputation = 100;
***************
*** 46,51 ****
//separator for tickers in GenomeRepresentation class
public static string SeparatorForWeights = ">";
! //separator for separating ticker by its weight in GenomeRepresentation class
!
}
}
--- 46,50 ----
//separator for tickers in GenomeRepresentation class
public static string SeparatorForWeights = ">";
! //separator for separating ticker by its weight in GenomeRepresentation class
}
}
|
|
From: Marco M. <mi...@us...> - 2007-04-09 18:15:46
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting
In directory sc8-pr-cvs16:/tmp/cvs-serv10226/b7_Scripts/TickerSelectionTesting
Modified Files:
EndOfDayTimerHandler.cs
Log Message:
Added an overloaded version of openPositions method
Index: EndOfDayTimerHandler.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandler.cs,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** EndOfDayTimerHandler.cs 17 Sep 2006 21:44:04 -0000 1.23
--- EndOfDayTimerHandler.cs 9 Apr 2007 18:15:40 -0000 1.24
***************
*** 180,184 ****
this.chosenTickersPortfolioWeights[i]=1.0/this.chosenTickers.Length;
}
!
protected virtual void addOrderForTicker(string[] tickers,
int tickerPosition )
--- 180,184 ----
this.chosenTickersPortfolioWeights[i]=1.0/this.chosenTickers.Length;
}
!
protected virtual void addOrderForTicker(string[] tickers,
int tickerPosition )
***************
*** 227,230 ****
--- 227,231 ----
protected virtual void addChosenTickersToOrderList(string[] tickers)
{
+
for( int i = 0; i<tickers.Length; i++)
{
***************
*** 256,259 ****
--- 257,266 ----
}
+ protected virtual void openPositions(string[] tickers, double[] tickersWeights)
+ {
+ this.chosenTickersPortfolioWeights = tickersWeights;
+ this.openPositions(tickers);
+ }
+
protected virtual void openPositions(string[] tickers)
{
|
|
From: Marco M. <mi...@us...> - 2007-04-09 18:14:15
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/BiasedPVO
In directory sc8-pr-cvs16:/tmp/cvs-serv9486/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/BiasedPVO
Modified Files:
EndOfDayTimerHandlerBiasedPVO.cs
Log Message:
Minor changes
Index: EndOfDayTimerHandlerBiasedPVO.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/BiasedPVO/EndOfDayTimerHandlerBiasedPVO.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** EndOfDayTimerHandlerBiasedPVO.cs 27 Feb 2007 22:52:41 -0000 1.1
--- EndOfDayTimerHandlerBiasedPVO.cs 9 Apr 2007 18:14:09 -0000 1.2
***************
*** 56,62 ****
protected Hashtable genomesCollector;
protected bool takeProfitConditionReached;
- new protected string[,] chosenTickers;
- new protected double[,] chosenTickersPortfolioWeights;
new protected double[] currentOversoldThreshold;
new protected double[] currentOverboughtThreshold;
--- 56,62 ----
protected Hashtable genomesCollector;
protected bool takeProfitConditionReached;
+ protected string[,] bestGenomesChosenTickers;
+ protected double[,] bestGenomesChosenTickersPortfolioWeights;
new protected double[] currentOversoldThreshold;
new protected double[] currentOverboughtThreshold;
***************
*** 101,106 ****
this.numOfDifferentGenomesToEvaluateOutOfSample = numOfDifferentGenomesToEvaluateOutOfSample;
this.minimumAcceptableGain = minimumAcceptableGain;
! this.chosenTickers = new string[numOfDifferentGenomesToEvaluateOutOfSample, numberOfTickersToBeChosen];
! this.chosenTickersPortfolioWeights = new double[numOfDifferentGenomesToEvaluateOutOfSample, numberOfTickersToBeChosen];
this.currentOversoldThreshold = new double[numOfDifferentGenomesToEvaluateOutOfSample];
this.currentOverboughtThreshold = new double[numOfDifferentGenomesToEvaluateOutOfSample];
--- 101,106 ----
this.numOfDifferentGenomesToEvaluateOutOfSample = numOfDifferentGenomesToEvaluateOutOfSample;
this.minimumAcceptableGain = minimumAcceptableGain;
! this.bestGenomesChosenTickers = new string[numOfDifferentGenomesToEvaluateOutOfSample, numberOfTickersToBeChosen];
! this.bestGenomesChosenTickersPortfolioWeights = new double[numOfDifferentGenomesToEvaluateOutOfSample, numberOfTickersToBeChosen];
this.currentOversoldThreshold = new double[numOfDifferentGenomesToEvaluateOutOfSample];
this.currentOverboughtThreshold = new double[numOfDifferentGenomesToEvaluateOutOfSample];
***************
*** 127,132 ****
for(int i = 0; i < this.numberOfTickersToBeChosen; i++)
{
! tickers[i] = this.chosenTickers[indexForChosenTickers,i];
! tickerWeights[i] = this.chosenTickersPortfolioWeights[indexForChosenTickers,i];
}
returnValue =
--- 127,132 ----
for(int i = 0; i < this.numberOfTickersToBeChosen; i++)
{
! tickers[i] = this.bestGenomesChosenTickers[indexForChosenTickers,i];
! tickerWeights[i] = this.bestGenomesChosenTickersPortfolioWeights[indexForChosenTickers,i];
}
returnValue =
***************
*** 190,196 ****
this.takeProfitConditionReached ||
this.numDaysElapsedSinceLastOptimization + 1 == this.numDaysBetweenEachOptimization )
- //reversal conditions have not been reached but
//stop loss or take profit conditions yes
! //or after the close it is necessary to run
//another optimization
{
--- 190,195 ----
this.takeProfitConditionReached ||
this.numDaysElapsedSinceLastOptimization + 1 == this.numDaysBetweenEachOptimization )
//stop loss or take profit conditions yes
! //or after the next close it is necessary to run
//another optimization
{
***************
*** 251,261 ****
{
string[] tickers = new string[this.numberOfTickersToBeChosen];
for(int i = 0; i < this.numberOfTickersToBeChosen; i++)
! tickers[i] = this.chosenTickers[this.currentGenomeIndex,i];
! if(this.currentTickersGainOrLoss >= 1.0 + currentOverboughtThreshold[this.currentGenomeIndex] &&
this.portfolioType == PortfolioType.ShortAndLong)
{
SignedTicker.ChangeSignOfEachTicker(tickers);
! base.openPositions(tickers);
this.portfolioHasBeenOverbought = true;
this.portfolioHasBeenOversold = false;
--- 250,264 ----
{
string[] tickers = new string[this.numberOfTickersToBeChosen];
+ double[] tickersWeights = new double[this.numberOfTickersToBeChosen];
for(int i = 0; i < this.numberOfTickersToBeChosen; i++)
! {
! tickers[i] = this.bestGenomesChosenTickers[this.currentGenomeIndex,i];
! tickersWeights[i] = this.bestGenomesChosenTickersPortfolioWeights[this.currentGenomeIndex,i];
! }
! if(this.currentTickersGainOrLoss >= 1.0 + currentOverboughtThreshold[this.currentGenomeIndex] &&
this.portfolioType == PortfolioType.ShortAndLong)
{
SignedTicker.ChangeSignOfEachTicker(tickers);
! base.openPositions(tickers, tickersWeights);
this.portfolioHasBeenOverbought = true;
this.portfolioHasBeenOversold = false;
***************
*** 263,267 ****
else if (this.currentTickersGainOrLoss <= 1.0 - currentOversoldThreshold[this.currentGenomeIndex])
{
! base.openPositions(tickers);
this.portfolioHasBeenOverbought = false;
this.portfolioHasBeenOversold = true;
--- 266,270 ----
else if (this.currentTickersGainOrLoss <= 1.0 - currentOversoldThreshold[this.currentGenomeIndex])
{
! base.openPositions(tickers, tickersWeights);
this.portfolioHasBeenOverbought = false;
this.portfolioHasBeenOversold = true;
***************
*** 303,307 ****
this.marketCloseEventHandler_closeIfItIsTimeToClose();
else if ( this.account.Portfolio.Count == 0 &&
! this.chosenTickers[0,0] != null )
//portfolio is empty and optimization has been already launched
this.marketCloseEventHandler_openPositions((IndexBasedEndOfDayTimer)sender);
--- 306,310 ----
this.marketCloseEventHandler_closeIfItIsTimeToClose();
else if ( this.account.Portfolio.Count == 0 &&
! this.bestGenomesChosenTickers[0,0] != null )
//portfolio is empty and optimization has been already launched
this.marketCloseEventHandler_openPositions((IndexBasedEndOfDayTimer)sender);
***************
*** 324,337 ****
{
currentGenome = (Genome)GO.CurrentGeneration[GO.PopulationSize - 1 - counter];
! if(counter == 0 ||
! !this.genomesCollector.ContainsKey(currentGenome.Fitness) )
! //it is the first genome to be added or no genome with the current
// fitness has been added to the hashtable yet
{
for(int i = 0; i<this.numberOfTickersToBeChosen; i++)
{
! this.chosenTickers[addedGenomes,i] =
((GenomeMeaningPVO)currentGenome.Meaning).Tickers[i];
! this.chosenTickersPortfolioWeights[addedGenomes,i] =
((GenomeMeaningPVO)currentGenome.Meaning).TickersPortfolioWeights[i];
}
--- 327,342 ----
{
currentGenome = (Genome)GO.CurrentGeneration[GO.PopulationSize - 1 - counter];
! if( counter == 0 ||
! !this.genomesCollector.ContainsKey(
! ( (GenomeMeaning)currentGenome.Meaning ).HashCodeForTickerComposition ) )
! // currentGenome.Fitness) )
! //it is the first genome to be added or no genome with the current
// fitness has been added to the hashtable yet
{
for(int i = 0; i<this.numberOfTickersToBeChosen; i++)
{
! this.bestGenomesChosenTickers[addedGenomes,i] =
((GenomeMeaningPVO)currentGenome.Meaning).Tickers[i];
! this.bestGenomesChosenTickersPortfolioWeights[addedGenomes,i] =
((GenomeMeaningPVO)currentGenome.Meaning).TickersPortfolioWeights[i];
}
***************
*** 341,346 ****
((GenomeMeaningPVO)currentGenome.Meaning).OverboughtThreshold;
! this.genomesCollector.Add(currentGenome.Fitness, null);
!
this.addPVOGenomeToBestGenomes(currentGenome,((GenomeManagerForEfficientPortfolio)this.iGenomeManager).FirstQuoteDate,
((GenomeManagerForEfficientPortfolio)this.iGenomeManager).LastQuoteDate, eligibleTickersForGO,
--- 346,352 ----
((GenomeMeaningPVO)currentGenome.Meaning).OverboughtThreshold;
! this.genomesCollector.Add(
! ( (GenomeMeaning)currentGenome.Meaning ).HashCodeForTickerComposition, null);
! // currentGenome.Fitness,null);
this.addPVOGenomeToBestGenomes(currentGenome,((GenomeManagerForEfficientPortfolio)this.iGenomeManager).FirstQuoteDate,
((GenomeManagerForEfficientPortfolio)this.iGenomeManager).LastQuoteDate, eligibleTickersForGO,
***************
*** 358,362 ****
DataTable setOfTickersToBeOptimized = this.getSetOfTickersToBeOptimized(currentDate);
this.iGenomeManager =
! new GenomeManagerPVO(setOfTickersToBeOptimized,
currentDate.AddDays(-this.numDaysForOptimizationPeriod),
currentDate, this.numberOfTickersToBeChosen,
--- 364,368 ----
DataTable setOfTickersToBeOptimized = this.getSetOfTickersToBeOptimized(currentDate);
this.iGenomeManager =
! new GenomeManagerWeightedBalancedPVO(setOfTickersToBeOptimized,
currentDate.AddDays(-this.numDaysForOptimizationPeriod),
currentDate, this.numberOfTickersToBeChosen,
***************
*** 376,380 ****
if(setGenomeCounter)
this.genomeCounter = new GenomeCounter(GO);
! GO.MutationRate = 0.4;
GO.Run(false);
--- 382,388 ----
if(setGenomeCounter)
this.genomeCounter = new GenomeCounter(GO);
!
! GO.MutationRate = 0.1;
! GO.CrossoverRate = 0.85;
GO.Run(false);
|