Class SwaptionExercise
- java.lang.Object
-
- com.opengamma.strata.product.swaption.SwaptionExercise
-
- All Implemented Interfaces:
Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class SwaptionExercise extends Object implements org.joda.beans.ImmutableBean, Serializable
Details as to when a swaption can be exercised.A swaption can have three different kinds of exercise - European, American and Bermudan. A European swaption has one exercise date, an American can exercise on any date, and a Bermudan can exercise on a fixed set of dates.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SwaptionExercise.Meta
The meta-bean forSwaptionExercise
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AdjustableDates
calculateDates()
Gets the calculated list of exercise dates.boolean
equals(Object obj)
AdjustableDates
getDateDefinition()
Gets an explicit list of exercise dates.Optional<Frequency>
getFrequency()
Gets the frequency of exercise between the earliest and latest dates.DaysAdjustment
getSwapStartDateOffset()
Gets the offset to the swap start date.int
hashCode()
boolean
isAmerican()
Checks if the exercise is American.boolean
isBermudan()
Checks if the exercise is Bermudan.boolean
isEuropean()
Checks if the exercise is European.static SwaptionExercise.Meta
meta()
The meta-bean forSwaptionExercise
.SwaptionExercise.Meta
metaBean()
static SwaptionExercise
ofAmerican(LocalDate earliestExerciseDate, LocalDate latestExerciseDate, BusinessDayAdjustment dateAdjustment, DaysAdjustment swapStartDateOffset)
Obtains an instance for an American swaption.static SwaptionExercise
ofBermudan(AdjustableDates exerciseDates, DaysAdjustment swapStartDateOffset)
Obtains an instance for a Bermudan swaption.static SwaptionExercise
ofBermudan(LocalDate earliestExerciseDate, LocalDate latestExerciseDate, BusinessDayAdjustment dateAdjustment, Frequency frequency, DaysAdjustment swapStartDateOffset)
Obtains an instance for a Bermudan swaption where the dates are calculated.static SwaptionExercise
ofEuropean(AdjustableDate exerciseDate, DaysAdjustment swapStartDateOffset)
Obtains an instance for a European swaption.AdjustableDate
selectDate(LocalDate proposedExerciseDate, ReferenceData refData)
Selects a single exercise date based on the proposed date.String
toString()
-
-
-
Method Detail
-
ofEuropean
public static SwaptionExercise ofEuropean(AdjustableDate exerciseDate, DaysAdjustment swapStartDateOffset)
Obtains an instance for a European swaption.- Parameters:
exerciseDate
- the exercise dateswapStartDateOffset
- the swap start date offset- Returns:
- the exercise
-
ofAmerican
public static SwaptionExercise ofAmerican(LocalDate earliestExerciseDate, LocalDate latestExerciseDate, BusinessDayAdjustment dateAdjustment, DaysAdjustment swapStartDateOffset)
Obtains an instance for an American swaption.- Parameters:
earliestExerciseDate
- the earliest exercise datelatestExerciseDate
- the latest exercise datedateAdjustment
- the date adjustmentswapStartDateOffset
- the swap start date offset- Returns:
- the exercise
-
ofBermudan
public static SwaptionExercise ofBermudan(AdjustableDates exerciseDates, DaysAdjustment swapStartDateOffset)
Obtains an instance for a Bermudan swaption.- Parameters:
exerciseDates
- the exercise datesswapStartDateOffset
- the swap start date offset- Returns:
- the exercise
-
ofBermudan
public static SwaptionExercise ofBermudan(LocalDate earliestExerciseDate, LocalDate latestExerciseDate, BusinessDayAdjustment dateAdjustment, Frequency frequency, DaysAdjustment swapStartDateOffset)
Obtains an instance for a Bermudan swaption where the dates are calculated.For example, if the dates represent a 5 year period and the frequency is yearly then the Bermudan swaption can be exercised each year in the period. The exact dates are calculated by adding multiples of the frequency to the earliest date.
- Parameters:
earliestExerciseDate
- the earliest exercise datelatestExerciseDate
- the latest exercise datedateAdjustment
- the date adjustmentfrequency
- the frequencyswapStartDateOffset
- the swap start date offset- Returns:
- the exercise
-
isEuropean
public boolean isEuropean()
Checks if the exercise is European.- Returns:
- true if European exercise on a single date
-
isAmerican
public boolean isAmerican()
Checks if the exercise is American.- Returns:
- true if American exercise on any date
-
isBermudan
public boolean isBermudan()
Checks if the exercise is Bermudan.- Returns:
- true if Bermudan exercise on a specific set of dates
-
calculateDates
public AdjustableDates calculateDates()
Gets the calculated list of exercise dates.This could be a large list in the case of an American exercise.
- Returns:
- the exercise dates
-
selectDate
public AdjustableDate selectDate(LocalDate proposedExerciseDate, ReferenceData refData)
Selects a single exercise date based on the proposed date.This validates the proposed exercise date and returns it.
The date is matched as an adjusted date first, then as an unadjusted date. If the date can only be an adjusted date, the result will use
BusinessDayAdjustment.NONE
.- Parameters:
proposedExerciseDate
- the proposed exercise daterefData
- the reference data- Returns:
- the exercise dates
- Throws:
IllegalArgumentException
- if the proposed exercise date is not valid
-
meta
public static SwaptionExercise.Meta meta()
The meta-bean forSwaptionExercise
.- Returns:
- the meta-bean, not null
-
metaBean
public SwaptionExercise.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getDateDefinition
public AdjustableDates getDateDefinition()
Gets an explicit list of exercise dates.A European swaption has one date in the list. A Bermudan swaption has at least two dates in the list. An American swaption has at exactly two dates in the list, the earliest and latest dates.
- Returns:
- the value of the property, not null
-
getFrequency
public Optional<Frequency> getFrequency()
Gets the frequency of exercise between the earliest and latest dates.An American swaption must set this to one day.
A Bermudan swaption might set this to a specific frequency instead of pre-calculating the dates. If it does this, there must only be two dates in the list. The intermediate dates will be calculated by adding multiples of the frequency to the earliest date.
- Returns:
- the optional value of the property, not null
-
getSwapStartDateOffset
public DaysAdjustment getSwapStartDateOffset()
Gets the offset to the swap start date.Each adjusted exercise date has this offset applied to get the start date of the underlying swap.
- Returns:
- the value of the property, not null
-
-