Class CmsPeriod
- java.lang.Object
-
- com.opengamma.strata.product.cms.CmsPeriod
-
- All Implemented Interfaces:
Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class CmsPeriod extends Object implements org.joda.beans.ImmutableBean, Serializable
A period over which a CMS coupon or CMS caplet/floorlet payoff is paid.This represents a single payment period within a CMS leg. This class specifies the data necessary to calculate the value of the period. The payment period contains the unique accrual period. The value of the period is based on the observed value of
SwapIndex
.The payment is a CMS coupon, CMS caplet or CMS floorlet. The pay-offs are, for a swap index on the fixingDate of 'S' and an year fraction 'a'
CMS Coupon: a * S
CMS Caplet: a * (S-K)^+ ; K=caplet
CMS Floorlet: a * (K-S)^+ ; K=floorletIf
caplet
(floorlet
) is not null, the payment is a caplet (floorlet). If both ofcaplet
andfloorlet
are null, this class represents a CMS coupon payment. Thus at least one of the fields must be null.A
CmsPeriod
is bound to data that changes over time, such as holiday calendars. If the data changes, such as the addition of a new holiday, the resolved form will not be updated. Care must be taken when placing the resolved form in a cache or persistence layer.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CmsPeriod.Builder
The bean-builder forCmsPeriod
.static class
CmsPeriod.Meta
The meta-bean forCmsPeriod
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CmsPeriod.Builder
builder()
Returns a builder used to create an instance of the bean.boolean
equals(Object obj)
OptionalDouble
getCaplet()
Gets the optional caplet strike.CmsPeriodType
getCmsPeriodType()
Obtains the type of the CMS period.Currency
getCurrency()
Gets the primary currency of the payment period.DayCount
getDayCount()
Gets the day count of the period.LocalDate
getEndDate()
Gets the end date of the payment period.LocalDate
getFixingDate()
Gets the date of the index fixing.OptionalDouble
getFloorlet()
Gets the optional floorlet strike.SwapIndex
getIndex()
Gets the swap index.double
getNotional()
Gets the notional amount, positive if receiving, negative if paying.LocalDate
getPaymentDate()
Gets the date that payment occurs.LocalDate
getStartDate()
Gets the start date of the payment period.double
getStrike()
Obtains the strike value.LocalDate
getUnadjustedEndDate()
Gets the unadjusted end date.LocalDate
getUnadjustedStartDate()
Gets the unadjusted start date.ResolvedSwap
getUnderlyingSwap()
Gets the underlying swap.double
getYearFraction()
Gets the year fraction that the accrual period represents.int
hashCode()
static CmsPeriod.Meta
meta()
The meta-bean forCmsPeriod
.CmsPeriod.Meta
metaBean()
CmsPeriod.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.CmsPeriod
toCouponEquivalent()
Return the CMS coupon equivalent to the period.String
toString()
-
-
-
Method Detail
-
getCmsPeriodType
public CmsPeriodType getCmsPeriodType()
Obtains the type of the CMS period.The period type is caplet, floorlet or coupon.
- Returns:
- the CMS period type
-
getStrike
public double getStrike()
Obtains the strike value.If the CMS period type is coupon, 0 is returned.
- Returns:
- the strike value
-
toCouponEquivalent
public CmsPeriod toCouponEquivalent()
Return the CMS coupon equivalent to the period.For cap or floor the result is the coupon with the same dates and index but with no cap or floor strike.
- Returns:
- the CMS coupon
-
meta
public static CmsPeriod.Meta meta()
The meta-bean forCmsPeriod
.- Returns:
- the meta-bean, not null
-
builder
public static CmsPeriod.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public CmsPeriod.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getCurrency
public Currency getCurrency()
Gets the primary currency of the payment period.The amounts of the notional are usually expressed in terms of this currency, however they can be converted from amounts in a different currency.
- Returns:
- the value of the property, not null
-
getNotional
public double getNotional()
Gets the notional amount, positive if receiving, negative if paying.The notional amount applicable during the period. The currency of the notional is specified by
currency
.- Returns:
- the value of the property
-
getStartDate
public LocalDate getStartDate()
Gets the start date of the payment period.This is the first date in the period. If the schedule adjusts for business days, then this is the adjusted date.
- Returns:
- the value of the property, not null
-
getEndDate
public LocalDate getEndDate()
Gets the end date of the payment period.This is the last date in the period. If the schedule adjusts for business days, then this is the adjusted date.
- Returns:
- the value of the property, not null
-
getUnadjustedStartDate
public LocalDate getUnadjustedStartDate()
Gets the unadjusted start date.The start date before any business day adjustment is applied.
When building, this will default to the start date if not specified.
- Returns:
- the value of the property, not null
-
getUnadjustedEndDate
public LocalDate getUnadjustedEndDate()
Gets the unadjusted end date.The end date before any business day adjustment is applied.
When building, this will default to the end date if not specified.
- Returns:
- the value of the property, not null
-
getYearFraction
public double getYearFraction()
Gets the year fraction that the accrual period represents.The value is usually calculated using a
DayCount
which may be different to that of the index. Typically the value will be close to 1 for one year and close to 0.5 for six months. The fraction may be greater than 1, but not less than 0.- Returns:
- the value of the property
-
getPaymentDate
public LocalDate getPaymentDate()
Gets the date that payment occurs.If the schedule adjusts for business days, then this is the adjusted date.
- Returns:
- the value of the property, not null
-
getFixingDate
public LocalDate getFixingDate()
Gets the date of the index fixing.This is an adjusted date with any business day applied.
- Returns:
- the value of the property, not null
-
getCaplet
public OptionalDouble getCaplet()
Gets the optional caplet strike.This defines the strike value of a caplet.
If the period is not a caplet, this field will be absent.
- Returns:
- the optional value of the property, not null
-
getFloorlet
public OptionalDouble getFloorlet()
Gets the optional floorlet strike.This defines the strike value of a floorlet.
If the period is not a floorlet, this field will be absent.
- Returns:
- the optional value of the property, not null
-
getDayCount
public DayCount getDayCount()
Gets the day count of the period.- Returns:
- the value of the property, not null
-
getIndex
public SwapIndex getIndex()
Gets the swap index.The swap rate to be paid is the observed value of this index.
- Returns:
- the value of the property, not null
-
getUnderlyingSwap
public ResolvedSwap getUnderlyingSwap()
Gets the underlying swap.The interest rate swap for which the swap rate is referred.
- Returns:
- the value of the property, not null
-
toBuilder
public CmsPeriod.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-