[Quantproject-developers] QuantProject/b7_Scripts/TickerSelectionTesting/OTC/InSampleChoosers/Genet
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2009-10-30 23:13:32
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/OTC/InSampleChoosers/Genetic In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11047/TickerSelectionTesting/OTC/InSampleChoosers/Genetic Added Files: GenomeManagerForWeightedOTC_EndOfDay.cs OTCEndOfDayGeneticChooserWithWeights.cs Log Message: Added files for the OTC strategy (for managing weights, mainly) --- NEW FILE: OTCEndOfDayGeneticChooserWithWeights.cs --- /* QuantProject - Quantitative Finance Library OTCEndOfDayGeneticChooserWithWeights.cs Copyright (C) 2009 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 QuantProject.ADT.Optimizing.Genetic; using QuantProject.Business.Strategies; using QuantProject.Business.DataProviders; using QuantProject.Business.Strategies.Optimizing.FitnessEvaluation; using QuantProject.Business.Strategies.Optimizing.Decoding; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.InSample; using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Strategies.OutOfSample; using QuantProject.Business.Strategies.Optimizing.GenomeManagers; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; namespace QuantProject.Scripts.TickerSelectionTesting.OTC.InSampleChoosers.Genetic { /// <summary> /// In sample genetic analyzer for the Open to Close strategy /// using EOD data and optimizing weights /// </summary> [Serializable] public class OTCEndOfDayGeneticChooserWithWeights : OTCEndOfDayGeneticChooser { public OTCEndOfDayGeneticChooserWithWeights( int numberOfPortfolioPositions , int numberOfBestTestingPositionsToBeReturned , Benchmark benchmark , GenomeManagerType genomeManagerType , IFitnessEvaluator fitnessEvaluator , HistoricalMarketValueProvider historicalMarketValueProvider , double crossoverRate , double mutationRate , double elitismRate , int populationSizeForGeneticOptimizer , int generationNumberForGeneticOptimizer , int seedForRandomGenerator) : base(numberOfPortfolioPositions, numberOfBestTestingPositionsToBeReturned, benchmark , new DecoderForOTCPositionsWithWeights(), genomeManagerType, fitnessEvaluator , historicalMarketValueProvider , crossoverRate , mutationRate , elitismRate , populationSizeForGeneticOptimizer , generationNumberForGeneticOptimizer , seedForRandomGenerator ) { } public override IGenomeManager GetGenomeManager(EligibleTickers eligibleTickers , ReturnsManager returnsManager) { return new GenomeManagerForWeightedOTC_EndOfDay(eligibleTickers, this.numberOfPortfolioPositions, this.decoderForTestingPositions, this.fitnessEvaluator, this.genomeManagerType , returnsManager, this.seedForRandomGenerator); } } } --- NEW FILE: GenomeManagerForWeightedOTC_EndOfDay.cs --- /* QuantProject - Quantitative Finance Library GenomeManagerForWeightedOTC_EndOfDay.cs Copyright (C) 2009 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.ADT.Statistics; using QuantProject.ADT.Optimizing.Genetic; using QuantProject.Data; using QuantProject.Data.DataTables; using QuantProject.Business.DataProviders; using QuantProject.Business.Timing; using QuantProject.Business.Strategies; using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Strategies.ReturnsManagement.Time; using QuantProject.Business.Strategies.TickersRelationships; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.Optimizing.FitnessEvaluation; using QuantProject.Business.Strategies.Optimizing.Decoding; using QuantProject.Business.Strategies.Optimizing.GenomeManagers; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; namespace QuantProject.Scripts.TickerSelectionTesting.OTC.InSampleChoosers.Genetic { /// <summary> /// Implements what needed to use the Genetic Optimizer /// for finding the portfolio with weights that best suites /// the Open To Close strategy using EOD data /// </summary> [Serializable] public class GenomeManagerForWeightedOTC_EndOfDay : GenomeManagerForOTC_EndOfDay { public GenomeManagerForWeightedOTC_EndOfDay(EligibleTickers eligibleTickers, int numberOfTickersInPortfolio, IDecoderForTestingPositions decoderForTestingPositions, IFitnessEvaluator fitnessEvaluator, GenomeManagerType genomeManagerType, ReturnsManager returnsManager, int seedForRandomGenerator) : base(eligibleTickers, numberOfTickersInPortfolio, decoderForTestingPositions, fitnessEvaluator, genomeManagerType, returnsManager, seedForRandomGenerator) { this.genomeSize = 2* numberOfTickersInPortfolio; } } } |