quantproject-developers Mailing List for QuantProject (Page 54)
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: Marco M. <mi...@us...> - 2008-03-05 17:13:49
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/OutOfSample In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17025 Modified Files: TestingPositions.cs Log Message: Added FitnessInSample property Index: TestingPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/OutOfSample/TestingPositions.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestingPositions.cs 22 Feb 2008 20:55:37 -0000 1.2 --- TestingPositions.cs 5 Mar 2008 17:13:41 -0000 1.3 *************** *** 39,42 **** --- 39,43 ---- private WeightedPositions weightedPositions; private string hashCodeForTickerComposition; + private double fitnessInSample; public WeightedPositions WeightedPositions *************** *** 45,48 **** --- 46,56 ---- } + public double FitnessInSample + { + get{return this.fitnessInSample;} + set{this.fitnessInSample = value;} + } + + public string HashCodeForTickerComposition { *************** *** 67,70 **** --- 75,86 ---- { this.weightedPositions = weightedPositions; + this.fitnessInSample = double.MinValue; + } + + public TestingPositions(WeightedPositions weightedPositions, + double fitnessInSample) + { + this.weightedPositions = weightedPositions; + this.fitnessInSample = fitnessInSample; } *************** *** 73,76 **** --- 89,93 ---- { this.weightedPositions = null; + this.fitnessInSample = double.MinValue; } } |
|
From: Marco M. <mi...@us...> - 2008-03-05 17:13:01
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/OutOfSample In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16567 Added Files: IGeneticOptimized.cs Log Message: Added IGeneticOptimized interface, to be implemented by TestingPositions objects --- NEW FILE: IGeneticOptimized.cs --- /* QuantProject - Quantitative Finance Library IGeneticOptimized.cs Copyright (C) 2008 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.Business.Strategies.OutOfSample { /// <summary> /// Interface to be implemented by TestingPositions objects /// </summary> public interface IGeneticOptimized { int Generation{get;set;} } } |
|
From: Glauco S. <gla...@us...> - 2008-03-02 14:52:32
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12666/b4_Business/a2_Strategies/returnsManagement/time Modified Files: ReturnIntervals.cs Log Message: Bug fixed Index: ReturnIntervals.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/ReturnIntervals.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ReturnIntervals.cs 6 Feb 2008 23:03:15 -0000 1.6 --- ReturnIntervals.cs 2 Mar 2008 14:52:26 -0000 1.7 *************** *** 263,266 **** --- 263,279 ---- } } + private ReturnInterval getFirstIntervalToBeAdded( EndOfDayDateTime firstDate ) + { + ReturnInterval firstIntervalToBeAdded; + if ( this.Count == 0 ) + // this object is still empty: no interval has been added yet + firstIntervalToBeAdded = + this.intervalsSelector.GetFirstInterval( firstDate ); + else + // this object already contains at least a ReturnInterval + firstIntervalToBeAdded = + this.intervalsSelector.GetNextInterval( this ); + return firstIntervalToBeAdded; + } /// <summary> /// Appends a list of intervals, starting from firstDate and *************** *** 278,282 **** firstDate , lastDate ); ReturnInterval nextInterval = ! this.intervalsSelector.GetFirstInterval( firstDate ); while ( nextInterval.End.CompareTo( lastDate ) <= 0 ) { --- 291,295 ---- firstDate , lastDate ); ReturnInterval nextInterval = ! this.getFirstIntervalToBeAdded( firstDate ); while ( nextInterval.End.CompareTo( lastDate ) <= 0 ) { |
|
From: Marco M. <mi...@us...> - 2008-03-02 10:04:12
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25362/a2_Strategies/Optimizing/Decoding Modified Files: BasicDecoderForTestingPositions.cs Log Message: Better implementation of the basic virtual getWeights method Index: BasicDecoderForTestingPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding/BasicDecoderForTestingPositions.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BasicDecoderForTestingPositions.cs 27 Feb 2008 21:45:23 -0000 1.3 --- BasicDecoderForTestingPositions.cs 2 Mar 2008 10:04:06 -0000 1.4 *************** *** 138,142 **** //in this implementation encoded doesn't contain //information for weights: so weights are all the same ! double[] weights = new double[this.encoded.Length]; for(int i = 0; i<weights.Length; i++) weights[i] = 1.0 / weights.Length; --- 138,142 ---- //in this implementation encoded doesn't contain //information for weights: so weights are all the same ! double[] weights = new double[this.tickerRelatedGeneValues.Length]; for(int i = 0; i<weights.Length; i++) weights[i] = 1.0 / weights.Length; |
|
From: Glauco S. <gla...@us...> - 2008-02-27 22:50:42
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27922/b7_Scripts Modified Files: Scripts_SD.csproj Log Message: - WalkForwardTesting\PairsTrading\InSample\InSampleChoosers\Genetic\PairsTradingGeneticChooser.cs has been added - WalkForwardTesting\PairsTrading\InSample\PairsTradingFitnessEvaluator.cs has been added - WalkForwardTesting\PairsTrading\Logging\PairsTradingLogItem.cs has been added - WalkForwardTesting\PairsTrading\PairsTradingMain.cs has been added - WalkForwardTesting\PairsTrading\PairsTradingStrategy.cs has been added - WalkForwardTesting\PairsTrading has been added - WalkForwardTesting\PairsTrading\InSample has been added - WalkForwardTesting\PairsTrading\InSample\InSampleChoosers has been added - WalkForwardTesting\PairsTrading\InSample\InSampleChoosers\Genetic has been added - WalkForwardTesting\PairsTrading\Logging has been added Index: Scripts_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/Scripts_SD.csproj,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Scripts_SD.csproj 7 Feb 2008 18:34:22 -0000 1.13 --- Scripts_SD.csproj 27 Feb 2008 22:50:35 -0000 1.14 *************** *** 76,79 **** --- 76,84 ---- <Compile Include="WalkForwardTesting\FixedLengthTwoPhases\Logging\FixedLengthTwoPhasesLogItem.cs" /> <Compile Include="WalkForwardTesting\MSFTwalkForward\TsMSFTwalkForward.cs" /> + <Compile Include="WalkForwardTesting\PairsTrading\InSample\InSampleChoosers\Genetic\PairsTradingGeneticChooser.cs" /> + <Compile Include="WalkForwardTesting\PairsTrading\InSample\PairsTradingFitnessEvaluator.cs" /> + <Compile Include="WalkForwardTesting\PairsTrading\Logging\PairsTradingLogItem.cs" /> + <Compile Include="WalkForwardTesting\PairsTrading\PairsTradingMain.cs" /> + <Compile Include="WalkForwardTesting\PairsTrading\PairsTradingStrategy.cs" /> <Compile Include="WalkForwardTesting\WalkForwardLag\RunSimpleLag.cs" /> <Compile Include="WalkForwardTesting\WalkForwardLag\WeightedPositionsChoosers\BruteForce\WFLagBruteForceWeightedPositionsChooserForBalancedFixedPortfolioAndBalancedDriving.cs" /> *************** *** 249,252 **** --- 254,262 ---- <Folder Include="WalkForwardTesting\FixedLengthTwoPhases\InSampleChoosers\Genetic" /> <Folder Include="WalkForwardTesting\FixedLengthTwoPhases\Logging" /> + <Folder Include="WalkForwardTesting\PairsTrading" /> + <Folder Include="WalkForwardTesting\PairsTrading\InSample" /> + <Folder Include="WalkForwardTesting\PairsTrading\InSample\InSampleChoosers" /> + <Folder Include="WalkForwardTesting\PairsTrading\InSample\InSampleChoosers\Genetic" /> + <Folder Include="WalkForwardTesting\PairsTrading\Logging" /> <Folder Include="WalkForwardTesting\WalkForwardLag\WeightedPositionsChoosers\BruteForce" /> <Folder Include="WalkForwardTesting\WalkForwardLag\WeightedPositionsChoosers\Decoding" /> |
|
From: Glauco S. <gla...@us...> - 2008-02-27 22:29:51
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19305/b5_Presentation Modified Files: VisualObjectArchiver.cs Log Message: this.saveFileDialog.FileName has been limited to 200 characters, to avoid a run time error, for file name being too long Index: VisualObjectArchiver.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/VisualObjectArchiver.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** VisualObjectArchiver.cs 7 Feb 2008 18:50:33 -0000 1.2 --- VisualObjectArchiver.cs 27 Feb 2008 22:29:39 -0000 1.3 *************** *** 65,69 **** suffix + ")|*." + suffix; this.saveFileDialog.Title = title; ! this.saveFileDialog.FileName = initialFileName; this.saveFileDialog.InitialDirectory = initialDirectory; this.saveFileDialog.AddExtension = true; --- 65,69 ---- suffix + ")|*." + suffix; this.saveFileDialog.Title = title; ! this.saveFileDialog.FileName = initialFileName.Substring( 0 , 200); this.saveFileDialog.InitialDirectory = initialDirectory; this.saveFileDialog.AddExtension = true; |
|
From: Glauco S. <gla...@us...> - 2008-02-27 22:27:41
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases/InSampleChoosers/Genetic In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18493/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases/InSampleChoosers/Genetic Modified Files: FixedLengthTwoPhasesGeneticChooser.cs Log Message: Minor fixing for a string content Index: FixedLengthTwoPhasesGeneticChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases/InSampleChoosers/Genetic/FixedLengthTwoPhasesGeneticChooser.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FixedLengthTwoPhasesGeneticChooser.cs 10 Feb 2008 14:19:36 -0000 1.4 --- FixedLengthTwoPhasesGeneticChooser.cs 27 Feb 2008 22:27:35 -0000 1.5 *************** *** 106,110 **** throw new Exception( "Eligilbe tickers for driving positions contains " + "only " + eligibleTickers.Count + ! " elements, while NumberOfDrivingPositions is " + this.numberOfPortfolioPositions ); } --- 106,110 ---- throw new Exception( "Eligilbe tickers for driving positions contains " + "only " + eligibleTickers.Count + ! " elements, while the number of portfolio positions is " + this.numberOfPortfolioPositions ); } |
|
From: Glauco S. <gla...@us...> - 2008-02-27 22:26:47
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Statistics In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18084/b1_ADT/Statistics Modified Files: BasicFunctions.cs Log Message: static public double PearsonCorrelationCoefficient( double firstMultiplier , float[] firstDataVariable , double secondMultiplier , float[] secondDataVariable ) has been added Index: BasicFunctions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Statistics/BasicFunctions.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** BasicFunctions.cs 24 Jun 2007 21:25:54 -0000 1.9 --- BasicFunctions.cs 27 Feb 2008 22:26:44 -0000 1.10 *************** *** 274,277 **** --- 274,331 ---- } + #region PearsonCorrelationCoefficient with multipliers + static private void checkMultiplierIsNonZero( double multiplier ) + { + if ( multiplier == 0 ) + throw new Exception( "A multiplier cannot be zero!" ); + } + static private void pearsonCorrelationCoefficient_checkParameters( + double firstArrayMultiplier , float[] firstDataVariable, + double secondArrayMultiplier , float[] secondDataVariable ) + { + BasicFunctions.checkLengthOfDataVariables(firstDataVariable, secondDataVariable); + checkMultiplierIsNonZero( firstArrayMultiplier ); + checkMultiplierIsNonZero( secondArrayMultiplier ); + } + /// <summary> + /// Computes the Pearson's Correlation Coefficient for two weighted arrays + /// </summary> + /// <param name="firstMultiplier">multiplies each value of the + /// first data set</param> + /// <param name="firstDataVariable">first data set</param> + /// <param name="secondMultiplier">multiplies each value of the second + /// data set</param> + /// <param name="secondDataVariable">second data set</param> + /// <returns></returns> + static public double PearsonCorrelationCoefficient( + double firstMultiplier , float[] firstDataVariable, + double secondMultiplier , float[] secondDataVariable ) + { + pearsonCorrelationCoefficient_checkParameters( + firstMultiplier , firstDataVariable, + secondMultiplier , secondDataVariable ); + int n = firstDataVariable.Length; + double sumOfProduct = 0.0, sumOfFirst = 0.0, sumOfSecond = 0.0, + sumOfSquaredFirst = 0.0, sumOfSquaredSecond = 0.0; + double currentValueFromFirstDataSet , currentValueFromSecondDataSet; + for(int i = 0; i < n; i++) + { + currentValueFromFirstDataSet = firstMultiplier * firstDataVariable[i]; + currentValueFromSecondDataSet = secondMultiplier * secondDataVariable[i]; + sumOfFirst += currentValueFromFirstDataSet; + sumOfSecond += currentValueFromSecondDataSet; + sumOfProduct += currentValueFromFirstDataSet * currentValueFromSecondDataSet; + sumOfSquaredFirst += + currentValueFromFirstDataSet * currentValueFromFirstDataSet; + sumOfSquaredSecond += + currentValueFromSecondDataSet * currentValueFromSecondDataSet; + } + return (n*sumOfProduct - sumOfFirst*sumOfSecond)/ + Math.Sqrt( (n*sumOfSquaredFirst - sumOfFirst*sumOfFirst)* + (n*sumOfSquaredSecond - sumOfSecond*sumOfSecond) ); + } + #endregion PearsonCorrelationCoefficient with multipliers + + static public double SimpleAverageOfProduct( double[] firstDataVariable, double[] secondDataVariable ) |
|
From: Glauco S. <gla...@us...> - 2008-02-27 22:19:27
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15191 Modified Files: Business_SD.csproj Log Message: - <RootNamespace> has been changed from Business to QuantProject.Business - a2_Strategies\EndOfDayStrategies\BasicEndOfDayStrategyForBacktester.cs has been added - a2_Strategies\Optimizing\GenomeManagers\GenomeManagerWithDuplicateGenes.cs has been added - a2_Strategies\returnsManagement\time\selectors\OddIntervalsSelector.cs has been added - a2_Strategies\EndOfDayStrategies has been added Index: Business_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/Business_SD.csproj,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Business_SD.csproj 13 Feb 2008 22:19:56 -0000 1.12 --- Business_SD.csproj 27 Feb 2008 22:19:21 -0000 1.13 *************** *** 5,9 **** <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{91CAD8B7-D505-40BE-8FAF-0597E62FF71D}</ProjectGuid> ! <RootNamespace>Business</RootNamespace> <AssemblyName>QuantProject.Business</AssemblyName> <OutputType>Library</OutputType> --- 5,9 ---- <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{91CAD8B7-D505-40BE-8FAF-0597E62FF71D}</ProjectGuid> ! <RootNamespace>QuantProject.Business</RootNamespace> <AssemblyName>QuantProject.Business</AssemblyName> <OutputType>Library</OutputType> *************** *** 69,72 **** --- 69,73 ---- <Compile Include="a2_Strategies\Eligibles\IEligiblesSelector.cs" /> <Compile Include="a2_Strategies\Eligibles\MostLiquidAndLessVolatile.cs" /> + <Compile Include="a2_Strategies\EndOfDayStrategies\BasicEndOfDayStrategyForBacktester.cs" /> <Compile Include="a2_Strategies\EndOfDayStrategyBackTester.cs" /> <Compile Include="a2_Strategies\IEndOfDayStrategyForBacktester.cs" /> *************** *** 85,88 **** --- 86,90 ---- <Compile Include="a2_Strategies\Optimizing\FitnessEvaluation\IFitnessEvaluator.cs" /> <Compile Include="a2_Strategies\Optimizing\GenomeManagers\BasicGenomeManager.cs" /> + <Compile Include="a2_Strategies\Optimizing\GenomeManagers\GenomeManagerWithDuplicateGenes.cs" /> <Compile Include="a2_Strategies\Optimizing\GenomeManagers\GenomeManagerType.cs" /> <Compile Include="a2_Strategies\OutOfSample\TestingPositions.cs" /> *************** *** 95,98 **** --- 97,101 ---- <Compile Include="a2_Strategies\returnsManagement\time\selectors\IIntervalsSelector.cs" /> <Compile Include="a2_Strategies\returnsManagement\time\selectors\FixedLengthTwoPhasesIntervalsSelector.cs" /> + <Compile Include="a2_Strategies\returnsManagement\time\selectors\OddIntervalsSelector.cs" /> <Compile Include="a2_Strategies\TickersRelationships\CloseToCloseCorrelationProvider.cs" /> <Compile Include="a2_Strategies\TickersRelationships\CorrelationProvider.cs" /> *************** *** 227,230 **** --- 230,234 ---- </ProjectReference> <Folder Include="a1_Financial\a2_Accounting\h5_Reporting\StatisticsSummaryRows" /> + <Folder Include="a2_Strategies\EndOfDayStrategies" /> <Folder Include="a2_Strategies\Optimizing\FitnessEvaluation" /> <Folder Include="a2_Strategies\Optimizing\GenomeManagers" /> |
|
From: Glauco S. <gla...@us...> - 2008-02-27 22:17:13
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14360/a2_Strategies Modified Files: WeightedPositions.cs Log Message: The read only property public WeightedPositions Opposite has been added Index: WeightedPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/WeightedPositions.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** WeightedPositions.cs 14 Jan 2008 23:27:26 -0000 1.13 --- WeightedPositions.cs 27 Feb 2008 22:17:10 -0000 1.14 *************** *** 118,121 **** --- 118,144 ---- get { return this.ToString(); } } + + /// <summary> + /// returns a new WeightedPositions object, obtained by the current instance, + /// but reversing the sign of each weight for each position: + /// long positions become then short positions and viceversa + /// </summary> + public WeightedPositions Opposite + { + get + { + double[] oppositeWeights = new Double[ this.Count ]; + string[] tickers = new String[ this.Count ]; + for ( int i = 0 ; i < this.Count ; i++ ) + { + tickers[ i ] = ((WeightedPosition)(this[ i ])).Ticker; + oppositeWeights[ i ] = -((WeightedPosition)(this[ i ])).Weight; + } + WeightedPositions opposite = new WeightedPositions( + oppositeWeights , tickers ); + return opposite; + } + } + private void weightedPositions_default( double[] normalizedWeightValues , string[] tickers ) |
|
From: Glauco S. <gla...@us...> - 2008-02-27 22:16:10
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13562/a2_Strategies Modified Files: IEndOfDayStrategyForBacktester.cs Log Message: The implementation of the IMessageSender interface is requested, now Index: IEndOfDayStrategyForBacktester.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/IEndOfDayStrategyForBacktester.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IEndOfDayStrategyForBacktester.cs 10 Feb 2008 14:29:51 -0000 1.2 --- IEndOfDayStrategyForBacktester.cs 27 Feb 2008 22:16:03 -0000 1.3 *************** *** 23,26 **** --- 23,27 ---- using System; + using QuantProject.ADT.Messaging; using QuantProject.Business.Strategies.Logging; *************** *** 31,35 **** /// to be used by the EndOfDayStrategyBackTester /// </summary> ! public interface IEndOfDayStrategyForBacktester : IEndOfDayStrategy , ILogDescriptor { /// <summary> --- 32,37 ---- /// to be used by the EndOfDayStrategyBackTester /// </summary> ! public interface IEndOfDayStrategyForBacktester : IEndOfDayStrategy , ILogDescriptor , ! IMessageSender { /// <summary> |
|
From: Glauco S. <gla...@us...> - 2008-02-27 22:15:29
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13533/a2_Strategies/Optimizing/Decoding Modified Files: IDecoderForTestingPositions.cs Log Message: Minor change: using statements have been alphabetically reordered Index: IDecoderForTestingPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding/IDecoderForTestingPositions.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IDecoderForTestingPositions.cs 22 Feb 2008 20:57:01 -0000 1.2 --- IDecoderForTestingPositions.cs 27 Feb 2008 22:15:19 -0000 1.3 *************** *** 24,30 **** using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.OutOfSample; using QuantProject.Business.Strategies.ReturnsManagement; - using QuantProject.Business.Strategies.Logging; namespace QuantProject.Business.Strategies.Optimizing.Decoding --- 24,30 ---- using QuantProject.Business.Strategies.Eligibles; + using QuantProject.Business.Strategies.Logging; using QuantProject.Business.Strategies.OutOfSample; using QuantProject.Business.Strategies.ReturnsManagement; namespace QuantProject.Business.Strategies.Optimizing.Decoding |
|
From: Glauco S. <gla...@us...> - 2008-02-27 22:14:10
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13000/a07_DataProviders Modified Files: HistoricalQuoteProvider.cs Log Message: A different exception is now thrown, when a quote is asked for a missing quote. The new exception's type is TickerNotExchangedException Index: HistoricalQuoteProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders/HistoricalQuoteProvider.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HistoricalQuoteProvider.cs 10 Feb 2008 14:28:09 -0000 1.5 --- HistoricalQuoteProvider.cs 27 Feb 2008 22:14:05 -0000 1.6 *************** *** 84,90 **** } else ! throw new Exception( "The ticker " + ticker + " is not " + ! "exchanged at the following end of day date time: " + ! currentEndOfDayDateTime.ToString() ); } public EndOfDayHistory GetEndOfDayQuotes( string ticker , --- 84,89 ---- } else ! throw new TickerNotExchangedException( ! ticker , currentEndOfDayDateTime ); } public EndOfDayHistory GetEndOfDayQuotes( string ticker , |
|
From: Glauco S. <gla...@us...> - 2008-02-27 22:12:33
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/InSample In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12255/a2_Strategies/InSample Modified Files: GeneticChooser.cs Log Message: This commit is just to complete the log message for the previous commit. - a bug has been fixed; the following line has been added: addedTestingPositions++; Index: GeneticChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/InSample/GeneticChooser.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GeneticChooser.cs 27 Feb 2008 22:09:54 -0000 1.5 --- GeneticChooser.cs 27 Feb 2008 22:12:30 -0000 1.6 *************** *** 54,58 **** //have a different hash code ( //the method that returns the hash code for genome ! //is virtual) protected TestingPositions[] bestTestingPositions; protected Benchmark benchmark; --- 54,58 ---- //have a different hash code ( //the method that returns the hash code for genome ! //is virtual) protected TestingPositions[] bestTestingPositions; protected Benchmark benchmark; |
|
From: Glauco S. <gla...@us...> - 2008-02-27 22:10:03
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/InSample In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10951/a2_Strategies/InSample Modified Files: GeneticChooser.cs Log Message: - minor fixing for a string content - the method getHashCodeForGenome(Genome genome); is abstract, now Index: GeneticChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/InSample/GeneticChooser.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GeneticChooser.cs 25 Feb 2008 23:09:00 -0000 1.4 --- GeneticChooser.cs 27 Feb 2008 22:09:54 -0000 1.5 *************** *** 104,107 **** --- 104,109 ---- this.numberOfPortfolioPositions = numberOfPortfolioPositions; this.numberOfBestTestingPositionsToBeReturned = numberOfBestTestingPositionsToBeReturned; + // this.choosePositionsWithAtLeastOneDifferentTicker = + // choosePositionsWithAtLeastOneDifferentTicker; this.bestTestingPositions = new TestingPositions[numberOfBestTestingPositionsToBeReturned]; this.benchmark = benchmark; *************** *** 126,130 **** throw new Exception( "Eligible tickers for driving positions contains " + "only " + eligibleTickers.Count + ! " elements, while NumberOfDrivingPositions is " + this.numberOfPortfolioPositions ); if ( this.numberOfBestTestingPositionsToBeReturned > --- 128,132 ---- throw new Exception( "Eligible tickers for driving positions contains " + "only " + eligibleTickers.Count + ! " elements, while number of portfolio positions is " + this.numberOfPortfolioPositions ); if ( this.numberOfBestTestingPositionsToBeReturned > *************** *** 174,185 **** //it returns a hashCode for the given genome //normally, it should be overrided in inherited classes ! protected virtual string getHashCodeForGenome(Genome genome) ! { ! string returnValue = genome.Meaning.GetHashCode().ToString(); ! // if (this.choosePositionsWithAtLeastOneDifferentTicker) ! // returnValue = ((TestingPositions)genome.Meaning).HashCodeForTickerComposition; ! // else ! return returnValue; ! } private void setBestTestingPositions() --- 176,187 ---- //it returns a hashCode for the given genome //normally, it should be overrided in inherited classes ! protected abstract string getHashCodeForGenome(Genome genome); ! // { ! // string returnValue = genome.Meaning.GetHashCode().ToString(); ! //// if (this.choosePositionsWithAtLeastOneDifferentTicker) ! //// returnValue = ((TestingPositions)genome.Meaning).HashCodeForTickerComposition; ! //// else ! // return returnValue; ! // } private void setBestTestingPositions() *************** *** 201,204 **** --- 203,207 ---- (TestingPositions)currentGenome.Meaning; genomesCollector.Add(currentGenomeHashcode, null); + addedTestingPositions++; } counter ++ ; |
|
From: Glauco S. <gla...@us...> - 2008-02-27 22:08:25
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/selectors In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10481/a2_Strategies/returnsManagement/time/selectors Modified Files: FixedLengthTwoPhasesIntervalsSelector.cs Log Message: The class' comment has been improved Index: FixedLengthTwoPhasesIntervalsSelector.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/selectors/FixedLengthTwoPhasesIntervalsSelector.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FixedLengthTwoPhasesIntervalsSelector.cs 19 Jan 2008 18:03:18 -0000 1.1 --- FixedLengthTwoPhasesIntervalsSelector.cs 27 Feb 2008 22:08:19 -0000 1.2 *************** *** 29,35 **** { /// <summary> ! /// Selects a set of intervals where there is a fixed number of time steps ! /// for even intervals (first, third, ...) and (possilby) a different ! /// fixed number of benchmark time steps for odd intervals (second, fourth, ...). /// A benchmark time step is either an "open to close" interval or /// a "close to open" interval (refered to dateTimes when the benchmark is --- 29,36 ---- { /// <summary> ! /// Selects a set of intervals where there is a fixed number of ! /// benchmark time steps ! /// for odd intervals (first, third, ...) and a (possibly) different ! /// fixed number of benchmark time steps for even intervals (second, fourth, ...). /// A benchmark time step is either an "open to close" interval or /// a "close to open" interval (refered to dateTimes when the benchmark is *************** *** 43,49 **** /// <summary> ! /// Selects a set of intervals where there is a fixed number of time steps ! /// for even intervals (first, third, ...) and (possilby) a different ! /// fixed number of benchmark time steps for odd intervals (second, fourth, ...) /// A benchmark time step is either an "open to close" interval or /// a "close to open" interval (refered to dateTimes when the benchmark is --- 44,51 ---- /// <summary> ! /// Selects a set of intervals where there is a fixed number of ! /// benchmark time steps ! /// for odd intervals (first, third, ...) and a (possibly) different ! /// fixed number of benchmark time steps for even intervals (second, fourth, ...). /// A benchmark time step is either an "open to close" interval or /// a "close to open" interval (refered to dateTimes when the benchmark is |
|
From: Glauco S. <gla...@us...> - 2008-02-27 21:46:18
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1369/a2_Strategies/Optimizing/Decoding Modified Files: DecoderForTestingPositionsWithBalancedWeights.cs Log Message: getDescription() is implemented, now Index: DecoderForTestingPositionsWithBalancedWeights.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding/DecoderForTestingPositionsWithBalancedWeights.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DecoderForTestingPositionsWithBalancedWeights.cs 22 Feb 2008 20:57:01 -0000 1.2 --- DecoderForTestingPositionsWithBalancedWeights.cs 27 Feb 2008 21:46:15 -0000 1.3 *************** *** 41,53 **** } ! public override string Description ! { ! get ! { ! string description = ! "DecoderForTestingPositions_DecodedOnlyTickers_WeightsAreBalancedOnVolatilityBase"; ! return description; ! } ! } protected override double[] getWeights() --- 41,53 ---- } ! // public override string Description ! // { ! // get ! // { ! // string description = ! // "DecoderForTestingPositions_DecodedOnlyTickers_WeightsAreBalancedOnVolatilityBase"; ! // return description; ! // } ! // } protected override double[] getWeights() *************** *** 56,59 **** --- 56,64 ---- this.decodeSignedTickers(), this.returnsManager ); } + + protected override string getDescription() + { + return "bscBlncdTstngPstns"; + } } } |
|
From: Glauco S. <gla...@us...> - 2008-02-27 21:45:28
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv957/a2_Strategies/Optimizing/Decoding Modified Files: BasicDecoderForTestingPositions.cs Log Message: - the class is abstract, now - the method protected abstract string getDescription() has been added Index: BasicDecoderForTestingPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding/BasicDecoderForTestingPositions.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BasicDecoderForTestingPositions.cs 22 Feb 2008 20:57:58 -0000 1.2 --- BasicDecoderForTestingPositions.cs 27 Feb 2008 21:45:23 -0000 1.3 *************** *** 37,41 **** /// can be decoded only tickers /// </summary> ! public class BasicDecoderForTestingPositions : IDecoderForTestingPositions { --- 37,41 ---- /// can be decoded only tickers /// </summary> ! public abstract class BasicDecoderForTestingPositions : IDecoderForTestingPositions { *************** *** 44,57 **** protected EligibleTickers eligibleTickers; protected ReturnsManager returnsManager; ! ! public virtual string Description { get { ! string description = ! "BasicDecoderForTestingPositions_DecodedOnlyTickers_EqualWeights"; return description; } } public BasicDecoderForTestingPositions() --- 44,72 ---- protected EligibleTickers eligibleTickers; protected ReturnsManager returnsManager; ! ! /// <summary> ! /// short description to be used for the file name ! /// </summary> ! /// <returns></returns> ! protected abstract string getDescription(); ! ! public string Description { get { ! string description = "Dcdr_" + this.getDescription(); return description; } } + + // public virtual string Description + // { + // get + // { + // string description = + // "BasicDecoderForTestingPositions_DecodedOnlyTickers_EqualWeights"; + // return description; + // } + // } public BasicDecoderForTestingPositions() *************** *** 132,137 **** { SignedTickers signedTickers = this.decodeSignedTickers(); TestingPositions testingPositions = new TestingPositions( ! new WeightedPositions( this.getWeights(), signedTickers) ); return testingPositions; --- 147,153 ---- { SignedTickers signedTickers = this.decodeSignedTickers(); + double[] weights = this.getWeights(); TestingPositions testingPositions = new TestingPositions( ! new WeightedPositions( weights , signedTickers.Tickers ) ); return testingPositions; *************** *** 167,173 **** ReturnsManager returnsManager) { - this.setTickerRelatedGeneValues(); this.decode_updateProtectedMembers(encoded , eligibleTickers , returnsManager); TestingPositions meaning = new TestingPositions(); if ( this.isDecodable() ) --- 183,189 ---- ReturnsManager returnsManager) { this.decode_updateProtectedMembers(encoded , eligibleTickers , returnsManager); + this.setTickerRelatedGeneValues(); TestingPositions meaning = new TestingPositions(); if ( this.isDecodable() ) |
|
From: Glauco S. <gla...@us...> - 2008-02-27 21:43:09
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv32472 Modified Files: b4_Business.csproj Log Message: - a07_DataProviders\TickerNotExchangedException.cs has been added - a2_Strategies\EndOfDayStrategies\BasicEndOfDayStrategyForBacktester.cs has been added - a2_Strategies\Optimizing\GenomeManagers\GenomeManagerWithDuplicateGenes.cs has been added - a2_Strategies\returnsManagement\time\selectors\OddIntervalsSelector.cs has been added Index: b4_Business.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** b4_Business.csproj 13 Feb 2008 22:19:56 -0000 1.54 --- b4_Business.csproj 27 Feb 2008 21:43:05 -0000 1.55 *************** *** 253,256 **** --- 253,261 ---- /> <File + RelPath = "a07_DataProviders\TickerNotExchangedException.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a1_Financial\a1_Instruments\Instrument.cs" SubType = "Code" *************** *** 713,716 **** --- 718,726 ---- /> <File + RelPath = "a2_Strategies\EndOfDayStrategies\BasicEndOfDayStrategyForBacktester.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a2_Strategies\EquityEvaluation\ExpectancyScore.cs" SubType = "Code" *************** *** 803,806 **** --- 813,821 ---- /> <File + RelPath = "a2_Strategies\Optimizing\GenomeManagers\GenomeManagerWithDuplicateGenes.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a2_Strategies\OutOfSample\TestingPositions.cs" SubType = "Code" *************** *** 853,856 **** --- 868,876 ---- /> <File + RelPath = "a2_Strategies\returnsManagement\time\selectors\OddIntervalsSelector.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a2_Strategies\TickersRelationships\CloseToCloseCorrelationProvider.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2008-02-27 21:41:37
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/selectors In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31782/returnsManagement/time/selectors Added Files: OddIntervalsSelector.cs Log Message: Selects a set of intervals where there is a fixed number of benchmark time steps for odd intervals (first, third, ...) and a (possibly) different fixed number of benchmark time steps for even intervals (second, fourth, ...). A benchmark time step is either an "open to close" interval or a "close to open" interval (refered to dateTimes when the benchmark is exchanged) Only odd intervals (first, third, ...) are returned, even intervals (second, fourth, ...) are skipped instead --- NEW FILE: OddIntervalsSelector.cs --- /* QuantProject - Quantitative Finance Library OddIntervalsSelector.cs Copyright (C) 2007 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.Histories; using QuantProject.Business.Timing; namespace QuantProject.Business.Strategies.ReturnsManagement.Time.IntervalsSelectors { /// <summary> /// Selects a set of intervals where there is a fixed number of benchmark /// time steps /// for odd intervals (first, third, ...) and a (possibly) different /// fixed number of benchmark time steps for even intervals (second, fourth, ...). /// A benchmark time step is either an "open to close" interval or /// a "close to open" interval (refered to dateTimes when the benchmark is /// exchanged) /// Only odd intervals (first, third, ...) are returned, even intervals /// (second, fourth, ...) are skipped instead /// </summary> public class OddIntervalsSelector : IIntervalsSelector { // private int benchmarkTimeStepsForOddIntervals; // private int benchmarkTimeStepsForEvenIntervals; // private Benchmark benchmark; private FixedLengthTwoPhasesIntervalsSelector fixedLengthTwoPhasesIntervalsSelector; /// <summary> /// Selects a set of intervals where there is a fixed number of benchmark /// time steps /// for odd intervals (first, third, ...) and a (possibly) different /// fixed number of benchmark time steps for even intervals (second, fourth, ...). /// A benchmark time step is either an "open to close" interval or /// a "close to open" interval (refered to dateTimes when the benchmark is /// exchanged) /// Only odd intervals (first, third, ...) are returned, even intervals /// (second, fourth, ...) are skipped instead /// </summary> /// <param name="benchmarkTimeStepsForOddIntervals">number of benchmark time steps /// for odd intervals (first, third, fifth, ...)</param> /// <param name="benchmarkTimeStepsForEvenIntervals">number of benchmark time steps /// for even intervals (second, fourth, sixth, ...)</param> /// <param name="benchmark"></param> public OddIntervalsSelector( int benchmarkTimeStepsForOddIntervals , int benchmarkTimeStepsForEvenIntervals , Benchmark benchmark ) { this.fixedLengthTwoPhasesIntervalsSelector = new FixedLengthTwoPhasesIntervalsSelector( benchmarkTimeStepsForOddIntervals , benchmarkTimeStepsForEvenIntervals , benchmark ); } public ReturnInterval GetNextInterval( ReturnIntervals returnIntervals ) { ReturnInterval nextEvenInterval = this.fixedLengthTwoPhasesIntervalsSelector.GetNextInterval( returnIntervals ); ReturnIntervals returnIntervalsWithTheNextEvenIntervalOnly = new ReturnIntervals( nextEvenInterval ); ReturnInterval nextOddInterval = this.fixedLengthTwoPhasesIntervalsSelector.GetNextInterval( returnIntervalsWithTheNextEvenIntervalOnly ); return nextOddInterval; } public ReturnInterval GetFirstInterval( EndOfDayDateTime startingEndOfDayDateTime ) { ReturnInterval nextInterval = this.fixedLengthTwoPhasesIntervalsSelector.GetFirstInterval( startingEndOfDayDateTime ); return nextInterval; } } } |
|
From: Glauco S. <gla...@us...> - 2008-02-27 21:40:07
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/GenomeManagers In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30910/Optimizing/GenomeManagers Added Files: GenomeManagerWithDuplicateGenes.cs Log Message: Genome manager with duplicate genes --- NEW FILE: GenomeManagerWithDuplicateGenes.cs --- /* QuantProject - Quantitative Finance Library GenomeManagerWithDuplicateGenes.cs Copyright (C) 2008 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.Optimizing.Genetic; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.EquityEvaluation; using QuantProject.Business.Strategies.Optimizing.Decoding; using QuantProject.Business.Strategies.Optimizing.FitnessEvaluation; using QuantProject.Business.Strategies.ReturnsManagement; namespace QuantProject.Business.Strategies.Optimizing.GenomeManagers { /// <summary> /// Genome manager with duplicate genes /// </summary> public class GenomeManagerWithDuplicateGenes : BasicGenomeManager { public GenomeManagerWithDuplicateGenes( int numberOfPortfolioPositions , EligibleTickers eligibleTickers , ReturnsManager returnsManager , IDecoderForTestingPositions decoderForTestingPositions , IFitnessEvaluator fitnessEvaluator , GenomeManagerType genomeManagerType , int seedForRandomGenerator ) : base( eligibleTickers , numberOfPortfolioPositions , decoderForTestingPositions , fitnessEvaluator , genomeManagerType , returnsManager , seedForRandomGenerator ) { } public override 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; } // public object Decode( Genome genome ) // { // return this.decoderForWeightedPositions.Decode( // genome.Genes() , this.eligibleTickers , this.returnsManager ); // } // public double GetFitnessValue( Genome genome ) // { // object meaning = this.Decode( genome ); // double fitnessValue = // this.fitnessEvaluator.GetFitnessValue( meaning , this.returnsManager ); // return fitnessValue; // } public override Genome[] GetChilds( Genome parent1 , Genome parent2 ) { return GenomeManagement.AlternateFixedCrossover(parent1, parent2); } public override 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 ); } } } |
|
From: Glauco S. <gla...@us...> - 2008-02-27 21:39:11
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/EndOfDayStrategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30601 Added Files: BasicEndOfDayStrategyForBacktester.cs Log Message: Basic abstract implementation of IEndOfDayStrategyForBacktester, that should be inherited by specific strategies --- NEW FILE: BasicEndOfDayStrategyForBacktester.cs --- /* QuantProject - Quantitative Finance Library BasicEndOfDayStrategyForBacktester.cs Copyright (C) 2008 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.Messaging; using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Strategies; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.Logging; using QuantProject.Business.Strategies.OutOfSample; using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Strategies.ReturnsManagement.Time; using QuantProject.Business.Strategies.ReturnsManagement.Time.IntervalsSelectors; using QuantProject.Business.Timing; namespace QuantProject.Business.Strategies { /// <summary> /// Basic abstract implementation of IEndOfDayStrategyForBacktester, /// that should be inherited by specific strategies /// </summary> public abstract class BasicEndOfDayStrategyForBacktester : IEndOfDayStrategyForBacktester { public event NewLogItemEventHandler NewLogItem; public event NewMessageEventHandler NewMessage; protected int numDaysBeetweenEachOtpimization; protected int numDaysForInSampleOptimization; protected IIntervalsSelector intervalsSelector; protected IEligiblesSelector eligiblesSelector; protected IInSampleChooser inSampleChooser; protected IHistoricalQuoteProvider historicalQuoteProvider; protected DateTime lastOptimizationDateTime; protected ReturnIntervals returnIntervals; private Account account; protected TestingPositions[] bestTestingPositionsInSample; public Account Account { set { this.account = value; } } public bool StopBacktestIfMaxRunningHoursHasBeenReached { get { return this.optimalWeightedPositionsAreToBeUpdated(); } } /// <summary> /// short text identifier, to be added to the /// strategy description /// </summary> /// <returns></returns> protected abstract string getTextIdentifier(); public string Description { get { string descriptionForLogFileName = "Strtgy_" + this.getTextIdentifier() + "nmDysBtwnOptmztns_" + this.numDaysBeetweenEachOtpimization.ToString() + "_" + this.eligiblesSelector.Description + "_" + this.inSampleChooser.Description + "_oS_longOnly"; return descriptionForLogFileName; } } public BasicEndOfDayStrategyForBacktester() { } public BasicEndOfDayStrategyForBacktester( int numDaysBeetweenEachOtpimization , int numDaysForInSampleOptimization , IIntervalsSelector intervalsSelector , IEligiblesSelector eligiblesSelector , IInSampleChooser inSampleChooser , IHistoricalQuoteProvider historicalQuoteProvider ) { this.numDaysBeetweenEachOtpimization = numDaysBeetweenEachOtpimization; this.numDaysForInSampleOptimization = numDaysForInSampleOptimization; this.intervalsSelector = intervalsSelector; this.eligiblesSelector = eligiblesSelector; this.inSampleChooser = inSampleChooser; this.historicalQuoteProvider = historicalQuoteProvider; this.returnIntervals = new ReturnIntervals( this.intervalsSelector ); } #region MarketOpenEventHandler protected abstract bool marketOpenEventHandler_arePositionsToBeClosed(); protected abstract bool marketOpenEventHandler_arePositionsToBeOpened(); protected abstract WeightedPositions marketOpenEventHandler_getPositionsToBeOpened(); public void MarketOpenEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { this.updateReturnIntervals(); if ( this.marketOpenEventHandler_arePositionsToBeClosed() ) AccountManager.ClosePositions( this.account ); if ( this.marketOpenEventHandler_arePositionsToBeOpened() ) { WeightedPositions positionsToBeOpened = this.marketOpenEventHandler_getPositionsToBeOpened(); if ( positionsToBeOpened != null ) // positions to be opened are available, actually AccountManager.OpenPositions( this.marketOpenEventHandler_getPositionsToBeOpened() , this.account ); } } #endregion MarketOpenEventHandler public void FiveMinutesBeforeMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { } #region MarketCloseEventHandler protected abstract bool marketCloseEventHandler_arePositionsToBeClosed(); protected abstract bool marketCloseEventHandler_arePositionsToBeOpened(); protected abstract WeightedPositions marketCloseEventHandler_getPositionsToBeOpened(); public void MarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { this.updateReturnIntervals(); if ( this.marketCloseEventHandler_arePositionsToBeClosed() ) AccountManager.ClosePositions( this.account ); if ( this.marketCloseEventHandler_arePositionsToBeOpened() ) { WeightedPositions positionsToBeOpened = this.marketCloseEventHandler_getPositionsToBeOpened(); if ( positionsToBeOpened != null ) // positions to be opened are available, actually AccountManager.OpenPositions( this.marketCloseEventHandler_getPositionsToBeOpened() , this.account ); } } #endregion MarketCloseEventHandler #region OneHourAfterMarketCloseEventHandler private bool optimalWeightedPositionsAreToBeUpdated() { // TimeSpan timeSpanSinceLastOptimization = // this.now().DateTime - this.lastOptimizationDateTime; // bool areToBeUpdated = ( timeSpanSinceLastOptimization.Days >= // this.numDaysBeetweenEachOtpimization ); // return areToBeUpdated; DateTime dateTimeForNextOptimization = this.lastOptimizationDateTime.AddDays( this.numDaysBeetweenEachOtpimization ); bool areToBeUpdated = ( ( ( this.account.Portfolio.Count == 0 ) && ( ( this.lastOptimizationDateTime == DateTime.MinValue ) ) ) || ( this.now().DateTime >= dateTimeForNextOptimization ) ); return areToBeUpdated; } #region getInSampleReturnIntervals private EndOfDayDateTime getInSampleReturnIntervals_getFirstDate() { DateTime firstDateTime = this.now().DateTime.AddDays( -this.numDaysForInSampleOptimization ); EndOfDayDateTime firstDate = new EndOfDayDateTime( firstDateTime , EndOfDaySpecificTime.MarketOpen ); return firstDate; } private ReturnIntervals getInSampleReturnIntervals() { EndOfDayDateTime firstDate = this.getInSampleReturnIntervals_getFirstDate(); EndOfDayDateTime lastDate = new EndOfDayDateTime( this.now().DateTime , EndOfDaySpecificTime.MarketClose ); ReturnIntervals inSampleReturnIntervals = new ReturnIntervals( this.intervalsSelector ); inSampleReturnIntervals.AppendFirstInterval( firstDate ); if ( inSampleReturnIntervals.LastEndOfDayDateTime.IsLessThan( lastDate ) ) inSampleReturnIntervals.AppendIntervalsButDontGoBeyondLastDate( lastDate ); return inSampleReturnIntervals; } #endregion getInSampleReturnIntervals private void notifyMessage( EligibleTickers eligibleTickers ) { string message = "Number of Eligible tickers: " + eligibleTickers.Count; NewMessageEventArgs newMessageEventArgs = new NewMessageEventArgs( message ); if ( this.NewMessage != null ) this.NewMessage( this , newMessageEventArgs ); } #region logOptimizationInfo // private void outputMessage( string message ) // { // string dateStamp = // ExtendedDateTime.GetShortDescriptionForFileName( DateTime.Now ); // MessageManager.DisplayMessage( message , // "NotificationMessagesForCurrentStrategy_" + // dateStamp + ".Txt" ); // } protected abstract LogItem getLogItem( EligibleTickers eligibleTickers ); private void raiseNewLogItem( EligibleTickers eligibleTickers ) { LogItem logItem = this.getLogItem( eligibleTickers ); NewLogItemEventArgs newLogItemEventArgs = new NewLogItemEventArgs( logItem ); this.NewLogItem( this , newLogItemEventArgs ); } private void logOptimizationInfo( EligibleTickers eligibleTickers ) { this.raiseNewLogItem( eligibleTickers ); } #endregion logOptimizationInfo private void updateOptimalTestingPositions_actually() { ReturnIntervals inSampleReturnIntervals = this.getInSampleReturnIntervals(); EligibleTickers eligibleTickers = this.eligiblesSelector.GetEligibleTickers( inSampleReturnIntervals.BordersHistory ); ReturnsManager returnsManager = new ReturnsManager( inSampleReturnIntervals , this.historicalQuoteProvider ); this.bestTestingPositionsInSample = (TestingPositions[])this.inSampleChooser.AnalyzeInSample( eligibleTickers , returnsManager ); this.notifyMessage( eligibleTickers ); this.logOptimizationInfo( eligibleTickers ); } private void updateOptimalTestingPositions() { this.updateOptimalTestingPositions_actually(); this.lastOptimizationDateTime = this.now().DateTime; // FixedLengthTwoPhasesLogItem logItem = // new FixedLengthTwoPhasesLogItem( this.now() ); // logItem.BestWeightedPositionsInSample = this.bestWeightedPositionsInSample; } public void OneHourAfterMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { if ( this.optimalWeightedPositionsAreToBeUpdated() ) this.updateOptimalTestingPositions(); } #endregion OneHourAfterMarketCloseEventHandler // protected bool isInsampleOptimizationNeeded() // { // DateTime dateTimeForNextOptimization = // this.lastOptimizationDateTime.AddDays( // this.numDaysBeetweenEachOtpimization ); // bool returnValue = // ( ( ( this.account.Portfolio.Count == 0 ) // && ( ( this.lastOptimizationDateTime == DateTime.MinValue ) ) ) || // ( this.now().DateTime >= dateTimeForNextOptimization ) ); // return returnValue; // } protected EndOfDayDateTime now() { return this.account.EndOfDayTimer.GetCurrentTime(); } private void updateReturnIntervals() { EndOfDayDateTime currentEndOfDayDateTime = this.now(); if ( this.returnIntervals.Count == 0 ) // no interval has been added yet this.returnIntervals.AppendFirstInterval( currentEndOfDayDateTime ); else // at least one interval has already been added if ( this.returnIntervals.LastEndOfDayDateTime.IsLessThanOrEqualTo( currentEndOfDayDateTime ) ) this.returnIntervals.AppendIntervalsToGoJustBeyond( currentEndOfDayDateTime ); } protected ReturnInterval lastIntervalAppended() { ReturnInterval lastInterval = this.returnIntervals[ this.returnIntervals.Count - 1 ]; return lastInterval; } } } |
|
From: Glauco S. <gla...@us...> - 2008-02-27 21:38:42
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/EndOfDayStrategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30467/EndOfDayStrategies Log Message: Directory /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/EndOfDayStrategies added to the repository |
|
From: Glauco S. <gla...@us...> - 2008-02-27 21:21:30
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22875/b4_Business/a07_DataProviders Added Files: TickerNotExchangedException.cs Log Message: Thrown when a quote is requested, but it is not present in the database --- NEW FILE: TickerNotExchangedException.cs --- /* QuantProject - Quantitative Finance Library TickerNotExchangedException.cs Copyright (C) 2008 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.Business.Timing; namespace QuantProject.Business.DataProviders { /// <summary> /// Thrown when a quote is requested, but it is not present in /// the database /// </summary> public class TickerNotExchangedException : Exception { private string ticker; private EndOfDayDateTime endOfDayDateTime; public override string Message { get { return "Missing quote for ticker " + this.ticker + " for end of day date time " + this.endOfDayDateTime.Description; } } public TickerNotExchangedException( string ticker , EndOfDayDateTime endOfDayDateTime ) { this.ticker = ticker; this.endOfDayDateTime = endOfDayDateTime; } } } |
|
From: Glauco S. <gla...@us...> - 2008-02-27 21:19:28
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21993/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: - WalkForwardTesting\PairsTrading\PairsTradingMain.cs has been added - WalkForwardTesting\PairsTrading\PairsTradingStrategy.cs has been added - WalkForwardTesting\PairsTrading\InSample\PairsTradingFitnessEvaluator.cs has been added - WalkForwardTesting\PairsTrading\InSample\InSampleChoosers\Genetic\PairsTradingGeneticChooser.cs has been added - WalkForwardTesting\PairsTrading\Logging\PairsTradingLogItem.cs has been added Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** b7_Scripts.csproj 7 Feb 2008 18:30:28 -0000 1.83 --- b7_Scripts.csproj 27 Feb 2008 21:19:25 -0000 1.84 *************** *** 819,823 **** BuildAction = "Compile" /> ! <Folder RelPath = "WalkForwardTesting\PairsTrading\" /> <File RelPath = "WalkForwardTesting\WalkForwardLag\RunSimpleLag.cs" --- 819,847 ---- BuildAction = "Compile" /> ! <File ! RelPath = "WalkForwardTesting\PairsTrading\PairsTradingMain.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "WalkForwardTesting\PairsTrading\PairsTradingStrategy.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "WalkForwardTesting\PairsTrading\InSample\PairsTradingFitnessEvaluator.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "WalkForwardTesting\PairsTrading\InSample\InSampleChoosers\Genetic\PairsTradingGeneticChooser.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "WalkForwardTesting\PairsTrading\Logging\PairsTradingLogItem.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> <File RelPath = "WalkForwardTesting\WalkForwardLag\RunSimpleLag.cs" |