diff --git a/src/Numerics/Financial/AbsoluteReturnMeasures.cs b/src/Numerics/Financial/AbsoluteReturnMeasures.cs index 5b31bc31..be836335 100644 --- a/src/Numerics/Financial/AbsoluteReturnMeasures.cs +++ b/src/Numerics/Financial/AbsoluteReturnMeasures.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2013 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -37,10 +37,16 @@ namespace MathNet.Numerics.Financial { public static class AbsoluteReturnMeasures { + [Obsolete("Use CompoundReturn instead, will be removed in v4.0")] + public static double CompoundMonthlyReturn(this IEnumerable data) + { + return CompoundReturn(data); + } + /// /// Compound Monthly Return or Geometric Return or Annualized Return /// - public static double CompoundMonthlyReturn(this IEnumerable data) + public static double CompoundReturn(this IEnumerable data) { if (data == null) { @@ -60,7 +66,7 @@ namespace MathNet.Numerics.Financial /// /// Average Gain or Gain Mean - /// This is a simple average (arithmetic mean) of the periods with a gain. It is calculated by summing the returns for gain periods (return 0) + /// This is a simple average (arithmetic mean) of the periods with a gain. It is calculated by summing the returns for gain periods (return 0) /// and then dividing the total by the number of gain periods. /// /// http://www.offshore-library.com/kb/statistics.php @@ -90,4 +96,4 @@ namespace MathNet.Numerics.Financial return data.Where(x => x < 0).Mean(); } } -} \ No newline at end of file +} diff --git a/src/UnitTests/FinancialTests/CompoundMonthlyReturnTests.cs b/src/UnitTests/FinancialTests/CompoundReturnTests.cs similarity index 88% rename from src/UnitTests/FinancialTests/CompoundMonthlyReturnTests.cs rename to src/UnitTests/FinancialTests/CompoundReturnTests.cs index 8b7fc7ca..f8d2db9a 100644 --- a/src/UnitTests/FinancialTests/CompoundMonthlyReturnTests.cs +++ b/src/UnitTests/FinancialTests/CompoundReturnTests.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2013 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -36,7 +36,7 @@ using NUnit.Framework; namespace MathNet.Numerics.UnitTests.FinancialTests { [TestFixture, Category("Financial")] - public class CompoundMonthlyReturnTests + public class CompoundReturnTests { [Test] [ExpectedException(typeof(ArgumentNullException))] //assert @@ -46,7 +46,7 @@ namespace MathNet.Numerics.UnitTests.FinancialTests List inputData = null; //act // ReSharper disable ExpressionIsAlwaysNull - inputData.CompoundMonthlyReturn(); + inputData.CompoundReturn(); // ReSharper restore ExpressionIsAlwaysNull } @@ -56,23 +56,22 @@ namespace MathNet.Numerics.UnitTests.FinancialTests //arrange var inputData = new List(); //act - var cmpdReturn = inputData.CompoundMonthlyReturn(); + var cmpdReturn = inputData.CompoundReturn(); //assert Assert.AreEqual(double.NaN, cmpdReturn); } [Test] - public void calculates_the_compound_monthly_return() + public void calculates_the_compound_return() { //arrange var inputData = new[] { 0.2, 0.06, 0.01 }; //act - var cmpdReturn = inputData.CompoundMonthlyReturn(); + var cmpdReturn = inputData.CompoundReturn(); //assert AssertHelpers.AlmostEqualRelative(0.0870999982199265, cmpdReturn, 14); } //Definitely need more tests here. Would love to find test data for these stats similar to the .dat files used for other tests. } - -} \ No newline at end of file +} diff --git a/src/UnitTests/RootFindingTests/SecantTest.cs b/src/UnitTests/RootFindingTests/SecantTest.cs index ddce1efd..5b490b59 100644 --- a/src/UnitTests/RootFindingTests/SecantTest.cs +++ b/src/UnitTests/RootFindingTests/SecantTest.cs @@ -3,9 +3,9 @@ // http://numerics.mathdotnet.com // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com -// +// // Copyright (c) 2009-2013 Math.NET -// +// // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without @@ -14,10 +14,10 @@ // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: -// +// // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND diff --git a/src/UnitTests/UnitTests.csproj b/src/UnitTests/UnitTests.csproj index 6552488c..60d6ead5 100644 --- a/src/UnitTests/UnitTests.csproj +++ b/src/UnitTests/UnitTests.csproj @@ -118,7 +118,7 @@ - +