public enum ReturnsCalculators extends Enum<ReturnsCalculators> implements ReturnsCalculator
Enum Constant and Description |
---|
ABSOLUTE
The return is defined as the difference between the values of the
portfolio.
|
LOG
The return is defined as the natural logarithm of the ratio
v2/v1.
|
SIMPLE
The return is defined as the absolute return over the original value.
|
Modifier and Type | Method and Description |
---|---|
abstract double |
computePrice(double px0,
double r)
Computes the next price after a return.
|
abstract double |
computeReturn(double v1,
double v2)
Computes the portfolio return.
|
static ReturnsCalculators |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ReturnsCalculators[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ReturnsCalculators ABSOLUTE
r = v2 - v1
public static final ReturnsCalculators SIMPLE
r = (v2 / v1) - 1
public static final ReturnsCalculators LOG
r = log(v2 / v1)
public static ReturnsCalculators[] values()
for (ReturnsCalculators c : ReturnsCalculators.values()) System.out.println(c);
public static ReturnsCalculators valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic abstract double computeReturn(double v1, double v2)
ReturnsCalculator
computeReturn
in interface ReturnsCalculator
v1
- the beginning value of the portfoliov2
- the ending value of the portfoliopublic abstract double computePrice(double px0, double r)
ReturnsCalculator
computePrice
in interface ReturnsCalculator
px0
- the original pricer
- the returnCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.