Add Discount to Numerics
All checks were successful
Build .NET Project / build (push) Successful in 4m50s
All checks were successful
Build .NET Project / build (push) Successful in 4m50s
This commit is contained in:
@@ -16,6 +16,17 @@ namespace MarketData.Numerical
|
||||
{
|
||||
public enum CorrelationType{PerfectDownhill,StrongDownhill,ModerateDownhill,WeakDownhill,NoLinearRelationship,WeakUphill,ModerateUphill,StrongUphill,PerfectUphill};
|
||||
|
||||
/// <summary>
|
||||
/// Discount - Discounts the given number by a percentage. For example to discount $600.00 by 20% call Discount(600.00,.20)
|
||||
/// </summary>
|
||||
/// <param name="number"></param>
|
||||
/// <param name="discountPercentDecimal"></param>
|
||||
/// <returns></returns>
|
||||
public static double Discount(double number, double discountPercentDecimal)
|
||||
{
|
||||
return number * (1.00 - discountPercentDecimal);
|
||||
}
|
||||
|
||||
// (i.e.) 2.789 will round to 2.79
|
||||
public static double Round(double x)
|
||||
{
|
||||
@@ -65,7 +76,6 @@ namespace MarketData.Numerical
|
||||
double stddev=StdDev(ref observations);
|
||||
deviations=Math.Abs(deviations);
|
||||
if(deviations<1)deviations=1;
|
||||
// double[] newObservations=(from double value in observations where value<deviations*stddev && value>-2*stddev select value).ToArray<double>();
|
||||
double[] newObservations=(from double value in observations where value<deviations*stddev && value > (deviations*-1)*stddev select value).ToArray<double>();
|
||||
return newObservations;
|
||||
}
|
||||
@@ -1150,8 +1160,8 @@ namespace MarketData.Numerical
|
||||
/// Interpretation of results:
|
||||
/// -1 : A perfect downhill (negative) linear relationship
|
||||
/// -0.70 : A strong downhill (negative) linear relationship
|
||||
/// <20>0.50. A moderate downhill (negative) relationship
|
||||
/// <20>0.30. A weak downhill (negative) linear relationship
|
||||
/// <20>0.50. A moderate downhill (negative) relationship
|
||||
/// <20>0.30. A weak downhill (negative) linear relationship
|
||||
/// 0. No linear relationship
|
||||
/// +0.30. A weak uphill (positive) linear relationship
|
||||
/// +0.50. A moderate uphill (positive) relationship
|
||||
|
||||
Reference in New Issue
Block a user