quantproject-developers Mailing List for QuantProject (Page 8)
Brought to you by:
glauco_1
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
(103) |
Dec
(67) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(52) |
Feb
(9) |
Mar
(69) |
Apr
(53) |
May
(80) |
Jun
(23) |
Jul
(24) |
Aug
(112) |
Sep
(9) |
Oct
|
Nov
(58) |
Dec
(93) |
| 2005 |
Jan
(90) |
Feb
(93) |
Mar
(61) |
Apr
(56) |
May
(37) |
Jun
(61) |
Jul
(55) |
Aug
(68) |
Sep
(25) |
Oct
(46) |
Nov
(41) |
Dec
(37) |
| 2006 |
Jan
(33) |
Feb
(7) |
Mar
(19) |
Apr
(27) |
May
(73) |
Jun
(49) |
Jul
(83) |
Aug
(66) |
Sep
(45) |
Oct
(16) |
Nov
(15) |
Dec
(7) |
| 2007 |
Jan
(14) |
Feb
(33) |
Mar
|
Apr
(21) |
May
|
Jun
(34) |
Jul
(18) |
Aug
(100) |
Sep
(39) |
Oct
(55) |
Nov
(12) |
Dec
(2) |
| 2008 |
Jan
(120) |
Feb
(133) |
Mar
(129) |
Apr
(104) |
May
(42) |
Jun
(2) |
Jul
(52) |
Aug
(99) |
Sep
(134) |
Oct
|
Nov
(137) |
Dec
(48) |
| 2009 |
Jan
(48) |
Feb
(55) |
Mar
(61) |
Apr
(3) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(51) |
Sep
|
Oct
(7) |
Nov
|
Dec
|
| 2010 |
Jan
(7) |
Feb
(1) |
Mar
(145) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(8) |
Dec
|
| 2011 |
Jan
(78) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(88) |
Sep
(6) |
Oct
(1) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:42:12
|
Update of /cvsroot/quantproject/QuantProject/t5_Testing In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv15447/t5_Testing Modified Files: QPTesting.csproj Log Message: b1_ADT\Econometrics\LinearRegressionWithoutCovarianceMatrix.cs has been added b1_ADT\LinearAlgebra\TestCholeskyDecomposition.cs has been added b1_ADT\LinearAlgebra\TestLowerTriangular.cs has been added b1_ADT\LinearAlgebra\TestMatrix.cs has been added b1_ADT\LinearAlgebra\TestPositiveDefiniteMatrix.cs has been added Index: QPTesting.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/t5_Testing/QPTesting.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** QPTesting.csproj 28 Mar 2010 17:23:06 -0000 1.3 --- QPTesting.csproj 6 Jan 2011 18:42:04 -0000 1.4 *************** *** 39,44 **** --- 39,49 ---- <Compile Include="a5_FakeImplementations\FakeHistoricalMarketValueProvider.cs" /> <Compile Include="AssemblyInfo.cs" /> + <Compile Include="b1_ADT\Econometrics\LinearRegressionWithoutCovarianceMatrix.cs" /> <Compile Include="b1_ADT\Econometrics\TestLinearRegression.cs" /> + <Compile Include="b1_ADT\LinearAlgebra\TestCholeskyDecomposition.cs" /> <Compile Include="b1_ADT\LinearAlgebra\TestLinearSystemSolver.cs" /> + <Compile Include="b1_ADT\LinearAlgebra\TestLowerTriangular.cs" /> + <Compile Include="b1_ADT\LinearAlgebra\TestMatrix.cs" /> + <Compile Include="b1_ADT\LinearAlgebra\TestPositiveDefiniteMatrix.cs" /> <Compile Include="b1_ADT\Sum.cs" /> <Compile Include="b3_data\Selectors\TestTickerSelector.cs" /> |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:40:35
|
Update of /cvsroot/quantproject/QuantProject/t5_Testing/b1_ADT/LinearAlgebra In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv14717 Added Files: TestPositiveDefiniteMatrix.cs Log Message: Test for the class QuantProject.ADT.LinearAlgebra.PositiveDefiniteMatrix --- NEW FILE: TestPositiveDefiniteMatrix.cs --- /* QuantProject - Quantitative Finance Library TestPositiveDefiniteMatrix.cs Copyright (C) 2011 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 NUnit.Framework; using QuantProject.ADT.LinearAlgebra; namespace QuantTesting.ADT.LinearAlgebra { [TestFixture] /// <summary> /// Test for the class QuantProject.ADT.LinearAlgebra.PositiveDefiniteMatrix /// </summary> public class TestPositiveDefiniteMatrix { public TestPositiveDefiniteMatrix() { } [Test] public void TestGetInverse() { double[,] positiveDefiniteMatrix = new double[ 3 , 3 ] { { 9 , -6 , 12 } , { -6 , 5 , -11 } , { 12 , -11 , 29 } }; double[,] inverse = PositiveDefiniteMatrix.GetInverse( positiveDefiniteMatrix ); // the inverse is // 2/3 7/6 1/6 // 7/6 13/4 3/4 // 1/6 3/4 1/4 Assert.AreEqual( 3 , inverse.GetLength( 0 ) ); Assert.AreEqual( 3 , inverse.GetLength( 1 ) ); Assert.AreEqual( 2.0/3.0 , inverse[ 0 , 0 ] , 0.00000001 ); Assert.AreEqual( 7.0/6.0 , inverse[ 0 , 1 ] , 0.00000001); Assert.AreEqual( 1.0/6.0 , inverse[ 0 , 2 ] , 0.00000001 ); Assert.AreEqual( 7.0/6.0 , inverse[ 1 , 0 ] , 0.00000001 ); Assert.AreEqual( 13.0/4.0 , inverse[ 1 , 1 ] ); Assert.AreEqual( 3.0/4.0 , inverse[ 1 , 2 ] ); Assert.AreEqual( 1.0/6.0 , inverse[ 2 , 0 ] , 0.00000001 ); Assert.AreEqual( 3.0/4.0 , inverse[ 2 , 1 ] ); Assert.AreEqual( 1.0/4.0 , inverse[ 2 , 2 ] ); } } } |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:40:14
|
Update of /cvsroot/quantproject/QuantProject/t5_Testing/b1_ADT/LinearAlgebra In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv14127 Added Files: TestMatrix.cs Log Message: Test for the class QuantProject.ADT.LinearAlgebra.Matrix --- NEW FILE: TestMatrix.cs --- /* QuantProject - Quantitative Finance Library TestLinearSystemSolver.cs Copyright (C) 2011 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 NUnit.Framework; using QuantProject.ADT.LinearAlgebra; namespace QuantTesting.ADT.LinearAlgebra { [TestFixture] /// <summary> /// Test for the class QuantProject.ADT.LinearAlgebra.Matrix /// </summary> public class TestMatrix { public TestMatrix() { } [Test] public void TestProductMatrixTimesVector() { double[,] x = new double[ 3 , 2 ] { { 1 , 2 } , { 3 , 4 } , { 5 , 6 } }; double[] y = new double[ 2 ] { 2 , 3 }; double[] product = Matrix.Multiply( x , y ); Assert.AreEqual( 8 , product[ 0 ] ); Assert.AreEqual( 18 , product[ 1 ] ); Assert.AreEqual( 28 , product[ 2 ] ); } [Test] public void TestTransposeTheFirstMatrixAndMultiply() { double[,] x = new double[ 2 , 3 ] { { 1 , 2 , 3 } , { 4 , 5 , 6 } }; double[,] y = new double[ 2 , 2 ] { { 1 , 2 } , { 3 , 4 } }; double[,] product = Matrix.TransposeTheFirstMatrixAndMultiply( x , y ); Assert.AreEqual( 3 , product.GetLength( 0 ) ); Assert.AreEqual( 2 , product.GetLength( 1 ) ); Assert.AreEqual( 13 , product[ 0 , 0 ] ); Assert.AreEqual( 18 , product[ 0 , 1 ] ); Assert.AreEqual( 17 , product[ 1 , 0 ] ); Assert.AreEqual( 24 , product[ 1 , 1 ] ); Assert.AreEqual( 21 , product[ 2 , 0 ] ); Assert.AreEqual( 30 , product[ 2 , 1 ] ); } [Test] public void TestTransposeTheSecondMatrixAndMultiply() { double[,] x = new double[ 2 , 2 ] { { 1 , 2 } , { -3 , 4 } }; double[,] y = new double[ 3 , 2 ] { { -1 , 5 } , { 3 , 2 } , { -1 , 6 } }; double[,] product = Matrix.TransposeTheSecondMatrixAndMultiply( x , y ); Assert.AreEqual( 2 , product.GetLength( 0 ) ); Assert.AreEqual( 3 , product.GetLength( 1 ) ); Assert.AreEqual( 9 , product[ 0 , 0 ] ); Assert.AreEqual( 7 , product[ 0 , 1 ] ); Assert.AreEqual( 11 , product[ 0 , 2 ] ); Assert.AreEqual( 23 , product[ 1 , 0 ] ); Assert.AreEqual( -1 , product[ 1 , 1 ] ); Assert.AreEqual( 27 , product[ 1 , 2 ] ); } } } |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:39:59
|
Update of /cvsroot/quantproject/QuantProject/t5_Testing/b1_ADT/LinearAlgebra In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv14028 Added Files: TestLowerTriangular.cs Log Message: Test for the class QuantProject.ADT.LinearAlgebra.LowerTriangular --- NEW FILE: TestLowerTriangular.cs --- /* QuantProject - Quantitative Finance Library TestLowerTriangular.cs Copyright (C) 2011 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 NUnit.Framework; using QuantProject.ADT.LinearAlgebra; namespace QuantTesting.ADT.LinearAlgebra { [TestFixture] /// <summary> /// Test for the class QuantProject.ADT.LinearAlgebra.LowerTriangular /// </summary> public class TestLowerTriangular { public TestLowerTriangular() { } [Test] public void TestGetInverse() { double[,] lowerTriangular = new double[ 3 , 3 ] { { 3 , 0 , 0 } , { -2 , 2 , 0 } , { 4 , -3 , 1 } }; double[,] inverse = LowerTriangular.GetInverse( lowerTriangular ); // the inverse is // 1/3 0 0 // 1/3 1/2 0 // -1/3 3/2 1 Assert.AreEqual( 3 , inverse.GetLength( 0 ) ); Assert.AreEqual( 3 , inverse.GetLength( 1 ) ); Assert.AreEqual( 0.33333333 , inverse[ 0 , 0 ] , 0.00000001 ); Assert.AreEqual( 0 , inverse[ 0 , 1 ] ); Assert.AreEqual( 0 , inverse[ 0 , 2 ] ); Assert.AreEqual( 0.33333333 , inverse[ 1 , 0 ] , 0.00000001 ); Assert.AreEqual( 0.5 , inverse[ 1 , 1 ] ); Assert.AreEqual( 0 , inverse[ 1 , 2 ] ); Assert.AreEqual( -0.33333333 , inverse[ 2 , 0 ] , 0.00000001 ); Assert.AreEqual( 1.5 , inverse[ 2 , 1 ] ); Assert.AreEqual( 1 , inverse[ 2 , 2 ] ); } } } |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:39:48
|
Update of /cvsroot/quantproject/QuantProject/t5_Testing/b1_ADT/LinearAlgebra In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv14000 Added Files: TestCholeskyDecomposition.cs Log Message: Test for the class QuantProject.ADT.LinearAlgebra.CholeskyDecomposition --- NEW FILE: TestCholeskyDecomposition.cs --- /* QuantProject - Quantitative Finance Library TestCholeskyDecomposition.cs Copyright (C) 2011 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 NUnit.Framework; using QuantProject.ADT.LinearAlgebra; namespace QuantTesting.ADT.LinearAlgebra { [TestFixture] /// <summary> /// Test for the class QuantProject.ADT.LinearAlgebra.CholeskyDecomposition /// </summary> public class TestCholeskyDecomposition { public TestCholeskyDecomposition() { } [Test] public void TestGetLowerTriangular() { double[,] positiveDefiniteMatrix = new double[ 3 , 3 ] { { 9 , -6 , 12 } , { -6 , 5 , -11 } , { 12 , -11 , 29 } }; double[,] lowerTriangular = CholeskyDecomposition.GetLowerTriangular( positiveDefiniteMatrix ); // the cholescky decomposition is // 3 0 0 // -2 1 0 // 4 -3 2 Assert.AreEqual( 3 , lowerTriangular.GetLength( 0 ) ); Assert.AreEqual( 3 , lowerTriangular.GetLength( 1 ) ); Assert.AreEqual( 3 , lowerTriangular[ 0 , 0 ] ); Assert.AreEqual( 0 , lowerTriangular[ 0 , 1 ] ); Assert.AreEqual( 0 , lowerTriangular[ 0 , 2 ] ); Assert.AreEqual( -2 , lowerTriangular[ 1 , 0 ] ); Assert.AreEqual( 1 , lowerTriangular[ 1 , 1 ] ); Assert.AreEqual( 0 , lowerTriangular[ 1 , 2 ] ); Assert.AreEqual( 4 , lowerTriangular[ 2 , 0 ] ); Assert.AreEqual( -3 , lowerTriangular[ 2 , 1 ] ); Assert.AreEqual( 2 , lowerTriangular[ 2 , 2 ] ); } } } |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:38:57
|
Update of /cvsroot/quantproject/QuantProject/t5_Testing/b1_ADT/Econometrics In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv13911 Added Files: LinearRegressionWithoutCovarianceMatrix.cs Log Message: Test for the class QuantProject.ADT.Econometrics.LinearRegressionWithoutCovarianceMatrix --- NEW FILE: LinearRegressionWithoutCovarianceMatrix.cs --- /* QuantProject - Quantitative Finance Library TestLinearRegressionWithoutCovarianceMatrix.cs Copyright (C) 2010 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 NUnit.Framework; using QuantProject.ADT.Econometrics; namespace QuantTesting.ADT.Econometrics { [TestFixture] /// <summary> /// Test for the class QuantProject.ADT.Econometrics.LinearRegressionWithoutCovarianceMatrix /// </summary> public class TestLinearRegressionWithoutCovarianceMatrix { [Test] public void TestMethod() { double[] y = new double[] { 20.10 , 13.30 , 24.40 , 24.95 }; double[,] X = new double[,] { { 1 , 1 , 4 } , { 1 , 3 , 1 } , { 1 , 5 , 3 } , { 1 , 7 , 2 } }; // double[,] X = new double[,] { // { 1 , 1 , 1 , 1 } , // { 1 , 3 , 5 , 7 } , // { 4 , 1 , 3 , 2 } }; // double[] weights = new double[] { 1 , 1 , 1 , 1 }; LinearRegressionWithoutCovarianceMatrix linearRegression = new LinearRegressionWithoutCovarianceMatrix(); linearRegression.RunRegression( y , X ); Assert.AreEqual( 3.728571429 , linearRegression.EstimatedCoefficients[ 0 ] , 0.00000001 ); Assert.AreEqual( 1.999404762 , linearRegression.EstimatedCoefficients[ 1 ] , 0.00000001 ); Assert.AreEqual( 3.58452381 , linearRegression.EstimatedCoefficients[ 2 ] , 0.00000001 ); Assert.AreEqual( 0.999876323 , linearRegression.CenteredRSquare , 0.0000000001 ); } } } |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:37:34
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv13605 Modified Files: Scripts_SD.csproj Log Message: WalkForwardTesting\LinearRegression\Logging\VirtualReturns\IVirtualReturnComputer.cs has been added WalkForwardTesting\LinearRegression\Logging\VirtualReturns\ReturnPredictor.cs has been added WalkForwardTesting\LinearRegression\Logging\VirtualReturns\PortfolioReturnComputer.cs has been added Index: Scripts_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/Scripts_SD.csproj,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** Scripts_SD.csproj 28 Mar 2010 16:19:56 -0000 1.43 --- Scripts_SD.csproj 6 Jan 2011 18:37:26 -0000 1.44 *************** *** 165,168 **** --- 165,171 ---- <Compile Include="WalkForwardTesting\LinearRegression\Logging\AnalyzerForLinearRegressionTestingPositions.cs" /> <Compile Include="WalkForwardTesting\LinearRegression\Logging\LinearRegressionLogItem.cs" /> + <Compile Include="WalkForwardTesting\LinearRegression\Logging\VirtualReturns\IVirtualReturnComputer.cs" /> + <Compile Include="WalkForwardTesting\LinearRegression\Logging\VirtualReturns\ReturnPredictor.cs" /> + <Compile Include="WalkForwardTesting\LinearRegression\Logging\VirtualReturns\PortfolioReturnComputer.cs" /> <Compile Include="WalkForwardTesting\LinearRegression\ReturnIntervals\ShiftedTimeIntervalSelectorForSignaling.cs" /> <Compile Include="WalkForwardTesting\LinearRegression\ReturnIntervals\SingleDayIntervalsSelector.cs" /> *************** *** 378,381 **** --- 381,385 ---- <Folder Include="WalkForwardTesting\LinearRegression\InSampleChoosers\FitnessEvaluation" /> <Folder Include="WalkForwardTesting\LinearRegression\Logging" /> + <Folder Include="WalkForwardTesting\LinearRegression\Logging\VirtualReturns" /> <Folder Include="WalkForwardTesting\LinearRegression\ReturnIntervals" /> <Folder Include="WalkForwardTesting\LinearRegression\Strategies" /> |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:36:01
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearRegression/Logging/VirtualReturns In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv13178/WalkForwardTesting/LinearRegression/Logging/VirtualReturns Added Files: ReturnPredictor.cs Log Message: Predicts a return using a linear regression estimated parameters --- NEW FILE: ReturnPredictor.cs --- /* QuantProject - Quantitative Finance Library ReturnPredictor.cs Copyright (C) 2010 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.Econometrics; using QuantProject.Business.DataProviders; using QuantProject.Business.Strategies; using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Strategies.ReturnsManagement.Time; namespace QuantProject.Scripts.WalkForwardTesting.LinearRegression { /// <summary> /// Predicts a return using a linear regression estimated parameters /// </summary> public class ReturnPredictor : IVirtualReturnComputer { private LinearRegressionTestingPositions linearRegressionTestingPositions; private IReturnIntervalSelectorForSignaling returnIntervalSelectorForSignaling; private IHistoricalMarketValueProvider historicalMarketValueProvider; public ReturnPredictor( LinearRegressionTestingPositions linearRegressionTestingPositions , IReturnIntervalSelectorForSignaling returnIntervalSelectorForSignaling , IHistoricalMarketValueProvider historicalMarketValueProvider ) { this.linearRegressionTestingPositions = linearRegressionTestingPositions; this.returnIntervalSelectorForSignaling = returnIntervalSelectorForSignaling; this.historicalMarketValueProvider = historicalMarketValueProvider; } #region ComputeReturn #region computeReturn #region getWeightedReturn #region getReturn private double getReturn( WeightedPositions signalingPortfolio , ReturnInterval signalingInterval ) { ReturnsManager returnsManager = new ReturnsManager( new ReturnIntervals( signalingInterval ) , this.historicalMarketValueProvider ); double portfolioReturn = signalingPortfolio.GetReturn( 0 , returnsManager ); return portfolioReturn; } #endregion getReturn private double getWeightedReturn( int signalingPortfolioIndex , WeightedPositions signalingPortfolio , ReturnInterval signalingInterval ) { double coefficient = this.linearRegressionTestingPositions.LinearRegression.EstimatedCoefficients[ signalingPortfolioIndex + 1 ]; double portfolioReturn = this.getReturn( signalingPortfolio , signalingInterval ); double weightedReturn = coefficient * portfolioReturn; return weightedReturn; } #endregion getWeightedReturn private double computeReturn( ReturnInterval signalingInterval ) { QuantProject.ADT.Econometrics.ILinearRegression linearRegression = this.linearRegressionTestingPositions.LinearRegression; WeightedPositions[] signalingPortfolios = this.linearRegressionTestingPositions.SignalingPortfolios; // double predictedReturn = linearRegression.EstimatedCoefficients[ 0 ]; double predictedReturn = 0; for( int i = 0 ; i < linearRegressionTestingPositions.SignalingPortfolios.Length ; i++ ) predictedReturn += this.getWeightedReturn( i , signalingPortfolios[ i ] , signalingInterval ); return predictedReturn; } #endregion computeReturn public double ComputeReturn( ReturnInterval returnInterval ) { ReturnInterval signalingInterval = this.returnIntervalSelectorForSignaling.GetReturnIntervalUsedForSignaling( returnInterval ); double predictedReturn = this.computeReturn( signalingInterval ); return predictedReturn; } #endregion ComputeReturn } } |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:35:44
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearRegression/Logging/VirtualReturns In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv13148/WalkForwardTesting/LinearRegression/Logging/VirtualReturns Added Files: PortfolioReturnComputer.cs Log Message: Computes a return for a given portfolio --- NEW FILE: PortfolioReturnComputer.cs --- /* QuantProject - Quantitative Finance Library PortfolioReturnComputer.cs Copyright (C) 2010 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.Strategies; using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Strategies.ReturnsManagement.Time; using QuantProject.Business.DataProviders; namespace QuantProject.Scripts.WalkForwardTesting.LinearRegression { /// <summary> /// Computes a return for a given portfolio /// </summary> public class PortfolioReturnComputer : IVirtualReturnComputer { private WeightedPositions portfolio; private IHistoricalMarketValueProvider historicalMarketValueProvider; public PortfolioReturnComputer( WeightedPositions portfolio , IHistoricalMarketValueProvider historicalMarketValueProvider ) { this.portfolio = portfolio; this.historicalMarketValueProvider = historicalMarketValueProvider; } #region ComputeReturn private ReturnsManager getReturnsManager( ReturnInterval returnInterval ) { ReturnIntervals returnIntervals = new ReturnIntervals( returnInterval ); ReturnsManager returnsManager = new ReturnsManager( returnIntervals , this.historicalMarketValueProvider ); return returnsManager; } public double ComputeReturn( ReturnInterval returnInterval ) { ReturnsManager returnsManager = this.getReturnsManager( returnInterval ); double predictedReturn = this.portfolio.GetReturn( 0 , returnsManager ); return predictedReturn; } #endregion ComputeReturn } } |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:34:54
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearRegression/Logging/VirtualReturns In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv12696 Added Files: IVirtualReturnComputer.cs Log Message: Interface to be implemented by those classes that compute a virtual return for a portfolio, a model, etc. --- NEW FILE: IVirtualReturnComputer.cs --- /* QuantProject - Quantitative Finance Library IVirtualReturnComputer.cs Copyright (C) 2010 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.Strategies.ReturnsManagement.Time; namespace QuantProject.Scripts.WalkForwardTesting.LinearRegression { /// <summary> /// Interface to be implemented by those classes that compute a /// virtual return for a portfolio, a model, etc. /// </summary> public interface IVirtualReturnComputer { double ComputeReturn( ReturnInterval returnInterval ); } } |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:33:45
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearRegression/Logging/VirtualReturns In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv12442/VirtualReturns Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearRegression/Logging/VirtualReturns added to the repository |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:31:26
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Econometrics In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv12057/b1_ADT/Econometrics Modified Files: LinearRegression.cs Log Message: Computes a Linear Regression with covariance matrix and ANOVA (ANalysis Of VAriance) Index: LinearRegression.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Econometrics/LinearRegression.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LinearRegression.cs 27 Mar 2010 17:06:57 -0000 1.1 --- LinearRegression.cs 6 Jan 2011 18:31:18 -0000 1.2 *************** *** 3,7 **** LinearRegression.cs ! Copyright (C) 2010 Glauco Siliprandi --- 3,7 ---- LinearRegression.cs ! Copyright (C) 2011 Glauco Siliprandi *************** *** 28,36 **** { /// <summary> ! /// Computes a Linear Regression /// </summary> [Serializable] public class LinearRegression : ILinearRegression { private double sumOfSquareResiduals; private double centeredTotalSumOfSquares; --- 28,38 ---- { /// <summary> ! /// Computes a Linear Regression with covariance matrix ! /// and ANOVA (ANalysis Of VAriance) /// </summary> [Serializable] public class LinearRegression : ILinearRegression { + private double[,] covarianceMatrix; // (XTransposeX)^-1 private double sumOfSquareResiduals; private double centeredTotalSumOfSquares; *************** *** 81,97 **** return xTransposeX; } ! private double[] getXtransposeY( double[] y , double[,] X ) ! { ! int n = y.Length; ! int k = X.GetLength( 1 ); ! double[] xTransposeY = new double[ k ]; ! for( int j = 0 ; j < k ; j++ ) ! { ! xTransposeY[ j ] = 0; ! for( int t = 0 ; t < n ; t++ ) ! xTransposeY[ j ] += X[ t , j ] * y[ t ]; ! } ! return xTransposeY; ! } #region computeRSquare --- 83,99 ---- return xTransposeX; } ! // private double[] getXtransposeY( double[] y , double[,] X ) ! // { ! // int n = y.Length; ! // int k = X.GetLength( 1 ); ! // double[] xTransposeY = new double[ k ]; ! // for( int j = 0 ; j < k ; j++ ) ! // { ! // xTransposeY[ j ] = 0; ! // for( int t = 0 ; t < n ; t++ ) ! // xTransposeY[ j ] += X[ t , j ] * y[ t ]; ! // } ! // return xTransposeY; ! // } #region computeRSquare *************** *** 158,164 **** this.runRegression_checkParameters( regressand , regressors ); double[,] xTransposeX = this.getXtransposeX( regressors ); ! double[] xTransposeY = this.getXtransposeY( regressand , regressors ); ! this.estimatedCoefficients = LinearSystemSolver.FindSolution( ! xTransposeX , xTransposeY ); this.computeCenteredRSquare( regressand , regressors ); } --- 160,168 ---- this.runRegression_checkParameters( regressand , regressors ); double[,] xTransposeX = this.getXtransposeX( regressors ); ! this.covarianceMatrix = PositiveDefiniteMatrix.GetInverse( xTransposeX ); ! double[,] xTransposeXInverseXTranspose = ! Matrix.TransposeTheSecondMatrixAndMultiply( this.covarianceMatrix , regressors ); ! // double[] xTransposeY = this.getXtransposeY( regressand , regressors ); ! this.estimatedCoefficients = Matrix.Multiply( xTransposeXInverseXTranspose , regressand ); this.computeCenteredRSquare( regressand , regressors ); } |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:30:38
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11989/b1_ADT Modified Files: ADT_SD.csproj Log Message: Econometrics\LinearRegressionWithoutCovarianceMatrix.cs has been added LinearAlgebra\CholeskyDecomposition.cs has been added LinearAlgebra\LowerTriangular.cs has been added LinearAlgebra\Matrix.cs has been added LinearAlgebra\PositiveDefiniteMatrix.cs has been added Index: ADT_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ADT_SD.csproj,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ADT_SD.csproj 27 Mar 2010 17:10:32 -0000 1.14 --- ADT_SD.csproj 6 Jan 2011 18:30:30 -0000 1.15 *************** *** 50,58 **** --- 50,63 ---- <Compile Include="ConstantsProvider.cs" /> <Compile Include="Econometrics\ILinearRegression.cs" /> + <Compile Include="Econometrics\LinearRegressionWithoutCovarianceMatrix.cs" /> <Compile Include="Econometrics\LinearRegression.cs" /> <Compile Include="ExtendedDataTable.cs" /> <Compile Include="ExtendedDateTime.cs" /> <Compile Include="HashProvider.cs" /> + <Compile Include="LinearAlgebra\CholeskyDecomposition.cs" /> <Compile Include="LinearAlgebra\LinearSystemSolver.cs" /> + <Compile Include="LinearAlgebra\LowerTriangular.cs" /> + <Compile Include="LinearAlgebra\Matrix.cs" /> + <Compile Include="LinearAlgebra\PositiveDefiniteMatrix.cs" /> <Compile Include="Optimizing\BruteForce\BestParametersManager.cs" /> <Compile Include="Optimizing\BruteForce\ParametersManagers\BruteForceOptimizableParametersManagerWithoutEquivalentsAsTopBestParameters.cs" /> |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:25:37
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/LinearAlgebra In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv10786 Added Files: PositiveDefiniteMatrix.cs Log Message: Provides static methods for positive definite matrices --- NEW FILE: PositiveDefiniteMatrix.cs --- /* * Created by SharpDevelop. * User: Glauco * Date: 30/12/2010 * Time: 19.05 * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; namespace QuantProject.ADT.LinearAlgebra { /// <summary> /// Provides static methods for positive definite matrices /// </summary> public class PositiveDefiniteMatrix { public PositiveDefiniteMatrix() { } #region Invert private static double[,] getInverse( double[,] lowerTriangular ) { double[,] lowerTriangularInverse = LowerTriangular.GetInverse( lowerTriangular ); double[,] inverse = Matrix.TransposeTheFirstMatrixAndMultiply( lowerTriangularInverse , lowerTriangularInverse ); return inverse; } /// <summary> /// inverts a positive definite matrix /// </summary> /// <param name="positiveDefiniteMatrix"></param> /// <returns></returns> public static double[,] GetInverse( double[,] positiveDefiniteMatrix ) { double[,] lowerTriangular = CholeskyDecomposition.GetLowerTriangular( positiveDefiniteMatrix ); double[,] inverse = PositiveDefiniteMatrix.getInverse( lowerTriangular ); return inverse; } #endregion Invert } } |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:25:14
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/LinearAlgebra In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv10310 Added Files: Matrix.cs Log Message: Provides methods for matrix algebra --- NEW FILE: Matrix.cs --- /* QuantProject - Quantitative Finance Library Matrix.cs Copyright (C) 2011 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; namespace QuantProject.ADT.LinearAlgebra { /// <summary> /// Provides methods for matrix algebra /// </summary> public class Matrix { public Matrix() { } #region Multiply /// <summary> /// multiplies a matrix times a vector, and returns a vector /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public static double[] Multiply( double[,] x , double[] y ) { if ( x.GetLength( 1 ) != y.Length ) throw new Exception( "x and y are not conformable!" ); int n = y.Length; int k = x.GetLength( 0 ); double[] xTimesY = new double[ k ]; for( int j = 0 ; j < k ; j++ ) { xTimesY[ j ] = 0; for( int t = 0 ; t < n ; t++ ) xTimesY[ j ] += x[ j , t ] * y[ t ]; } return xTimesY; } #endregion Multiply /// <summary> /// returns xTranspose times y /// </summary> /// <param name="x">its transpose multiplies y</param> /// <param name="y">it's tpremultiplied by x transpose</param> /// <returns></returns> public static double[,] TransposeTheFirstMatrixAndMultiply( double[,] x , double [,] y ) { if ( x.GetLength( 0 ) != y.GetLength( 0 ) ) throw new Exception( "x and y are not conformable!" ); // x is k x m, y is k x n int m = x.GetLength( 1 ); int k = x.GetLength( 0 ); int n = y.GetLength( 1 ); double[,] xTransposeTimesY = new double[ m , n ]; for( int i = 0 ; i < m ; i++ ) for( int j = 0 ; j < n ; j++ ) { double innerProduct = 0; for( int t = 0 ; t < k ; t++ ) innerProduct += x[ t , i ] * y[ t , j ]; xTransposeTimesY[ i , j ] = innerProduct; } return xTransposeTimesY; } /// <summary> /// returns x times yTranspose /// </summary> /// <param name="x">multiplies the transpose of y</param> /// <param name="y">it's transposed and then premultiplied by x</param> /// <returns></returns> public static double[,] TransposeTheSecondMatrixAndMultiply( double[,] x , double [,] y ) { if ( x.GetLength( 1 ) != y.GetLength( 1 ) ) throw new Exception( "x and y are not conformable!" ); // x is m x k, y is n x k int m = x.GetLength( 0 ); int k = x.GetLength( 1 ); int n = y.GetLength( 0 ); double[,] xTimesYTranspose = new double[ m , n ]; for( int i = 0 ; i < m ; i++ ) for( int j = 0 ; j < n ; j++ ) { double innerProduct = 0; for( int t = 0 ; t < k ; t++ ) innerProduct += x[ i , t ] * y[ j , t ]; xTimesYTranspose[ i , j ] = innerProduct; } return xTimesYTranspose; } } } |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:24:36
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/LinearAlgebra In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv10182 Added Files: LowerTriangular.cs Log Message: Provides static methods for lower triangular matrices --- NEW FILE: LowerTriangular.cs --- /* QuantProject - Quantitative Finance Library LowerTriangular.cs Copyright (C) 2011 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; namespace QuantProject.ADT.LinearAlgebra { /// <summary> /// Provides static methods for lower triangular matrices /// </summary> public class LowerTriangular { public LowerTriangular() { } #region GetInverse /// <summary> /// returnes the inverse of the given lower kxk triangular matrix /// </summary> /// <param name="lowerTriangular"></param> static public double[,] GetInverse( double[,] lowerTriangular ) { int k = lowerTriangular.GetLength( 0 ); double[,] inverse = new double[ k , k ]; for( int column = 0 ; column < k ; column++ ) { if ( lowerTriangular[ column , column ] == 0 ) throw new Exception( "lowerTriangular is a singular matrix!" ); inverse[ column , column ] = 1 / lowerTriangular[ column , column ]; for( int row = column + 1 ; row < k ; row++ ) { double numerator = 0; for( int h = column ; h < row ; h++ ) numerator += lowerTriangular[ row , h ] * inverse[ h , column ]; if ( lowerTriangular[ row , row ] == 0 ) throw new Exception( "lowerTriangular is a singular matrix!" ); inverse[ row , column ] = - numerator / lowerTriangular[ row , row ]; } } return inverse; } #endregion GetInverse } } |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:24:06
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/LinearAlgebra In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv10127 Added Files: CholeskyDecomposition.cs Log Message: Takes a positive definite matrix and returns it's decomposition in the form LL^T, with L lower triangular --- NEW FILE: CholeskyDecomposition.cs --- /* QuantProject - Quantitative Finance Library CholeskyDecomposition.cs Copyright (C) 2011 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; namespace QuantProject.ADT.LinearAlgebra { /// <summary> /// Takes a positive definite matrix and returns it's decomposition in the form LL^T, /// with L lower triangular /// </summary> public class CholeskyDecomposition { public CholeskyDecomposition() { } #region GetLowerTriangular public static double[,] GetLowerTriangular( double[,] positiveDefiniteMatrix ) { int k = positiveDefiniteMatrix.GetLength( 0 ); double[,] lowerTriangular = new double[ k , k ]; for( int column = 0 ; column < k ; column++ ) { // computes lowerTriangular[ column , column ] double partialSum = 0; for( int j = 0 ; j < column ; j++ ) partialSum += lowerTriangular[ column , j ] * lowerTriangular[ column , j ]; double numberToBeRootSquared = positiveDefiniteMatrix[ column , column ] - partialSum; if ( numberToBeRootSquared <= 0 ) throw new Exception( "positiveDefiniteMatrix is actually not positive definite" ); lowerTriangular[ column , column ] = Math.Sqrt( numberToBeRootSquared ); // computes entries below lowerTriangular[ column , column ] for( int i = column + 1 ; i < k ; i++ ) { double partialSumB = 0; for( int j = 0 ; j < column ; j++ ) partialSumB += lowerTriangular[ i , j ] * lowerTriangular[ column , j ]; lowerTriangular[ i , column ] = ( positiveDefiniteMatrix[ i , column ] - partialSumB ) / lowerTriangular[ column , column ]; } } return lowerTriangular; } #endregion GetLowerTriangular } } |
|
From: Glauco S. <gla...@us...> - 2011-01-06 18:19:21
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Econometrics In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv8973 Added Files: LinearRegressionWithoutCovarianceMatrix.cs Log Message: Deprecated version of Linear Regression estimator (in the future, it will probably be removed from the project) --- NEW FILE: LinearRegressionWithoutCovarianceMatrix.cs --- /* QuantProject - Quantitative Finance Library LinearRegressionWithoutCovarianceMatrix.cs Copyright (C) 2010 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.LinearAlgebra; namespace QuantProject.ADT.Econometrics { /// <summary> /// Computes a Linear Regression, but it doesn't provide ANOVA (ANalysis Of VAriance) /// </summary> [Serializable] public class LinearRegressionWithoutCovarianceMatrix : ILinearRegression { private double sumOfSquareResiduals; private double centeredTotalSumOfSquares; private double[] estimatedCoefficients; public double[] EstimatedCoefficients { get { if ( this.estimatedCoefficients == null ) throw new Exception( "The method RunRegression() must be invoked before " + "reading this property!" ); return this.estimatedCoefficients; } } private double centeredRSquare; public double CenteredRSquare { get { return this.centeredRSquare; } } public LinearRegressionWithoutCovarianceMatrix() { } #region RunRegression private void runRegression_checkParameters( double[] regressand , double[,] regressors ) { if ( regressand.Length != regressors.GetLength( 0 ) ) throw new Exception( "The regressand doesn't have the same number of observations as " + "the regressors!" ); } private double[,] getXtransposeX( double[,] X ) { int n = X.GetLength( 0 ); int k = X.GetLength( 1 ); double[,] xTransposeX = new double[ k , k ]; for( int i = 0 ; i < k ; i++ ) for( int j = 0 ; j < k ; j++ ) { xTransposeX[ i , j ] = 0; for( int t = 0 ; t < n ; t++ ) xTransposeX[ i , j ] += X[ t , i ] * X[ t , j ]; } return xTransposeX; } private double[] getXtransposeY( double[] y , double[,] X ) { int n = y.Length; int k = X.GetLength( 1 ); double[] xTransposeY = new double[ k ]; for( int j = 0 ; j < k ; j++ ) { xTransposeY[ j ] = 0; for( int t = 0 ; t < n ; t++ ) xTransposeY[ j ] += X[ t , j ] * y[ t ]; } return xTransposeY; } #region computeRSquare private double getYBar( double[] regressand ) { double yBar = 0; for( int i = 0 ; i < regressand.Length ; i++ ) yBar += regressand[ i ]; yBar = yBar / regressand.Length; return yBar; } #region getYHat private double getYHat( double[] regressand , double[,] regressors , int i ) { double returnValue = 0; for( int j = 0 ; j < regressors.GetLength( 1 ) ; j++ ) returnValue += this.estimatedCoefficients[ j ] * regressors[ i , j ]; return returnValue; } private double[] getYHat( double[] regressand , double[,] regressors ) { double[] yHat = new double[ regressand.Length ]; for( int i = 0 ; i < regressand.Length ; i++ ) yHat[ i ] = this.getYHat( regressand , regressors , i ); return yHat; } #endregion getYHat private void setSumOfSquareResidualsAndCenteredTotalSumOfSquares( double[] regressand , double[,] regressors , double yBar , double[] yHat ) { this.sumOfSquareResiduals = 0; this.centeredTotalSumOfSquares = 0; for( int i = 0 ; i < regressand.Length ; i++ ) { this.sumOfSquareResiduals += ( yHat[ i ] - regressand[ i ] ) * ( yHat[ i ] - regressand[ i ] ); this.centeredTotalSumOfSquares += ( regressand[ i ] - yBar ) * ( regressand[ i ] - yBar ); } } private void setSumOfSquareResidualsAndCenteredTotalSumOfSquares( double[] regressand , double[,] regressors ) { double yBar = this.getYBar( regressand ); double[] yHat = this.getYHat( regressand , regressors ); this.setSumOfSquareResidualsAndCenteredTotalSumOfSquares( regressand , regressors , yBar , yHat ); } private void computeCenteredRSquare( double[] regressand , double[,] regressors ) { this.setSumOfSquareResidualsAndCenteredTotalSumOfSquares( regressand , regressors); this.centeredRSquare = 1 - this.sumOfSquareResiduals / this.centeredTotalSumOfSquares; } #endregion computeRSquare public void RunRegression( double[] regressand , double[,] regressors ) { this.runRegression_checkParameters( regressand , regressors ); double[,] xTransposeX = this.getXtransposeX( regressors ); double[] xTransposeY = this.getXtransposeY( regressand , regressors ); this.estimatedCoefficients = LinearSystemSolver.FindSolution( xTransposeX , xTransposeY ); this.computeCenteredRSquare( regressand , regressors ); } #endregion RunRegression } } |
|
From: Marco M. <mi...@us...> - 2010-11-20 19:01:08
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv28321 Added Files: FinancialValues.cs Log Message: Added FinancialValues class, for accessing the FinancialValues table in DB --- NEW FILE: FinancialValues.cs --- /* QuantProject - Quantitative Finance Library FinancialValues.cs Copyright (C) 2010 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 QuantProject.DataAccess; namespace QuantProject.DataAccess.Tables { /// <summary> /// Class to access the financialValues table /// </summary> public class FinancialValues { private DataTable financialValues; /// <summary> /// Gets the ticker whose financials are contained into the FinancialValues object /// </summary> /// <returns></returns> public string Ticker { get{ return ((string)this.financialValues.Rows[ 0 ][ "fvTiTicker" ]); } } public FinancialValues( string ticker, int periodLengthInMonths) { this.financialValues = FinancialValues.GetTickerFinancialValues( ticker, periodLengthInMonths ); } /// <summary> /// It provides addition of the given financial values into table "financial values" /// </summary> public static void Add( string ticker, int financialDataCode, int sourceCode, DateTime endingPeriodDate, int periodLengthInMonths, double financialValue, DateTime downloadDate) { try { SqlExecutor.ExecuteNonQuery("INSERT INTO financialValues(fvTiTicker, fvFdId, fvFsId, " + "fvEndingPeriodDate, fvPeriodLengthInMonths, " + "fvValue, fvDownloadDate) " + "VALUES('" + ticker + "', " + financialDataCode + ", " + sourceCode + ", " + SQLBuilder.GetDateConstant(endingPeriodDate) + ", " + periodLengthInMonths + ", " + financialValue + ", " + SQLBuilder.GetDateConstant(downloadDate) + ")"); } catch(Exception ex) { string notUsed = ex.ToString(); } } /// <summary> /// returns the financial values DataTable for the given ticker /// </summary> public static DataTable GetTickerFinancialValues( string instrumentKey, int periodLengthInMonths ) { string sql = "select * from financialValues where fvTiTicker='" + instrumentKey + "' " + "and fvPeriodLengthInMonths= " + periodLengthInMonths + " order by fvEndingPeriodDate"; return SqlExecutor.GetDataTable( sql ); } #region SetDataTable for tickerList // private static string setDataTable_getTickerListWhereClause_getSingleTickerWhereClause( // string ticker ) // { // return "(" + FinancialValues.TickerFieldName + "='" + ticker + "')"; // } // private static string setDataTable_getTickerListWhereClause( ICollection tickerCollection ) // { // string returnValue = ""; // foreach (string ticker in tickerCollection) // if ( returnValue == "" ) // // this is the first ticker to handle // returnValue += setDataTable_getTickerListWhereClause_getSingleTickerWhereClause( ticker ); // else // // this is not the first ticker to handle // returnValue += " or " + // setDataTable_getTickerListWhereClause_getSingleTickerWhereClause( ticker ); // return "( " + returnValue + " )"; // } // /// <summary> // /// Builds a Quotes data table containing a row for each ticker in the // /// collection, with the quotes for the given DateTime // /// </summary> // /// <param name="tickerCollection">Tickers whose quotes are to be fetched</param> // /// <param name="dateTime">Date for the quotes to be fetched</param> // /// <param name="dataTable">Output parameter</param> // public static void SetDataTable( ICollection tickerCollection , DateTime dateTime , DataTable dataTable) // { // string sql; // sql = "select * from quotes " + // "where " + setDataTable_getTickerListWhereClause( tickerCollection ) + // " and " + FinancialValues.Date + "=" + SQLBuilder.GetDateConstant( dateTime ) + " " + // "order by " + FinancialValues.TickerFieldName; // // SqlExecutor.SetDataTable( sql , dataTable ); // } #endregion } } |
|
From: Marco M. <mi...@us...> - 2010-11-20 18:59:22
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv27726/Eligibles Modified Files: EligibleTickers.cs Log Message: Added SourceDataTable property, for providing the data Table used for getting the current EligibleTickers istance Index: EligibleTickers.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles/EligibleTickers.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EligibleTickers.cs 28 Mar 2010 14:12:36 -0000 1.4 --- EligibleTickers.cs 20 Nov 2010 18:59:15 -0000 1.5 *************** *** 47,51 **** } } ! public EligibleTickers( ICollection<string> tickers ) { --- 47,62 ---- } } ! private DataTable sourceDataTable; ! /// <summary> ! /// Returns the dataTable that has been used for ! /// the construction of the given instance ! /// </summary> ! public DataTable SourceDataTable ! { ! get ! { ! return this.sourceDataTable; ! } ! } public EligibleTickers( ICollection<string> tickers ) { *************** *** 61,64 **** --- 72,76 ---- public EligibleTickers( DataTable dtTickers ) { + this.sourceDataTable = dtTickers; this.addTickers( dtTickers ); } |
|
From: Marco M. <mi...@us...> - 2010-11-20 18:57:16
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/EquityEvaluation In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv27491/EquityEvaluation Added Files: Variance.cs Log Message: Added Variance class. It evaluates equity just through variance --- NEW FILE: Variance.cs --- /* QuantProject - Quantitative Finance Library Variance.cs Copyright (C) 2010 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.Statistics; namespace QuantProject.Business.Strategies.EquityEvaluation { /// <summary> /// Equity line evaluator, simply measuring the variance /// </summary> [Serializable] public class Variance : IEquityEvaluator { public string Description { get { return "EqEvltr_Var"; } } public Variance() { // // TODO: Add constructor logic here // } public float GetReturnsEvaluation( float[] returns ) { return Convert.ToSingle( BasicFunctions.Variance( returns ) ); } } } |
|
From: Marco M. <mi...@us...> - 2010-11-20 18:55:49
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv27344/Eligibles Added Files: ByMostDiscountedPrices.cs Log Message: Added ByMostDiscountedPrices. It implements IEligiblesSelector in order to retrieve tickers that have the most discounted prices with respect to a given IFairValueProvider (based fundamentals) --- NEW FILE: ByMostDiscountedPrices.cs --- /* QuantProject - Quantitative Finance Library ByMostDiscountedPrices.cs Copyright (C) 2010 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 QuantProject.ADT; using QuantProject.ADT.Histories; using QuantProject.ADT.Messaging; using QuantProject.Data.DataTables; using QuantProject.Data.Selectors; using QuantProject.Business.Financial.Fundamentals; namespace QuantProject.Business.Strategies.Eligibles { /// <summary> /// Implements IEligiblesSelector for selecting a given max number of tickers through /// the following step-by-step selecting process: /// -step 1: all tickers belonging to a given group /// are selected (the group can be "temporized": that is tickers /// are returned depending on the time the selection is requested: /// the group SP 500 should be like that); /// -step 2: from tickers selected by step 1, the ones /// (not more than a given max number) that have /// the greatest (negative) relative difference between the current price /// and the fair price; /// </summary> [Serializable] public class ByMostDiscountedPrices : IEligiblesSelector { public event NewMessageEventHandler NewMessage; private bool temporizedGroup; private string tickersGroupID; private int maxNumberOfEligibleTickersToBeChosen; private int numOfDaysForFundamentalAnalysis; private IFairValueProvider fairValueProvider; public string Description { get{ return "From_" + this.tickersGroupID + " (temporized: " + this.temporizedGroup.ToString() + ")\n" + "MaxNumOfEligibles_" + this.maxNumberOfEligibleTickersToBeChosen.ToString() + "\n" + "Most discounted price with respect to a given IFairPriceEvaluator"; } } public ByMostDiscountedPrices(IFairValueProvider fairValueProvider, string tickersGroupID , bool temporizedGroup, int maxNumberOfEligibleTickersToBeChosen, int numOfDaysForFundamentalAnalysis) { this.fairValueProvider = fairValueProvider; this.temporizedGroup = temporizedGroup; this.maxNumberOfEligibleTickersToBeChosen = maxNumberOfEligibleTickersToBeChosen; this.tickersGroupID = tickersGroupID; this.numOfDaysForFundamentalAnalysis = numOfDaysForFundamentalAnalysis; } private EligibleTickers getEligibleTickers_actually_getTableOfMostDiscountedTickers( DataTable initialTableFromWhichToChooseTheMostDiscountedTickers, DateTime date ) { DataTable tableOfEligibleTickers; if(!initialTableFromWhichToChooseTheMostDiscountedTickers.Columns.Contains("FairPrice")) initialTableFromWhichToChooseTheMostDiscountedTickers.Columns.Add("FairPrice", System.Type.GetType("System.Double")); if(!initialTableFromWhichToChooseTheMostDiscountedTickers.Columns.Contains("MarketPrice")) initialTableFromWhichToChooseTheMostDiscountedTickers.Columns.Add("LastMonthAverageMarketPrice", System.Type.GetType("System.Double")); if(!initialTableFromWhichToChooseTheMostDiscountedTickers.Columns.Contains("RelativeDifferenceBetweenFairAndMarketPrice")) initialTableFromWhichToChooseTheMostDiscountedTickers.Columns.Add("RelativeDifferenceBetweenFairAndMarketPrice", System.Type.GetType("System.Double")); foreach(DataRow row in initialTableFromWhichToChooseTheMostDiscountedTickers.Rows) { row["FairPrice"] = this.fairValueProvider.GetFairValue( (string)row[0], date.AddDays(-this.numOfDaysForFundamentalAnalysis), date ); float[] lastMonthQuotes = Quotes.GetArrayOfAdjustedCloseQuotes((string)row[0], date.AddDays(-30), date); row["LastMonthAverageMarketPrice"] = ADT.Statistics.BasicFunctions.SimpleAverage(lastMonthQuotes); row["RelativeDifferenceBetweenFairAndMarketPrice"] = ((double)row["FairPrice"]-(double)row["LastMonthAverageMarketPrice"])/(double)row["FairPrice"]; } tableOfEligibleTickers = ExtendedDataTable.CopyAndSort(initialTableFromWhichToChooseTheMostDiscountedTickers, "RelativeDifferenceBetweenFairAndMarketPrice", true); ExtendedDataTable.DeleteRows(tableOfEligibleTickers, this.maxNumberOfEligibleTickersToBeChosen); DataColumn[] columnPrimaryKeys = new DataColumn[1]; columnPrimaryKeys[0] = tableOfEligibleTickers.Columns[0]; tableOfEligibleTickers.PrimaryKey = columnPrimaryKeys; return new EligibleTickers(tableOfEligibleTickers); } private EligibleTickers getEligibleTickers_actually( History history ) { DateTime currentDate = history.LastDateTime; SelectorByGroup group; if(this.temporizedGroup) //the group is "temporized": returned set of tickers // depend on time group = new SelectorByGroup(this.tickersGroupID, currentDate); else//the group is not temporized group = new SelectorByGroup(this.tickersGroupID); DataTable tickersFromGroup = group.GetTableOfSelectedTickers(); return this.getEligibleTickers_actually_getTableOfMostDiscountedTickers(tickersFromGroup, currentDate); } private void getEligibleTickers_sendNewMessage( EligibleTickers eligibleTickers ) { string message = "Number of Eligible tickers: " + eligibleTickers.Count; NewMessageEventArgs newMessageEventArgs = new NewMessageEventArgs( message ); if(this.NewMessage != null) this.NewMessage( this , newMessageEventArgs ); } /// <summary> /// Returns the eligible tickers /// </summary> /// <returns></returns> public EligibleTickers GetEligibleTickers( History history ) { EligibleTickers eligibleTickers = this.getEligibleTickers_actually( history ); this.getEligibleTickers_sendNewMessage( eligibleTickers ); return eligibleTickers; } } } |
|
From: Marco M. <mi...@us...> - 2010-11-20 18:51:35
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/FitnessEvaluation In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv26480/Optimizing/FitnessEvaluation Added Files: BuyAndHoldFitnessEvaluator.cs Log Message: Added BuyAndHoldFitnessEvaluator --- NEW FILE: BuyAndHoldFitnessEvaluator.cs --- /* QuantProject - Quantitative Finance Library BuyAndHoldFitnessEvaluator.cs Copyright (C) 2010 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; using QuantProject.Business.Strategies; using QuantProject.Business.Strategies.OutOfSample; using QuantProject.Business.Strategies.Optimizing.FitnessEvaluation; using QuantProject.Business.Strategies.EquityEvaluation; using QuantProject.Business.Strategies.ReturnsManagement; namespace QuantProject.Business.Strategies.Optimizing.FitnessEvaluation { /// <summary> /// Implements IFitnessEvaluator interface for the /// basic strategy of buying and holding a portofolio /// (represented, normally, by a TestingPositions /// passed to the GetFitnessValue method) /// </summary> [Serializable] public class BuyAndHoldFitnessEvaluator : IFitnessEvaluator { private IEquityEvaluator strategyEquityEvaluator; public string Description { get { string description = "FitnessEvaluatedWith_" + this.strategyEquityEvaluator.GetType().ToString(); return description; } } public BuyAndHoldFitnessEvaluator(IEquityEvaluator strategyEquityEvaluator) { this.strategyEquityEvaluator = strategyEquityEvaluator; } private float getFitnessValue_getFitnessValueActually( TestingPositions testingPositions, IReturnsManager returnsManager ) { float fitnessValue; float[] returns = testingPositions.WeightedPositions.GetReturns(returnsManager); fitnessValue = this.strategyEquityEvaluator.GetReturnsEvaluation(returns); if( double.IsNaN(fitnessValue) ) fitnessValue = 0; return fitnessValue; } public double GetFitnessValue(object meaning , IReturnsManager returnsManager ) { float fitnessValue = -0.5f; TestingPositions testingPositions = (TestingPositions)meaning; if(testingPositions.WeightedPositions != null) fitnessValue = this.getFitnessValue_getFitnessValueActually( testingPositions, returnsManager ); return fitnessValue; } } } |
|
From: Marco M. <mi...@us...> - 2010-11-20 18:47:44
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/AccountProviding In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv25707/a2_Accounting/AccountProviding Added Files: FixedCommissionsAndSlippageAccountProvider.cs Log Message: Added FixedCommissionsAndSlippageAccountProvider --- NEW FILE: FixedCommissionsAndSlippageAccountProvider.cs --- /* QuantProject - Quantitative Finance Library FixedCommissionsAndSlippageAccountProvider.cs Copyright (C) 2010 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; using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Financial.Accounting.Commissions; using QuantProject.Business.Financial.Accounting.Slippage; using QuantProject.Business.Timing; namespace QuantProject.Business.Financial.Accounting.AccountProviding { /// <summary> /// IAccountProvider object that provides an account /// with fixed commissions (also 0) and fixed percentage slippage (also 0) /// on orders /// </summary> [Serializable] public class FixedCommissionsAndSlippageAccountProvider : IAccountProvider { private double slippageFixedPercentage; private double fixedCommission; public FixedCommissionsAndSlippageAccountProvider(double fixedCommission, double slippageFixedPercentage) { this.fixedCommission = fixedCommission; if( slippageFixedPercentage < 0.0 || slippageFixedPercentage > 100.0 ) throw new OutOfRangeException("slippageFixedPercentage", 0.0, 100.0); this.slippageFixedPercentage = slippageFixedPercentage; } private ISlippageManager getAccount_getSlippageManager( Timer timer , HistoricalMarketValueProvider historicalMarketValueProvider) { ISlippageManager slippageManager; if(this.slippageFixedPercentage == 0.0) slippageManager = new ZeroSlippageManager(); else//this.slippageFixedPercentage > 0.0 slippageManager = new FixedPercentageSlippageManager( historicalMarketValueProvider , timer , this.slippageFixedPercentage ); return slippageManager; } public Account GetAccount( Timer timer , HistoricalMarketValueProvider historicalMarketValueProvider ) { Account account = new Account( "IBAccount" , timer , new HistoricalDataStreamer( timer , historicalMarketValueProvider ) , new HistoricalOrderExecutor( timer , historicalMarketValueProvider , this.getAccount_getSlippageManager( timer , historicalMarketValueProvider ) ), new FixedCommissionManager(this.fixedCommission) ); return account; } public string Description { get { string description = "SimpleAccount_FixedComm_Fixed%Slippage"; return description; } } } } |
|
From: Marco M. <mi...@us...> - 2010-11-20 18:46:24
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a4_Fundamentals In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv25641 Added Files: IFairValueProvider.cs Log Message: Added IFairValueProvider interface. Objects implementing it have to provide a GetFairValue method --- NEW FILE: IFairValueProvider.cs --- /* QuantProject - Quantitative Finance Library IFairValueProvider.cs Copyright (C) 2010 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.Histories; namespace QuantProject.Business.Financial.Fundamentals { /// <summary> /// Interface to be implemented by objects implementing a model which computes /// the fair value for a given ticker at a given date, using /// available fundamental data since another previous date /// </summary> public interface IFairValueProvider { double GetFairValue( string ticker , DateTime firstDateForFundamentals, DateTime dateOfFairValueComputation ); } } |