quantproject-developers Mailing List for QuantProject (Page 125)
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
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19295/b1_ADT/Optimizing/Genetic Added Files: GeneticOptimizer.cs Genome.cs GenomeComparer.cs GenomeManagement.cs GenomeManagerTest.cs IGenomeManager.cs Log Message: Added GeneticOptimizer to the project --- NEW FILE: Genome.cs --- /* QuantProject - Quantitative Finance Library Genome.cs Copyright (C) 2003 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.Collections; namespace QuantProject.ADT.Optimizing.Genetic { /// <summary> /// Representation of an individual through features /// provided by biology /// </summary> public class Genome { private int[] genes; private int minValueForGenes; private int maxValueForGenes; private int size; private double fitness; private object meaning; IGenomeManager genomeManager; public double Fitness { get{return this.fitness;} set{this.fitness = value;} } public object Meaning { get{return this.meaning;} set{this.meaning = value;} } public int Size { get{return this.size;} } public int MinValueForGenes { get{return this.minValueForGenes;} } public int MaxValueForGenes { get{return this.maxValueForGenes;} } /// <summary> /// It creates a new genome object initialized by a IGenomeManager /// </summary> public Genome(IGenomeManager genomeManager) { this.genomeManager = genomeManager; this.size = this.genomeManager.GenomeSize; this.minValueForGenes = this.genomeManager.MinValueForGenes; this.maxValueForGenes = this.genomeManager.MaxValueForGenes; this.genes = new int[ this.size ]; } public void AssignMeaning() { this.meaning = this.genomeManager.Decode(this); } public void CreateGenes() { for (int i = 0 ; i < this.size ; i++) this.genes[i] = this.genomeManager.GetNewGeneValue(this); } public void CalculateFitness() { this.fitness = this.genomeManager.GetFitnessValue(this); } public Genome Clone() { Genome returnValue = new Genome(this.genomeManager); returnValue.Fitness = this.Fitness; returnValue.Meaning = this.Meaning; returnValue.CopyValuesInGenes(this.genes); return returnValue; } public int[] Genes() { return this.genes; } public void CopyValuesInGenes(int[] valuesToBeCopied) { for (int i = 0 ; i < this.size ; i++) this.genes[i] = valuesToBeCopied[i]; } public void SetGeneValue(int geneValue, int genePosition) { if(genePosition >= this.size || genePosition<0) throw new IndexOutOfRangeException("Gene position not valid for the genome! "); this.genes[genePosition] = geneValue; } public int GetGeneValue(int genePosition) { if(genePosition >= this.size || genePosition<0) throw new IndexOutOfRangeException("Gene position not valid for the genome! "); return this.genes[genePosition]; } /// <summary> /// It returns true if the given gene is already stored in the current genome /// </summary> public bool HasGene(int geneValue) { bool returnValue = false; foreach(int gene in this.Genes()) { if( geneValue == gene ) returnValue = true; } return returnValue; } /// <summary> /// It returns true if the current instance of genome has some duplicate /// values in genes /// </summary> public bool HasSomeDuplicateGenes() { bool returnValue = false; for(int i = 0; i < this.size ; i++) { for(int j = i + 1; j < this.size ; j++) { if(this.genes[i] == this.genes[j]) returnValue = true; } } return returnValue; } } } --- NEW FILE: GeneticOptimizer.cs --- /* QuantProject - Quantitative Finance Library GeneticOptimizer.cs Copyright (C) 2003 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.Collections; using QuantProject.ADT.Optimizing.Genetic; namespace QuantProject.ADT.Optimizing.Genetic { /// <summary> /// The class needs to be initialized by an object implementing /// IGenomeManager interface /// Default GO parameters: crossoverRate = 0.85, mutationRate = 0.02, elitismRate = 0.01, /// populationSize = 1000, generationNumber = 100 /// keepOnRunningUntilConvergenceIsReached = false, minConvergenceRate = 0.80 /// </summary> public class GeneticOptimizer { #region fields private double mutationRate = 0.02; private double crossoverRate = 0.85; private double elitismRate = 0.01; private double minConvergenceRate = 0.80; private bool keepOnRunningUntilConvergenceIsReached = false; private int populationSize = 1000; private int generationNumber = 100; private int genomeSize; private int minValueForGenes; private int maxValueForGenes; private double totalFitness; private Genome bestGenome; private Genome worstGenome; private IGenomeManager genomeManager; private GenomeComparer genomeComparer; private ArrayList currentGeneration; private ArrayList currentEliteToTransmitToNextGeneration; private ArrayList nextGeneration; private ArrayList cumulativeFitnessList; private static Random random = new Random((int)DateTime.Now.Ticks); private int generationCounter; #endregion #region properties public double MutationRate { get{return mutationRate;} set{mutationRate = value;} } public double CrossoverRate { get{return crossoverRate;} set{crossoverRate = value;} } public double ElitismRate { get{return this.elitismRate;} set{this.elitismRate = value;} } public double MinConvergenceRate { get{return this.minConvergenceRate;} set{this.minConvergenceRate = value;} } public bool KeepOnRunningUntilConvergenceIsReached { get{return this.keepOnRunningUntilConvergenceIsReached ;} set{this.keepOnRunningUntilConvergenceIsReached = value;} } public int PopulationSize { get{return populationSize;} set{populationSize = value;} } public int GenerationNumber { get{return generationNumber;} set{generationNumber = value;} } public int GenerationCounter { get{return this.generationCounter;} } public int GenomeSize { get{return genomeSize;} } public Genome BestGenome { get{return this.bestGenome;} } public Genome WorstGenome { get{return this.worstGenome;} } #endregion /// <summary> /// The class needs to be initialized by an object implementing /// IGenomeManager interface /// Default GO parameters: crossoverRate = 0.85, mutationRate = 0.02, elitismRate = 0.01, /// populationSize = 1000, generationNumber = 100 /// keepOnRunningUntilConvergenceIsReached = false, minConvergenceRate = 0.80 /// </summary> public GeneticOptimizer(IGenomeManager genomeManager) { this.genomeManager = genomeManager; this.commonInitialization(); } public GeneticOptimizer(double crossoverRate, double mutationRate, double elitismRate, int populationSize, int generationNumber, IGenomeManager genomeManager) { this.crossoverRate = crossoverRate; this.mutationRate = mutationRate; this.elitismRate = elitismRate; this.populationSize = populationSize; this.generationNumber = generationNumber; this.genomeManager = genomeManager; this.commonInitialization(); } private void commonInitialization() { this.genomeSize = this.genomeManager.GenomeSize; this.minValueForGenes = this.genomeManager.MinValueForGenes; this.maxValueForGenes = this.genomeManager.MaxValueForGenes; this.genomeComparer = new GenomeComparer(); this.cumulativeFitnessList = new ArrayList(this.PopulationSize); this.currentGeneration = new ArrayList(this.PopulationSize); this.nextGeneration = new ArrayList(); this.currentEliteToTransmitToNextGeneration = new ArrayList((int)(this.ElitismRate*(double)this.PopulationSize)); this.generationCounter = 1; } /// <summary> /// Method which starts the GeneticOptmizer /// </summary> public void Run(bool showOutputToConsole) { this.createFirstGeneration(showOutputToConsole); if(this.keepOnRunningUntilConvergenceIsReached) //The GO keeps on generating new population until convergence is reached { for (int i = 0; !this.IsConvergenceReached(); i++) { this.generateNewPopulation(true); } } else // the GO simply generates the given number of populations and then stops { for (int i = 0; i < this.generationNumber; i++) { this.generateNewPopulation(true); } } } private void generateNewPopulation(bool showOutputToConsole) { this.createNextGeneration(); this.updateBestGenomeFoundInRunning((Genome)this.currentGeneration[populationSize-1]); this.updateWorstGenomeFoundInRunning((Genome)this.currentGeneration[0]); if (showOutputToConsole) this.showOutputToConsole(); } private bool IsConvergenceReached() { bool returnValue = false; double averageFitnessOfCurrentGeneration = this.totalFitness / this.populationSize; double bestFitnessReachedUntilNow = this.BestGenome.Fitness; if (averageFitnessOfCurrentGeneration >= this.minConvergenceRate * bestFitnessReachedUntilNow ) returnValue = true; return returnValue; } private void createFirstGeneration(bool showOutputToConsole) { if (this.genomeSize == 0 || this.genomeSize < 0) throw new IndexOutOfRangeException("Genome size not set"); this.createGenomes(); this.currentGeneration.Sort(this.genomeComparer); this.calculateTotalFitness(); this.updateCumulativeFitnessList(); this.setInitialBestAndWorstGenomes(); if (showOutputToConsole) this.showOutputToConsole(); } private void showOutputToConsole() { System.Console.WriteLine("\n\n\n\n*_*_*_*_*_*_*_*_*_*_*\n\nGeneration " + this.generationCounter +"\n"); for(int i = 0; i < this.populationSize; i++) { System.Console.WriteLine((string)((Genome)this.currentGeneration[i]).Meaning + "--> " + ((Genome)this.currentGeneration[i]).Fitness); } //Console.WriteLine("Press enter key to continue ..."); //Console.ReadLine(); } /// <summary> /// It returns an int corresponding to a certain genome. /// The probability for a genome to be selected depends /// proportionally on the level of fitness. /// </summary> private int rouletteSelection() { double randomFitness = this.totalFitness *(double)GeneticOptimizer.random.Next(1,1001)/1000; int idx = -1; int mid; int first = 0; int last = this.populationSize -1; mid = (last - first)/2; // Need to implement a specific search, because the // ArrayList's BinarySearch is for exact values only while (idx == -1 && first <= last) { if (randomFitness < (double)this.cumulativeFitnessList[mid]) { last = mid; } else if (randomFitness >= (double)this.cumulativeFitnessList[mid]) { first = mid; } mid = (first + last)/2; if ((last - first) == 1) idx = last; } return idx; } /// <summary> /// Calculate total fitness for current generation /// </summary> private void calculateTotalFitness() { this.totalFitness = 0; for (int i = 0; i < this.populationSize; i++) { Genome g = ((Genome) this.currentGeneration[i]); this.totalFitness += g.Fitness; } } /// <summary> /// Rank current generation and sort in order of fitness. /// </summary> private void updateCumulativeFitnessList() { double cumulativeFitness = 0.0; this.cumulativeFitnessList.Clear(); for (int i = 0; i < this.populationSize; i++) { cumulativeFitness += ((Genome)this.currentGeneration[i]).Fitness; this.cumulativeFitnessList.Add(cumulativeFitness); } } private void createGenomes() { for (int i = 0; i < this.populationSize; i++) { Genome g = new Genome(this.genomeManager); g.CreateGenes(); g.AssignMeaning(); g.CalculateFitness(); this.currentGeneration.Add(g); } } private void setCurrentEliteToTransmitToNextGeneration() { this.currentEliteToTransmitToNextGeneration.Clear(); for(int i = populationSize - 1; i >=(populationSize - this.elitismRate*this.populationSize); i--) { this.currentEliteToTransmitToNextGeneration.Add((Genome)this.currentGeneration[i]); } } private void transmitEliteToNextGeneration() { for(int i = 0; i < this.currentEliteToTransmitToNextGeneration.Count-1; i++) { this.nextGeneration.Add(this.currentEliteToTransmitToNextGeneration[i]); } } private void createNextGeneration() { this.nextGeneration.Clear(); for (int i = 0 ; i < this.populationSize ; i+=2) { int indexForParent1 = this.rouletteSelection(); int indexForParent2 = this.rouletteSelection(); Genome parent1, parent2; Genome[] childs; parent1 = ((Genome) this.currentGeneration[indexForParent1]); parent2 = ((Genome) this.currentGeneration[indexForParent2]); if ((double)GeneticOptimizer.random.Next(1,1001)/1000 < this.crossoverRate) { childs = this.genomeManager.GetChilds(parent1, parent2); } else {//if the crossover doesn't take place there are only //two childs, identical to parents childs = new Genome[2]; childs[0] = parent1.Clone(); childs[1] = parent2.Clone(); } foreach(Genome g in childs){ this.nextGeneration.Add(g); } } this.setCurrentEliteToTransmitToNextGeneration(); this.transmitEliteToNextGeneration(); this.mutateGenomes(this.nextGeneration); this.calculateFitnessAndMeaningForAllGenomes(this.nextGeneration); this.nextGeneration.Sort(this.genomeComparer); this.updateCurrentGeneration(); this.currentGeneration.Sort(this.genomeComparer); this.calculateTotalFitness(); this.updateCumulativeFitnessList(); this.generationCounter++; } //mutate all genomes of the given population, according to the mutation rate private void mutateGenomes(ArrayList populationOfGenomes) { foreach(Genome g in populationOfGenomes) { if(g != null) this.genomeManager.Mutate(g, this.MutationRate); } } //calculate Fitness and Meaning for each genome in populationOfGenomes private void calculateFitnessAndMeaningForAllGenomes(ArrayList populationOfGenomes) { foreach(Genome g in populationOfGenomes) { if(g != null) { g.CalculateFitness(); g.AssignMeaning(); } } } private void updateCurrentGeneration() { this.currentGeneration.Clear(); // Note that next generation is greater than current: // due to the population size, genomes with lowest fitness are abandoned for (int i = 1 ; i <= this.populationSize; i++) this.currentGeneration.Add(this.nextGeneration[this.nextGeneration.Count - i]); } private void updateBestGenomeFoundInRunning(Genome genomeValue) { if(genomeValue.Fitness > this.bestGenome.Fitness) this.bestGenome = genomeValue.Clone(); } private void updateWorstGenomeFoundInRunning(Genome genomeValue) { if(genomeValue.Fitness < this.worstGenome.Fitness) this.worstGenome = genomeValue.Clone(); } private void setInitialBestAndWorstGenomes() { this.bestGenome = (Genome)this.currentGeneration[this.populationSize-1]; this.worstGenome = (Genome)this.currentGeneration[0]; } } } --- NEW FILE: GenomeManagerTest.cs --- /* QuantProject - Quantitative Finance Library GenomeManagerTest.cs Copyright (C) 2003 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.Collections; namespace QuantProject.ADT.Optimizing.Genetic { /// <summary> /// Create a simple class implementing IGenomeManager, in order to test the /// behaviour of the genetic optimizer /// </summary> public class GenomeManagerTest : IGenomeManager { private int genomeSize; private int minValueForGenes; private int maxValueForGenes; public int GenomeSize { get{return this.genomeSize;} } public int MinValueForGenes { get{return this.minValueForGenes;} } public int MaxValueForGenes { get{return this.maxValueForGenes;} } public GenomeManagerTest(int genomeSize, int minValueForGenes, int maxValueForGenes) { this.genomeSize = genomeSize; this.minValueForGenes = minValueForGenes; this.maxValueForGenes = maxValueForGenes; } public int GetNewGeneValue(Genome genome) { return GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, genome.MaxValueForGenes + 1); } public Genome[] GetChilds(Genome parent1, Genome parent2) { //return GenomeManagement.UniformCrossover(parent1, parent2); //return GenomeManagement.AlternateFixedCrossover(parent1, parent2); return GenomeManagement.OnePointCrossover(parent1, parent2); } public void Mutate(Genome genome, double mutationRate) { GenomeManagement.MutateAllGenes(genome, mutationRate); } public double GetFitnessValue(Genome genome) { int[] intArray = genome.Genes(); double returnValue; //function to be maximized double sum = 0; double product = 1; for (int i = 0; i < genome.Size; i++) { sum += (int)intArray[i]; product *= (int)intArray[i]; } returnValue = (double)(1/product);// fitness = 1 iff product is minimized //returnValue = (double)(product/sum); return returnValue; } public object Decode(Genome genome) { string sequenceOfGenes = ""; foreach(int index in genome.Genes()) { sequenceOfGenes += index + ";" ; } return (object)sequenceOfGenes; } } } --- NEW FILE: GenomeComparer.cs --- /* QuantProject - Quantitative Finance Library GenomeComparer.cs Copyright (C) 2003 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.Collections; namespace QuantProject.ADT.Optimizing.Genetic { /// <summary> /// Compares genomes by fitness /// </summary> public sealed class GenomeComparer : IComparer { public GenomeComparer() { } public int Compare( object x, object y) { if ( !(x is Genome) || !(y is Genome)) throw new ArgumentException("Not of type Genome"); if (((Genome) x).Fitness > ((Genome) y).Fitness) return 1; else if (((Genome) x).Fitness == ((Genome) y).Fitness) return 0; else return -1; } } } --- NEW FILE: IGenomeManager.cs --- /* QuantProject - Quantitative Finance Library IGenomeManager.cs Copyright (C) 2004 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; namespace QuantProject.ADT.Optimizing.Genetic { /// <summary> /// Interface to be implemented by any object used to run /// an instance of the GeneticOptimizer class. /// /// The interface determines the genome format and provides: /// - an objective function used to calculate genome's fitness; /// - a decode function used to calculate genome's meaning as an object; /// - a GetChilds method used by the genetic optimizer to generate new /// population; /// - a Mutate method used by the genetic optimizer to mutate a /// given genome /// </summary> public interface IGenomeManager { int GenomeSize{get;} int MinValueForGenes{get;} int MaxValueForGenes{get;} int GetNewGeneValue(Genome genome); // Used in generation of genes // by the Genome parameter double GetFitnessValue(Genome genome); object Decode(Genome genome); Genome[] GetChilds(Genome parent1, Genome parent2); void Mutate(Genome genome, double mutationRate); } } --- NEW FILE: GenomeManagement.cs --- /* QuantProject - Quantitative Finance Library GenomeManagement.cs Copyright (C) 2003 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.Collections; using QuantProject.ADT.Optimizing.Genetic; namespace QuantProject.ADT.Optimizing.Genetic { /// <summary> /// Class providing static methods to manage Genomes /// (crossovering, mutating, etc.) /// </summary> public sealed class GenomeManagement { public static Random RandomGenerator = new Random((int)DateTime.Now.Ticks); private static int genomeSize; private static Genome[] childs; private static int[,] maskForChilds; /* public GenomeManagement() { } */ /// <summary> /// Returns an array of genome (childs) based /// on classical one point crossover genes recombination /// </summary> public static Genome[] OnePointCrossover(Genome parent1, Genome parent2) { if(parent1.Size != parent2.Size) throw new Exception("Genomes must have the same size!"); GenomeManagement.genomeSize = parent1.Size; GenomeManagement.childs = new Genome[2]{parent1.Clone(),parent1.Clone()}; int pos = GenomeManagement.RandomGenerator.Next(0, parent1.Size); for(int i = 0 ; i < parent1.Size ; i++) { if (i < pos) { childs[0].SetGeneValue(parent1.GetGeneValue(i), i); childs[1].SetGeneValue(parent2.GetGeneValue(i), i); } else { childs[0].SetGeneValue(parent2.GetGeneValue(i), i); childs[1].SetGeneValue(parent1.GetGeneValue(i), i); } } return GenomeManagement.childs; } private static void setMaskForChildsForUniformCrossover() { for(int childIndex = 0 ; childIndex < GenomeManagement.childs.Length; childIndex++) { for(int i = 0 ; i < GenomeManagement.genomeSize ; i++) { maskForChilds[childIndex,i] = GenomeManagement.RandomGenerator.Next(1,3); } } } private static void setMaskForChildsForAlternateFixedCrossover() { for(int childIndex = 0 ; childIndex < GenomeManagement.childs.Length; childIndex++) { for(int i = 0 ; i < GenomeManagement.genomeSize ; i++) { if(i%2 == 0) //index is even maskForChilds[childIndex, i] = 1; else // index is odd maskForChilds[childIndex, i] = 2; } } } private static void setMaskForChildsForMixingWithoutDuplicates(Genome parent1, Genome parent2) { for(int childIndex = 0 ; childIndex < GenomeManagement.childs.Length; childIndex++) { for(int i = 0 ; i < GenomeManagement.genomeSize ; i++) { if(parent2.HasGene(parent1.GetGeneValue(i)) || parent1.HasGene(parent2.GetGeneValue(i)))//index contains a common gene { maskForChilds[childIndex, i] = childIndex + 1; } else// index doesn't contain a common gene { if(i%2 == 0)//index is even maskForChilds[childIndex, i] = childIndex%2 + 1; else// index is odd maskForChilds[childIndex, i] = childIndex%2 + 2; } } } } //it assumes just two parents only private static void setChildsUsingMaskForChilds(Genome parent1, Genome parent2) { for(int childIndex = 0 ; childIndex < GenomeManagement.childs.Length; childIndex++) { for(int i = 0 ; i < GenomeManagement.genomeSize ; i++) { if(maskForChilds[childIndex,i]==1) childs[childIndex].SetGeneValue(parent1.GetGeneValue(i), i); else//maskForChilds[childIndex,i]==2 childs[childIndex].SetGeneValue(parent2.GetGeneValue(i), i); } } } /// <summary> /// This method returns an array of genomes based on /// a random recombination of the genes of parents /// </summary> public static Genome[] UniformCrossover(Genome parent1, Genome parent2) { if(parent1.Size != parent2.Size) throw new Exception("Genomes must have the same size!"); GenomeManagement.genomeSize = parent1.Size; GenomeManagement.childs = new Genome[2]{parent1.Clone(),parent1.Clone()}; GenomeManagement.maskForChilds = new int[childs.Length, GenomeManagement.genomeSize]; GenomeManagement.setMaskForChildsForUniformCrossover(); GenomeManagement.setChildsUsingMaskForChilds(parent1, parent2); return GenomeManagement.childs; } /// <summary> /// This method returns an array of genomes based on /// an alternate fixed recombination of the genes of parents /// </summary> public static Genome[] AlternateFixedCrossover(Genome parent1, Genome parent2) { if(parent1.Size != parent2.Size) throw new Exception("Genomes must have the same size!"); GenomeManagement.genomeSize = parent1.Size; GenomeManagement.childs = new Genome[2]{parent1.Clone(),parent1.Clone()}; GenomeManagement.maskForChilds = new int[childs.Length, GenomeManagement.genomeSize]; GenomeManagement.setMaskForChildsForAlternateFixedCrossover(); GenomeManagement.setChildsUsingMaskForChilds(parent1, parent2); return GenomeManagement.childs; } /// <summary> /// This method returns an array of genomes based on /// a mix of the genes of parents, such that childs, /// if possible, are different from parents and, at /// the same time, childs' genes are not duplicated /// </summary> public static Genome[] MixGenesWithoutDuplicates(Genome parent1, Genome parent2) { if(parent1.Size > (parent1.MaxValueForGenes - parent1.MinValueForGenes + 1)) //it is impossible not to duplicate genes if size is too // large for the range of variation of each gene throw new Exception("Impossible to avoid duplicates with the given size!"); if(parent1.Size != parent2.Size) throw new Exception("Genomes must have the same size!"); GenomeManagement.genomeSize = parent1.Size; GenomeManagement.childs = new Genome[2]{parent1.Clone(),parent1.Clone()}; GenomeManagement.maskForChilds = new int[childs.Length, GenomeManagement.genomeSize]; GenomeManagement.setMaskForChildsForMixingWithoutDuplicates(parent1, parent2); GenomeManagement.setChildsUsingMaskForChilds(parent1, parent2); return GenomeManagement.childs; } static public void MutateAllGenes(Genome genome, double mutationRate) { for (int pos = 0 ; pos < genome.Size; pos++) { if (GenomeManagement.RandomGenerator.Next(0,101) < (int)(mutationRate*100)) genome.SetGeneValue(GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, genome.MaxValueForGenes + 1), pos); } } static public void MutateOneGene(Genome genome, double mutationRate, int genePosition) { if (GenomeManagement.RandomGenerator.Next(0,101) < (int)(mutationRate*100)) genome.SetGeneValue(GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, genome.MaxValueForGenes + 1), genePosition); } static public void MutateOneGene(Genome genome, double mutationRate, int genePosition, int newValueOfGene) { if (GenomeManagement.RandomGenerator.Next(0,101) < (int)(mutationRate*100)) genome.SetGeneValue(newValueOfGene, genePosition); } } } |
|
From: Marco M. <mi...@us...> - 2004-12-01 22:36:21
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19295/b1_ADT Modified Files: b1_ADT.csproj Log Message: Added GeneticOptimizer to the project Index: b1_ADT.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/b1_ADT.csproj,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** b1_ADT.csproj 1 Dec 2004 15:26:34 -0000 1.9 --- b1_ADT.csproj 1 Dec 2004 22:36:10 -0000 1.10 *************** *** 163,166 **** --- 163,196 ---- /> <File + RelPath = "Optimizing\Genetic\GeneticOptimizer.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Optimizing\Genetic\Genome.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Optimizing\Genetic\GenomeComparer.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Optimizing\Genetic\GenomeManagement.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Optimizing\Genetic\GenomeManagerTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Optimizing\Genetic\IGenomeManager.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Statistics\BasicFunctions.cs" SubType = "Code" |
|
From: Marco M. <mi...@us...> - 2004-12-01 22:33:38
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18580/b7_Scripts/TickerSelectionTesting Removed Files: DataStreamerHandler.cs RunBestTwoIndipendent.cs Log Message: Removed RunBestTwoIndipendent script --- DataStreamerHandler.cs DELETED --- --- RunBestTwoIndipendent.cs DELETED --- |
|
From: Marco M. <mi...@us...> - 2004-12-01 22:24:20
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16453/Genetic Log Message: Directory /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic added to the repository |
|
From: Glauco S. <gla...@us...> - 2004-12-01 15:50:07
|
Update of /cvsroot/quantproject/QuantDownloader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17306 Modified Files: QuantDownloader.suo Log Message: Index: QuantDownloader.suo =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/QuantDownloader.suo,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 Binary files /tmp/cvsBgma8p and /tmp/cvsCz8A0F differ |
|
From: Glauco S. <gla...@us...> - 2004-12-01 15:48:51
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17043/Downloader Modified Files: Downloader.csproj Log Message: .resx files have been removed Index: Downloader.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/Downloader.csproj,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Downloader.csproj 7 Jul 2004 20:10:29 -0000 1.24 --- Downloader.csproj 1 Dec 2004 15:48:38 -0000 1.25 *************** *** 165,173 **** /> <File - RelPath = "DataSet1.xsx" - DependentUpon = "DataSet1.xsd" - BuildAction = "None" - /> - <File RelPath = "Main.cs" SubType = "Form" --- 165,168 ---- *************** *** 175,183 **** /> <File - RelPath = "Main.resx" - DependentUpon = "Main.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "QuotesDataGrid.cs" SubType = "Component" --- 170,173 ---- *************** *** 185,193 **** /> <File - RelPath = "QuotesDataGrid.resx" - DependentUpon = "QuotesDataGrid.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "TestDownloadedData.cs" SubType = "Form" --- 175,178 ---- *************** *** 205,223 **** /> <File - RelPath = "WebDownloader.resx" - DependentUpon = "WebDownloader.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "QuotesEditor\QuotesChart.cs" ! SubType = "UserControl" BuildAction = "Compile" /> <File - RelPath = "QuotesEditor\QuotesChart.resx" - DependentUpon = "QuotesChart.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "QuotesEditor\QuotesEditor.cs" SubType = "Form" --- 190,198 ---- /> <File RelPath = "QuotesEditor\QuotesChart.cs" ! SubType = "Code" BuildAction = "Compile" /> <File RelPath = "QuotesEditor\QuotesEditor.cs" SubType = "Form" *************** *** 225,233 **** /> <File - RelPath = "QuotesEditor\QuotesEditor.resx" - DependentUpon = "QuotesEditor.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "QuotesEditor\ValidationDataGrid.cs" SubType = "Component" --- 200,203 ---- *************** *** 251,255 **** <File RelPath = "QuotesEditor\VisualValidationChart.cs" ! SubType = "UserControl" BuildAction = "Compile" /> --- 221,225 ---- <File RelPath = "QuotesEditor\VisualValidationChart.cs" ! SubType = "Code" BuildAction = "Compile" /> *************** *** 266,270 **** <File RelPath = "QuotesEditor\CloseToClose\CloseToCloseChart.cs" ! SubType = "UserControl" BuildAction = "Compile" /> --- 236,240 ---- <File RelPath = "QuotesEditor\CloseToClose\CloseToCloseChart.cs" ! SubType = "Code" BuildAction = "Compile" /> *************** *** 295,305 **** /> <File - RelPath = "QuotesEditor\OHLC\OHLCuserControl.resx" - DependentUpon = "OHLCuserControl.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "QuotesEditor\RangeToRange\RangeToRangeChart.cs" ! SubType = "UserControl" BuildAction = "Compile" /> --- 265,270 ---- /> <File RelPath = "QuotesEditor\RangeToRange\RangeToRangeChart.cs" ! SubType = "Code" BuildAction = "Compile" /> *************** *** 325,333 **** /> <File - RelPath = "TickerSelectors\TickerGroupsListViewMenu.resx" - DependentUpon = "TickerGroupsListViewMenu.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "TickerSelectors\TickerGroupsViewer.cs" SubType = "Form" --- 290,293 ---- *************** *** 335,343 **** /> <File - RelPath = "TickerSelectors\TickerGroupsViewer.resx" - DependentUpon = "TickerGroupsViewer.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "TickerSelectors\TickerSelectorForm.cs" SubType = "Form" --- 295,298 ---- *************** *** 355,363 **** /> <File - RelPath = "TickerSelectors\TickerViewerMenu.resx" - DependentUpon = "TickerViewerMenu.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "Validate\ValidateDataGrid.cs" SubType = "Component" --- 310,313 ---- *************** *** 369,377 **** BuildAction = "Compile" /> - <File - RelPath = "Validate\ValidateForm.resx" - DependentUpon = "ValidateForm.cs" - BuildAction = "EmbeddedResource" - /> </Include> </Files> --- 319,322 ---- |
|
From: Glauco S. <gla...@us...> - 2004-12-01 15:43:33
|
Update of /cvsroot/quantproject/QuantProject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15943 Modified Files: QuantProject.suo Log Message: no message Index: QuantProject.suo =================================================================== RCS file: /cvsroot/quantproject/QuantProject/QuantProject.suo,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 Binary files /tmp/cvsW9QolS and /tmp/cvs157xqi differ |
|
From: Glauco S. <gla...@us...> - 2004-12-01 15:43:04
|
Update of /cvsroot/quantproject/QuantProject/b91_QuantProject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15843/b91_QuantProject Modified Files: b91_QuantProject.csproj Log Message: Automatic changes Index: b91_QuantProject.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b91_QuantProject/b91_QuantProject.csproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** b91_QuantProject.csproj 1 Aug 2004 00:45:00 -0000 1.4 --- b91_QuantProject.csproj 1 Dec 2004 15:42:54 -0000 1.5 *************** *** 84,92 **** /> <Reference - Name = "Scripts" - Project = "{451DB77D-D4C7-44D1-8047-2920D864A4CD}" - Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" - /> - <Reference Name = "b1_ADT" Project = "{B8A01161-3698-4591-B1EF-90F5FC7D8DBA}" --- 84,87 ---- *************** *** 98,101 **** --- 93,101 ---- Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> + <Reference + Name = "b7_Scripts" + Project = "{451DB77D-D4C7-44D1-8047-2920D864A4CD}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> </References> </Build> |
|
From: Glauco S. <gla...@us...> - 2004-12-01 15:41:12
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15120/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: - .resx files have been removed - SimpleTesting\OneRank\ script has been added - TickerSelectionTesting\ script has been removed - WalkForwardTesting\MSFTwalkForward\ script has been removed - WalkForwardTesting\WalkForwardOneRank\ script has been added Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** b7_Scripts.csproj 5 Sep 2004 13:51:38 -0000 1.12 --- b7_Scripts.csproj 1 Dec 2004 15:41:03 -0000 1.13 *************** *** 98,101 **** --- 98,106 ---- Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> + <Reference + Name = "System.Drawing" + AssemblyName = "System.Drawing" + HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll" + /> </References> </Build> *************** *** 148,151 **** --- 153,166 ---- /> <File + RelPath = "SimpleTesting\OneRank\EndOfDayOneRank.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "SimpleTesting\OneRank\OneRank.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "SimpleTesting\OneRank\RunOneRank.cs" SubType = "Code" *************** *** 168,196 **** /> <File ! RelPath = "TickerSelectionTesting\DataStreamerHandler.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "TickerSelectionTesting\RunBestTwoIndipendent.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "WalkForwardTesting\MSFTwalkForward\RunMSFTwalkForward.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "WalkForwardTesting\MSFTwalkForward\TsMSFTwalkForward.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "WalkForwardTesting\WalkForwardOneRank\DataStreamerHandler.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "WalkForwardTesting\WalkForwardOneRank\RunWalkForwardOneRank.cs" SubType = "Code" --- 183,231 ---- /> <File ! RelPath = "WalkForwardTesting\MSFTwalkForward\RunMSFTwalkForward.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "WalkForwardTesting\MSFTwalkForward\TsMSFTwalkForward.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "WalkForwardTesting\WalkForwardOneRank\BestPerformingTickers.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "WalkForwardTesting\WalkForwardOneRank\ChosenTickers.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "WalkForwardTesting\WalkForwardOneRank\ComparableAccount.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "WalkForwardTesting\WalkForwardOneRank\EligibleTickers.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "WalkForwardTesting\WalkForwardOneRank\EndOfDayTimerHandler.cs" SubType = "Code" BuildAction = "Compile" /> <File + RelPath = "WalkForwardTesting\WalkForwardOneRank\ProgressBarForm.cs" + SubType = "Form" + BuildAction = "Compile" + /> + <File + RelPath = "WalkForwardTesting\WalkForwardOneRank\ProgressBarForm.resx" + DependentUpon = "ProgressBarForm.cs" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "WalkForwardTesting\WalkForwardOneRank\RunWalkForwardOneRank.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2004-12-01 15:33:48
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13548/b5_Presentation Modified Files: b5_Presentation.csproj Log Message: .resx files have been removed Index: b5_Presentation.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/b5_Presentation.csproj,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** b5_Presentation.csproj 23 Aug 2004 22:36:47 -0000 1.10 --- b5_Presentation.csproj 1 Dec 2004 15:33:39 -0000 1.11 *************** *** 98,111 **** /> <Reference - Name = "b4_Business" - Project = "{6EE31501-376E-491B-869E-F06D5B7C9C30}" - Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" - /> - <Reference - Name = "b1_ADT" - Project = "{B8A01161-3698-4591-B1EF-90F5FC7D8DBA}" - Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" - /> - <Reference Name = "System.Drawing" AssemblyName = "System.Drawing" --- 98,101 ---- *************** *** 138,141 **** --- 128,141 ---- HintPath = "..\b91_QuantProject\bin\Debug\scpl.dll" /> + <Reference + Name = "b4_Business" + Project = "{6EE31501-376E-491B-869E-F06D5B7C9C30}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> + <Reference + Name = "b1_ADT" + Project = "{B8A01161-3698-4591-B1EF-90F5FC7D8DBA}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> </References> </Build> *************** *** 153,156 **** --- 153,160 ---- /> <File + RelPath = "scpl.dll" + BuildAction = "Content" + /> + <File RelPath = "Charting\CharPlot.cs" SubType = "Code" *************** *** 178,186 **** /> <File - RelPath = "Reporting\WindowsForm\EquityChartTabPage.resx" - DependentUpon = "EquityChartTabPage.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "Reporting\WindowsForm\Report.cs" SubType = "Form" --- 182,185 ---- *************** *** 188,196 **** /> <File - RelPath = "Reporting\WindowsForm\Report.resx" - DependentUpon = "Report.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "Reporting\WindowsForm\ReportGrid.cs" SubType = "Component" --- 187,190 ---- *************** *** 208,225 **** /> <File - RelPath = "Reporting\WindowsForm\ReportTabControl.resx" - DependentUpon = "ReportTabControl.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "Reporting\WindowsForm\SummaryTabPage.cs" SubType = "Component" BuildAction = "Compile" /> - <File - RelPath = "Reporting\WindowsForm\SummaryTabPage.resx" - DependentUpon = "SummaryTabPage.cs" - BuildAction = "EmbeddedResource" - /> </Include> </Files> --- 202,209 ---- |
|
From: Glauco S. <gla...@us...> - 2004-12-01 15:32:36
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13262/b4_Business Modified Files: b4_Business.csproj Log Message: - .resx files have been removed - a05_Timing\EndOfDayDateTime.cs has been added - a05_Timing\EndOfDaySpecificTime.cs has been added - a05_Timing\EndOfDayTimingEventArgs.cs has been added - a05_Timing\HistoricalEndOfDayTimer.cs has been added - a05_Timing\IEndOfDayTimer.cs has been added - a07_DataProviders\HistoricalEndOfDayDataStreamer.cs has been added Index: b4_Business.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** b4_Business.csproj 1 Aug 2004 00:39:48 -0000 1.10 --- b4_Business.csproj 1 Dec 2004 15:32:24 -0000 1.11 *************** *** 163,171 **** /> <File - RelPath = "a0_Validation\ValidateDataTable.resx" - DependentUpon = "ValidateDataTable.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "a0_Validation\ValidationWarnings.cs" SubType = "Code" --- 163,166 ---- *************** *** 198,201 **** --- 193,226 ---- /> <File + RelPath = "a05_Timing\EndOfDayDateTime.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a05_Timing\EndOfDaySpecificTime.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a05_Timing\EndOfDayTimingEventArgs.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a05_Timing\HistoricalEndOfDayTimer.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a05_Timing\IEndOfDayTimer.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a07_DataProviders\HistoricalEndOfDayDataStreamer.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a1_Financial\a1_Instruments\Instrument.cs" SubType = "Code" *************** *** 248,256 **** /> <File - RelPath = "a1_Financial\a2_Accounting\Transactions.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "a1_Financial\a2_Accounting\TransactionType.cs" SubType = "Code" --- 273,276 ---- *************** *** 373,376 **** --- 393,416 ---- /> <File + RelPath = "a1_Financial\a2_Accounting\Transactions\EndOfDayTransaction.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a1_Financial\a2_Accounting\Transactions\TransactionHistory.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a1_Financial\a3_Ordering\HistoricalEndOfDayOrderExecutor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a1_Financial\a3_Ordering\IOrderExecutor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a1_Financial\a3_Ordering\Order.cs" SubType = "Code" *************** *** 378,381 **** --- 418,426 ---- /> <File + RelPath = "a1_Financial\a3_Ordering\OrderFilledEventArgs.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a1_Financial\a3_Ordering\OrderManager.cs" SubType = "Code" *************** *** 388,391 **** --- 433,441 ---- /> <File + RelPath = "a1_Financial\a3_Ordering\OrderStatus.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a1_Financial\a3_Ordering\OrderType.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2004-12-01 15:28:06
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12132/b3_Data Modified Files: b3_Data.csproj Log Message: .resx files have been removed Index: b3_Data.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/b3_Data.csproj,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** b3_Data.csproj 5 Sep 2004 13:49:32 -0000 1.13 --- b3_Data.csproj 1 Dec 2004 15:27:51 -0000 1.14 *************** *** 125,128 **** --- 125,136 ---- WrapperTool = "primary" /> + <Reference + Name = "Microsoft.Office.Core" + Guid = "{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}" + VersionMajor = "2" + VersionMinor = "3" + Lcid = "0" + WrapperTool = "primary" + /> </References> </Build> *************** *** 185,193 **** /> <File - RelPath = "DataTables\GroupQuotes.resx" - DependentUpon = "GroupQuotes.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "DataTables\Quotes.cs" SubType = "Component" --- 193,196 ---- *************** *** 195,203 **** /> <File - RelPath = "DataTables\Quotes.resx" - DependentUpon = "Quotes.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "DataTables\TickerDataTable.cs" SubType = "Component" --- 198,201 ---- *************** *** 210,218 **** /> <File - RelPath = "DataTables\Tickers_tickerGroups.resx" - DependentUpon = "Tickers_tickerGroups.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "DataTables\ValidatedTickers.cs" SubType = "Component" --- 208,211 ---- *************** *** 220,237 **** /> <File - RelPath = "DataTables\ValidatedTickers.resx" - DependentUpon = "ValidatedTickers.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "DataTables\VisuallyValidatedQuotes.cs" SubType = "Component" BuildAction = "Compile" /> ! <File ! RelPath = "DataTables\VisuallyValidatedQuotes.resx" ! DependentUpon = "VisuallyValidatedQuotes.cs" ! BuildAction = "EmbeddedResource" ! /> <File RelPath = "Selectors\ITickerReceiver.cs" --- 213,221 ---- /> <File RelPath = "DataTables\VisuallyValidatedQuotes.cs" SubType = "Component" BuildAction = "Compile" /> ! <Folder RelPath = "NewFolder1\" /> <File RelPath = "Selectors\ITickerReceiver.cs" *************** *** 259,262 **** --- 243,247 ---- BuildAction = "Compile" /> + <Folder RelPath = "Timing\" /> </Include> </Files> |
|
From: Glauco S. <gla...@us...> - 2004-12-01 15:26:48
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11804/b1_ADT Modified Files: b1_ADT.csproj Log Message: - added IProgressNotifier.cs - added ITickerReceiver.cs - added NewProgressEventArgs.cs Index: b1_ADT.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/b1_ADT.csproj,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** b1_ADT.csproj 4 Aug 2004 22:49:27 -0000 1.8 --- b1_ADT.csproj 1 Dec 2004 15:26:34 -0000 1.9 *************** *** 118,121 **** --- 118,131 ---- /> <File + RelPath = "IProgressNotifier.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ITickerReceiver.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Keyed.cs" SubType = "Code" *************** *** 123,126 **** --- 133,141 ---- /> <File + RelPath = "NewProgressEventArgs.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "RecursiveHashtable.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2004-11-29 17:36:45
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9981/b7_Scripts/SimpleTesting/OneRank Modified Files: TsOneRank.cs Log Message: ExtededDateTime has been replaced by EndOfDayDateTime Index: TsOneRank.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank/TsOneRank.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TsOneRank.cs 24 Nov 2003 19:36:24 -0000 1.1 --- TsOneRank.cs 29 Nov 2004 17:36:32 -0000 1.2 *************** *** 29,32 **** --- 29,33 ---- using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Strategies; + using QuantProject.Business.Timing; namespace QuantProject.Scripts *************** *** 65,69 **** { signal.Add( new Order( OrderType.MarketBuy , new Instrument( this.ticker ) , 1 , ! new ExtendedDateTime( nextMarketDay , BarComponent.Open ) ) ); signals.Add( signal ); } --- 66,70 ---- { signal.Add( new Order( OrderType.MarketBuy , new Instrument( this.ticker ) , 1 , ! new EndOfDayDateTime( nextMarketDay , EndOfDaySpecificTime.MarketOpen ) ) ); signals.Add( signal ); } *************** *** 71,75 **** { signal.Add( new Order( OrderType.MarketSell , new Instrument( this.ticker ) , 1 , ! new ExtendedDateTime( nextMarketDay , BarComponent.Open ) ) ); signals.Add( signal ); } --- 72,76 ---- { signal.Add( new Order( OrderType.MarketSell , new Instrument( this.ticker ) , 1 , ! new EndOfDayDateTime( nextMarketDay , EndOfDaySpecificTime.MarketOpen ) ) ); signals.Add( signal ); } |
|
From: Glauco S. <gla...@us...> - 2004-11-29 17:36:44
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/MSFTsimpleTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9981/b7_Scripts/SimpleTesting/MSFTsimpleTest Modified Files: TsMSFTsimpleTest.cs Log Message: ExtededDateTime has been replaced by EndOfDayDateTime Index: TsMSFTsimpleTest.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/MSFTsimpleTest/TsMSFTsimpleTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TsMSFTsimpleTest.cs 24 Nov 2003 19:35:30 -0000 1.1 --- TsMSFTsimpleTest.cs 29 Nov 2004 17:36:31 -0000 1.2 *************** *** 29,32 **** --- 29,33 ---- using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Strategies; + using QuantProject.Business.Timing; namespace QuantProject.Scripts *************** *** 64,69 **** { signal.Add( new Order( OrderType.MarketBuy , new Instrument( "MSFT" ) , 1 , ! new ExtendedDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! BarComponent.Open ) ) ); signals.Add( signal ); } --- 65,70 ---- { signal.Add( new Order( OrderType.MarketBuy , new Instrument( "MSFT" ) , 1 , ! new EndOfDayDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! EndOfDaySpecificTime.MarketOpen ) ) ); signals.Add( signal ); } *************** *** 74,80 **** { signal.Add( new Order( OrderType.MarketSell , new Instrument( "MSFT" ) , 1 , ! new ExtendedDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! BarComponent.Open ) ) ); signals.Add( signal ); } --- 75,81 ---- { signal.Add( new Order( OrderType.MarketSell , new Instrument( "MSFT" ) , 1 , ! new EndOfDayDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! EndOfDaySpecificTime.MarketOpen ) ) ); signals.Add( signal ); } |
|
From: Glauco S. <gla...@us...> - 2004-11-29 17:36:41
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/MSFTwalkForward In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9981/b7_Scripts/WalkForwardTesting/MSFTwalkForward Modified Files: TsMSFTwalkForward.cs Log Message: ExtededDateTime has been replaced by EndOfDayDateTime Index: TsMSFTwalkForward.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/MSFTwalkForward/TsMSFTwalkForward.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TsMSFTwalkForward.cs 24 Nov 2003 19:38:10 -0000 1.1 --- TsMSFTwalkForward.cs 29 Nov 2004 17:36:31 -0000 1.2 *************** *** 29,32 **** --- 29,33 ---- using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Strategies; + using QuantProject.Business.Timing; namespace QuantProject.Scripts *************** *** 64,69 **** { signal.Add( new Order( OrderType.MarketBuy , new Instrument( "MSFT" ) , 1 , ! new ExtendedDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! BarComponent.Open ) ) ); signals.Add( signal ); } --- 65,70 ---- { signal.Add( new Order( OrderType.MarketBuy , new Instrument( "MSFT" ) , 1 , ! new EndOfDayDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! EndOfDaySpecificTime.MarketOpen ) ) ); signals.Add( signal ); } *************** *** 74,80 **** { signal.Add( new Order( OrderType.MarketSell , new Instrument( "MSFT" ) , 1 , ! new ExtendedDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! BarComponent.Open ) ) ); signals.Add( signal ); } --- 75,81 ---- { signal.Add( new Order( OrderType.MarketSell , new Instrument( "MSFT" ) , 1 , ! new EndOfDayDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! EndOfDaySpecificTime.MarketOpen ) ) ); signals.Add( signal ); } |
|
From: Glauco S. <gla...@us...> - 2004-11-29 17:36:40
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/MSFTSimpleTest_2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9981/b7_Scripts/SimpleTesting/MSFTSimpleTest_2 Modified Files: TsMSFTsimpleTest_2.cs Log Message: ExtededDateTime has been replaced by EndOfDayDateTime Index: TsMSFTsimpleTest_2.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/MSFTSimpleTest_2/TsMSFTsimpleTest_2.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TsMSFTsimpleTest_2.cs 11 Jan 2004 19:15:21 -0000 1.3 --- TsMSFTsimpleTest_2.cs 29 Nov 2004 17:36:31 -0000 1.4 *************** *** 30,33 **** --- 30,34 ---- using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Strategies; + using QuantProject.Business.Timing; namespace QuantProject.Scripts *************** *** 75,81 **** signal.Add( new Order( OrderType.MarketSell , new Instrument( "MSFT" ) , 1 , ! new ExtendedDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! BarComponent.Open ) ) ); signals.Add( signal ); --- 76,82 ---- signal.Add( new Order( OrderType.MarketSell , new Instrument( "MSFT" ) , 1 , ! new EndOfDayDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! EndOfDaySpecificTime.MarketOpen ) ) ); signals.Add( signal ); *************** *** 84,89 **** { signal.Add( new Order( OrderType.MarketBuy , new Instrument( "MSFT" ) , 1 , ! new ExtendedDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! BarComponent.Open ) ) ); signals.Add( signal ); } --- 85,90 ---- { signal.Add( new Order( OrderType.MarketBuy , new Instrument( "MSFT" ) , 1 , ! new EndOfDayDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! EndOfDaySpecificTime.MarketOpen ) ) ); signals.Add( signal ); } *************** *** 94,99 **** { signal.Add( new Order( OrderType.MarketBuy , new Instrument( "MSFT" ) , 0 , ! new ExtendedDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! BarComponent.Open ) ) ); signals.Add( signal ); } --- 95,100 ---- { signal.Add( new Order( OrderType.MarketBuy , new Instrument( "MSFT" ) , 0 , ! new EndOfDayDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! EndOfDaySpecificTime.MarketOpen ) ) ); signals.Add( signal ); } |
|
From: Glauco S. <gla...@us...> - 2004-11-29 17:35:08
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataProviders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9521/b3_Data/DataProviders Modified Files: Timer.cs Log Message: Added CurrentDateTime method Index: Timer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Timer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Timer.cs 28 Aug 2004 16:59:26 -0000 1.1 --- Timer.cs 29 Nov 2004 17:34:57 -0000 1.2 *************** *** 38,41 **** --- 38,46 ---- private ExtendedDateTime currentDateTime; + public ExtendedDateTime CurrentDateTime + { + get { return this.currentDateTime; } + } + public Timer( ExtendedDateTime startDateTime , ExtendedDateTime endDateTime ) |
|
From: Glauco S. <gla...@us...> - 2004-11-29 17:34:00
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9240/b4_Business/a1_Financial/a2_Accounting Modified Files: TimedTransaction.cs Log Message: Added GetTransactionType Index: TimedTransaction.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/TimedTransaction.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** TimedTransaction.cs 13 Oct 2003 21:58:40 -0000 1.1.1.1 --- TimedTransaction.cs 29 Nov 2004 17:33:50 -0000 1.2 *************** *** 24,27 **** --- 24,28 ---- using QuantProject.ADT; using QuantProject.Business.Financial.Instruments; + using QuantProject.Business.Financial.Ordering; namespace QuantProject.Business.Financial.Accounting *************** *** 60,63 **** --- 61,100 ---- } + static public TransactionType GetTransactionType( OrderType orderType ) + { + TransactionType returnValue; + switch ( orderType ) + { + case OrderType.LimitBuy: + returnValue = TransactionType.BuyLong; + break; + case OrderType.MarketBuy: + returnValue = TransactionType.BuyLong; + break; + case OrderType.LimitCover: + returnValue = TransactionType.Cover; + break; + case OrderType.MarketCover: + returnValue = TransactionType.Cover; + break; + case OrderType.LimitSell: + returnValue = TransactionType.Sell; + break; + case OrderType.MarketSell: + returnValue = TransactionType.Sell; + break; + case OrderType.LimitSellShort: + returnValue = TransactionType.SellShort; + break; + case OrderType.MarketSellShort: + returnValue = TransactionType.SellShort; + break; + //this line should never be reached! + default: + returnValue = TransactionType.AddCash; + break; + } + return returnValue; + } public override string ToString() { |
|
From: Glauco S. <gla...@us...> - 2004-11-29 16:37:56
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a3_Testing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26384/b4_Business/a3_Testing Modified Files: Tester.cs Log Message: ExtededDateTime has been replaced by EndOfDayDateTime Index: Tester.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a3_Testing/Tester.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Tester.cs 15 Aug 2004 00:07:49 -0000 1.4 --- Tester.cs 29 Nov 2004 16:37:46 -0000 1.5 *************** *** 25,32 **** using QuantProject.Business.Strategies; using QuantProject.ADT; using QuantProject.ADT.Optimizing; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Ordering; ! using QuantProject.ADT.Histories; --- 25,33 ---- using QuantProject.Business.Strategies; using QuantProject.ADT; + using QuantProject.ADT.Histories; using QuantProject.ADT.Optimizing; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Ordering; ! using QuantProject.Business.Timing; *************** *** 66,70 **** this.Test(); return - this.Account.GetProfitNetLoss( ! new ExtendedDateTime( testWindow.EndDateTime , BarComponent.Close ) ); } --- 67,71 ---- this.Test(); return - this.Account.GetProfitNetLoss( ! new EndOfDayDateTime( testWindow.EndDateTime , EndOfDaySpecificTime.MarketClose ) ); } |
|
From: Glauco S. <gla...@us...> - 2004-11-29 16:37:03
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26215/b7_Scripts/WalkForwardTesting/WalkForwardOneRank Modified Files: RunWalkForwardOneRank.cs Log Message: - ExtededDateTime has been replaced by EndOfDayDateTime - added the ProgressBarForm - an EndOfDayTimerHandler replaces the DataStreamerHandler - now an IEndOfDayTimer is used - now an Account is used with its IEndOfDayTimer and its IEndOfDayOrderExecutor - the oneHourAfterMarketCloseEventHandler has been introduced Index: RunWalkForwardOneRank.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank/RunWalkForwardOneRank.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RunWalkForwardOneRank.cs 28 Aug 2004 17:05:03 -0000 1.1 --- RunWalkForwardOneRank.cs 29 Nov 2004 16:36:50 -0000 1.2 *************** *** 25,33 **** --- 25,36 ---- using System.Data; using QuantProject.ADT; + using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Accounting.Reporting; using QuantProject.Business.Financial.Instruments; + using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Scripting; using QuantProject.Business.Strategies; using QuantProject.Business.Testing; + using QuantProject.Business.Timing; using QuantProject.Data.DataProviders; using QuantProject.Presentation.Reporting.WindowsForm; *************** *** 41,79 **** public class RunWalkForwardOneRank : Script { - private string startTicker; private ReportTable reportTable; ! private ExtendedDateTime startDateTime; ! private ExtendedDateTime endDateTime; private int numIntervalDays; ! private HistoricalDataStreamer historicalDataStreamer; ! private DataStreamerHandler dataStreamerHandler = ! new DataStreamerHandler(); public RunWalkForwardOneRank() { this.reportTable = new ReportTable( "Summary_Reports" ); ! this.startDateTime = new ExtendedDateTime( ! new DateTime( 2002 , 1 , 1 ) , BarComponent.Open ); ! this.endDateTime = new ExtendedDateTime( ! new DateTime( 2002 , 12 , 31 ) , BarComponent.Open ); this.numIntervalDays = 7; - this.startTicker = "MSFT"; } #region Run ! private void run_initializeHistoricalDataStreamer() { ! this.historicalDataStreamer = new HistoricalDataStreamer(); ! this.historicalDataStreamer.StartDateTime = this.startDateTime; ! this.historicalDataStreamer.EndDateTime = this.endDateTime; ! this.historicalDataStreamer.Add( this.startTicker ); } ! public override void Run() ! { Report report; ! run_initializeHistoricalDataStreamer(); ! this.historicalDataStreamer.NewQuote += ! new NewQuoteEventHandler( this.dataStreamerHandler.NewQuoteEventHandler ); ! this.historicalDataStreamer.GoSimulate(); ! report = new Report( this.dataStreamerHandler.Account ); report.Show( "WFT One Rank" , this.numIntervalDays , this.startDateTime , "MSFT" ); } --- 44,144 ---- public class RunWalkForwardOneRank : Script { private ReportTable reportTable; ! private EndOfDayDateTime startDateTime; ! private EndOfDayDateTime endDateTime; private int numIntervalDays; ! ! private ProgressBarForm progressBarForm; ! ! private EndOfDayTimerHandler endOfDayTimerHandler; ! ! private Account account; ! ! private IEndOfDayTimer endOfDayTimer; public RunWalkForwardOneRank() { + this.progressBarForm = new ProgressBarForm(); this.reportTable = new ReportTable( "Summary_Reports" ); ! this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2002 , 1 , 1 ) , EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); ! this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2002 , 12 , 31 ) , EndOfDaySpecificTime.OneHourAfterMarketClose ); this.numIntervalDays = 7; } #region Run ! private void run_initializeEndOfDayTimer() { ! this.endOfDayTimer = ! new HistoricalEndOfDayTimer( this.startDateTime ); } ! private void run_initializeAccount() ! { ! this.account = new Account( "WalkForwardOneRank" , this.endOfDayTimer , ! new HistoricalEndOfDayDataStreamer( this.endOfDayTimer ) , ! new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer ) ); ! } ! private void run_initializeEndOfDayTimerHandler() ! { ! this.endOfDayTimerHandler = new EndOfDayTimerHandler( 50 , 20 , 5 , 360 , 30 , ! this.account ); ! } ! private void inSampleNewProgressEventHandler( ! Object sender , NewProgressEventArgs eventArgs ) ! { ! this.progressBarForm.ProgressBarInSample.Value = eventArgs.CurrentProgress; ! } ! private void run_initializeProgressHandlers() ! { ! this.endOfDayTimerHandler.InSampleNewProgress += ! new InSampleNewProgressEventHandler( this.inSampleNewProgressEventHandler ); ! } ! #region oneHourAfterMarketCloseEventHandler ! private void oneHourAfterMarketCloseEventHandler_handleProgessBarForm( ! IEndOfDayTimer endOfDayTimer ) ! { ! long elapsedDays = Convert.ToInt64( ((TimeSpan)( endOfDayTimer.GetCurrentTime().DateTime - ! this.startDateTime.DateTime )).TotalDays ); ! long totalDays = Convert.ToInt64( ((TimeSpan)( this.endDateTime.DateTime - ! this.startDateTime.DateTime )).TotalDays ); ! if ( Math.Floor( elapsedDays / totalDays * 100 ) > ! Math.Floor( ( elapsedDays - 1 ) / totalDays * 100 ) ) ! // a new out of sample time percentage point has been elapsed ! this.progressBarForm.ProgressBarOutOfSample.Value = ! Convert.ToInt16( Math.Floor( elapsedDays / totalDays * 100 ) ); ! } ! public void oneHourAfterMarketCloseEventHandler( ! Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) ! { ! this.oneHourAfterMarketCloseEventHandler_handleProgessBarForm( ! ( IEndOfDayTimer )sender ); ! if ( ( ( IEndOfDayTimer )sender ).GetCurrentTime().DateTime > ! this.endDateTime.DateTime ) ! { ! // the simulation has reached the ending date ! this.account.EndOfDayTimer.Stop(); ! this.progressBarForm.Close(); ! } ! } ! #endregion ! public override void Run() ! { Report report; ! run_initializeEndOfDayTimer(); ! run_initializeAccount(); ! run_initializeEndOfDayTimerHandler(); ! run_initializeProgressHandlers(); ! this.endOfDayTimer.OneHourAfterMarketClose += ! new OneHourAfterMarketCloseEventHandler( ! this.endOfDayTimerHandler.OneHourAfterMarketCloseEventHandler ); ! this.endOfDayTimer.OneHourAfterMarketClose += ! new OneHourAfterMarketCloseEventHandler( ! this.oneHourAfterMarketCloseEventHandler ); ! this.endOfDayTimer.FiveMinutesBeforeMarketClose += ! new FiveMinutesBeforeMarketCloseEventHandler( ! this.endOfDayTimerHandler.FiveMinutesBeforeMarketCloseEventHandler ); ! this.progressBarForm.Show(); ! this.endOfDayTimer.Start(); ! report = new Report( this.account ); report.Show( "WFT One Rank" , this.numIntervalDays , this.startDateTime , "MSFT" ); } |
|
From: Glauco S. <gla...@us...> - 2004-11-29 16:25:28
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23419/b7_Scripts/SimpleTesting/OneRank Modified Files: RunOneRankWithExcelReport.cs RunOneRankWithWindowsReport.cs Log Message: ExtededDateTime has been replaced by EndOfDayDateTime Index: RunOneRankWithWindowsReport.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank/RunOneRankWithWindowsReport.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RunOneRankWithWindowsReport.cs 15 Aug 2004 00:07:49 -0000 1.2 --- RunOneRankWithWindowsReport.cs 29 Nov 2004 16:25:17 -0000 1.3 *************** *** 29,32 **** --- 29,33 ---- using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Testing; + using QuantProject.Business.Timing; using QuantProject.Business.Strategies; using QuantProject.Business.Scripting; *************** *** 48,52 **** Report report = new Report( this.account ); report.Show( this.ticker , 7 , ! new ExtendedDateTime( this.endDateTime , BarComponent.Close ) , this.ticker ); } } --- 49,54 ---- Report report = new Report( this.account ); report.Show( this.ticker , 7 , ! new EndOfDayDateTime( this.endDateTime , ! EndOfDaySpecificTime.OneHourAfterMarketClose ) , this.ticker ); } } Index: RunOneRankWithExcelReport.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank/RunOneRankWithExcelReport.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RunOneRankWithExcelReport.cs 15 Aug 2004 00:07:49 -0000 1.2 --- RunOneRankWithExcelReport.cs 29 Nov 2004 16:25:17 -0000 1.3 *************** *** 29,32 **** --- 29,33 ---- using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Testing; + using QuantProject.Business.Timing; using QuantProject.Business.Strategies; using QuantProject.Business.Scripting; *************** *** 47,51 **** base.Run(); AccountReport accountReport = this.account.CreateReport( this.ticker , 7 , ! new ExtendedDateTime( endDateTime , BarComponent.Close ) , ticker ); ExcelManager.Add( accountReport ); ExcelManager.ShowReport(); --- 48,53 ---- base.Run(); AccountReport accountReport = this.account.CreateReport( this.ticker , 7 , ! new EndOfDayDateTime( endDateTime , EndOfDaySpecificTime.OneHourAfterMarketClose ) , ! ticker ); ExcelManager.Add( accountReport ); ExcelManager.ShowReport(); |
|
From: Glauco S. <gla...@us...> - 2004-11-29 16:23:46
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/MultiTesting/MultiTestOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22791/b7_Scripts/MultiTesting/MultiTestOneRank Modified Files: RunMultiTestOneRank.cs Log Message: ExtededDateTime has been replaced by EndOfDayDateTime Index: RunMultiTestOneRank.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/MultiTesting/MultiTestOneRank/RunMultiTestOneRank.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RunMultiTestOneRank.cs 15 Aug 2004 00:07:48 -0000 1.2 --- RunMultiTestOneRank.cs 29 Nov 2004 16:23:21 -0000 1.3 *************** *** 30,33 **** --- 30,34 ---- using QuantProject.Business.Strategies; using QuantProject.Business.Testing; + using QuantProject.Business.Timing; using QuantProject.Presentation.Reporting.MicrosoftExcel; *************** *** 105,109 **** { AccountReport accountReport = backTester.Account.CreateReport( "" , this.numIntervalDays , ! new ExtendedDateTime( this.endDateTime , BarComponent.Close ) , backTester.Name ); DataRow newRow = this.reportTable.DataTable.NewRow(); newRow[ "Ticker" ] = backTester.Name; --- 106,110 ---- { AccountReport accountReport = backTester.Account.CreateReport( "" , this.numIntervalDays , ! new EndOfDayDateTime( this.endDateTime , EndOfDaySpecificTime.OneHourAfterMarketClose ) , backTester.Name ); DataRow newRow = this.reportTable.DataTable.NewRow(); newRow[ "Ticker" ] = backTester.Name; |
|
From: Glauco S. <gla...@us...> - 2004-11-29 16:23:46
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/MSFTwalkForward In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22791/b7_Scripts/WalkForwardTesting/MSFTwalkForward Modified Files: RunMSFTwalkForward.cs Log Message: ExtededDateTime has been replaced by EndOfDayDateTime Index: RunMSFTwalkForward.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/MSFTwalkForward/RunMSFTwalkForward.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RunMSFTwalkForward.cs 15 Aug 2004 00:07:48 -0000 1.2 --- RunMSFTwalkForward.cs 29 Nov 2004 16:23:20 -0000 1.3 *************** *** 31,34 **** --- 31,35 ---- using QuantProject.Business.Strategies; using QuantProject.Business.Testing; + using QuantProject.Business.Timing; using QuantProject.Presentation.Reporting.MicrosoftExcel; *************** *** 68,72 **** AccountReport accountReport = walkForwardTester.Account.CreateReport( "MSFT" , 7 , ! new ExtendedDateTime( endDateTime , BarComponent.Close ) , "MSFT" ); ExcelManager.Add( accountReport ); ExcelManager.ShowReport(); --- 69,74 ---- AccountReport accountReport = walkForwardTester.Account.CreateReport( "MSFT" , 7 , ! new EndOfDayDateTime( endDateTime , ! EndOfDaySpecificTime.OneHourAfterMarketClose ) , "MSFT" ); ExcelManager.Add( accountReport ); ExcelManager.ShowReport(); |
|
From: Glauco S. <gla...@us...> - 2004-11-29 16:23:36
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22791/b7_Scripts/SimpleTesting/OneRank Modified Files: RunOneRank.cs Log Message: ExtededDateTime has been replaced by EndOfDayDateTime Index: RunOneRank.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank/RunOneRank.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RunOneRank.cs 15 Aug 2004 00:07:48 -0000 1.3 --- RunOneRank.cs 29 Nov 2004 16:23:22 -0000 1.4 *************** *** 31,34 **** --- 31,35 ---- using QuantProject.Business.Strategies; using QuantProject.Business.Scripting; + using QuantProject.Business.Timing; using QuantProject.Presentation.Reporting.MicrosoftExcel; using QuantProject.Presentation.Reporting.WindowsForm; *************** *** 84,88 **** ((History)tester.Account.GetProfitNetLossHistory( ! new ExtendedDateTime( endDateTime , BarComponent.Close ) ) ).ReportToConsole(); // uncomment the four lines below to use the Excel reporting feature --- 85,89 ---- ((History)tester.Account.GetProfitNetLossHistory( ! new EndOfDayDateTime( endDateTime , EndOfDaySpecificTime.MarketClose ) ) ).ReportToConsole(); // uncomment the four lines below to use the Excel reporting feature |