Class RateAccrualPeriod
- java.lang.Object
-
- com.opengamma.strata.product.swap.RateAccrualPeriod
-
- All Implemented Interfaces:
Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class RateAccrualPeriod extends Object implements org.joda.beans.ImmutableBean, Serializable
A period over which a fixed or floating rate is accrued.A swap leg consists of one or more periods that are the basis of accrual. This class represents one such period.
This class specifies the data necessary to calculate the value of the period. The key property is the
rateComputation
which defines how the rate is observed.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RateAccrualPeriod.Builder
The bean-builder forRateAccrualPeriod
.static class
RateAccrualPeriod.Meta
The meta-bean forRateAccrualPeriod
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RateAccrualPeriod.Builder
builder()
Returns a builder used to create an instance of the bean.static RateAccrualPeriod.Builder
builder(SchedulePeriod period)
Returns a builder used to create an instance of the bean, based on a schedule period.boolean
equals(Object obj)
LocalDate
getEndDate()
Gets the end date of the accrual period.double
getGearing()
Gets the gearing multiplier, defaulted to 1.NegativeRateMethod
getNegativeRateMethod()
Gets the negative rate method, defaulted to 'AllowNegative'.RateComputation
getRateComputation()
Gets the rate to be computed.double
getSpread()
Gets the spread rate, defaulted to 0.LocalDate
getStartDate()
Gets the start date of the accrual period.LocalDate
getUnadjustedEndDate()
Gets the unadjusted end date.LocalDate
getUnadjustedStartDate()
Gets the unadjusted start date.double
getYearFraction()
Gets the year fraction that the accrual period represents.int
hashCode()
static RateAccrualPeriod.Meta
meta()
The meta-bean forRateAccrualPeriod
.RateAccrualPeriod.Meta
metaBean()
RateAccrualPeriod.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.String
toString()
-
-
-
Method Detail
-
builder
public static RateAccrualPeriod.Builder builder(SchedulePeriod period)
Returns a builder used to create an instance of the bean, based on a schedule period.The start date and end date (adjusted and unadjusted) will be set in the builder.
- Parameters:
period
- the schedule period- Returns:
- the builder, not null
-
meta
public static RateAccrualPeriod.Meta meta()
The meta-bean forRateAccrualPeriod
.- Returns:
- the meta-bean, not null
-
builder
public static RateAccrualPeriod.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public RateAccrualPeriod.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getStartDate
public LocalDate getStartDate()
Gets the start date of the accrual period.This is the first accrual 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 accrual period.This is the last accrual 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
-
getRateComputation
public RateComputation getRateComputation()
Gets the rate to be computed.The value of the period is based on this rate. Different implementations of the
RateComputation
interface have different approaches to computing the rate, including averaging, overnight and interpolation. For example, it might be a well known market index such as 'GBP-LIBOR-3M'.- Returns:
- the value of the property, not null
-
getGearing
public double getGearing()
Gets the gearing multiplier, defaulted to 1.This defines the gearing, which is used to multiply the observed rate.
When calculating the rate, the observed rate is multiplied by the gearing. If both gearing and spread exist, then the gearing is applied first. A gearing of 1 has no effect.
Gearing is also known as leverage.
- Returns:
- the value of the property
-
getSpread
public double getSpread()
Gets the spread rate, defaulted to 0. A 5% rate will be expressed as 0.05.This defines the spread, which is used to add an amount the observed rate.
When calculating the rate, the spread is added to the observed rate. If both gearing and spread exist, then the gearing is applied first. A spread of 0 has no effect.
Defined by the 2006 ISDA definitions article 6.2e.
- Returns:
- the value of the property
-
getNegativeRateMethod
public NegativeRateMethod getNegativeRateMethod()
Gets the negative rate method, defaulted to 'AllowNegative'.This is used when the interest rate, observed or calculated, goes negative.
When observing or calculating the rate, the value may go negative. If it does, then this method is used to validate whether the negative rate is allowed. It is applied after any applicable gearing or spread.
Defined by the 2006 ISDA definitions article 6.4.
- Returns:
- the value of the property, not null
-
toBuilder
public RateAccrualPeriod.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-