Enum BillYieldConvention
- java.lang.Object
-
- java.lang.Enum<BillYieldConvention>
-
- com.opengamma.strata.product.bond.BillYieldConvention
-
- All Implemented Interfaces:
Named
,NamedEnum
,Serializable
,Comparable<BillYieldConvention>
public enum BillYieldConvention extends Enum<BillYieldConvention> implements NamedEnum
A convention defining how yield is computed for a bill.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DISCOUNT
Discount.FRANCE_CD
France CD: interest at maturity.INTEREST_AT_MATURITY
Interest at maturity.JAPAN_BILLS
Japanese T-Bills.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static BillYieldConvention
of(String name)
Obtains an instance from the specified name.abstract double
priceFromYield(double yield, double accrualFactor)
Computes the price from a yield and a accrual factor.String
toString()
Returns the formatted name of the type.static BillYieldConvention
valueOf(String name)
Returns the enum constant of this type with the specified name.static BillYieldConvention[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.abstract double
yieldFromPrice(double price, double accrualFactor)
Computes the yield from a price and a accrual factor.
-
-
-
Enum Constant Detail
-
DISCOUNT
public static final BillYieldConvention DISCOUNT
Discount.
-
FRANCE_CD
public static final BillYieldConvention FRANCE_CD
France CD: interest at maturity.
-
INTEREST_AT_MATURITY
public static final BillYieldConvention INTEREST_AT_MATURITY
Interest at maturity.
-
JAPAN_BILLS
public static final BillYieldConvention JAPAN_BILLS
Japanese T-Bills.
-
-
Method Detail
-
values
public static BillYieldConvention[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (BillYieldConvention c : BillYieldConvention.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static BillYieldConvention valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
of
public static BillYieldConvention of(String name)
Obtains an instance from the specified name.Parsing handles the mixed case form produced by
toString()
and the upper and lower case variants of the enum constant name.- Parameters:
name
- the name to parse- Returns:
- the type
- Throws:
IllegalArgumentException
- if the name is not known
-
toString
public String toString()
Returns the formatted name of the type.- Overrides:
toString
in classEnum<BillYieldConvention>
- Returns:
- the formatted string representing the type
-
priceFromYield
public abstract double priceFromYield(double yield, double accrualFactor)
Computes the price from a yield and a accrual factor.- Parameters:
yield
- the yieldaccrualFactor
- the accrual factor- Returns:
- the price
-
yieldFromPrice
public abstract double yieldFromPrice(double price, double accrualFactor)
Computes the yield from a price and a accrual factor.- Parameters:
price
- the priceaccrualFactor
- the accrual factor- Returns:
- the yield
-
-