Class IborRateCalculation
- java.lang.Object
-
- com.opengamma.strata.product.swap.IborRateCalculation
-
- All Implemented Interfaces:
RateCalculation
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class IborRateCalculation extends Object implements RateCalculation, org.joda.beans.ImmutableBean, Serializable
Defines the calculation of a floating rate swap leg based on an Ibor index.This defines the data necessary to calculate the amount payable on the leg. The amount is based on the observed value of an Ibor index such as 'GBP-LIBOR-3M' or 'EUR-EURIBOR-1M'.
The index is observed once for each reset period and referred to as a fixing. The actual date of observation is the fixing date, which is relative to either the start or end of the reset period.
The reset period is typically the same as the accrual period. In this case, the rate for the accrual period is based directly on the fixing. If the reset period is a subdivision of the accrual period then there are multiple fixings, one for each reset period. In that case, the rate for the accrual period is based on an average of the fixings.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IborRateCalculation.Builder
The bean-builder forIborRateCalculation
.static class
IborRateCalculation.Meta
The meta-bean forIborRateCalculation
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IborRateCalculation.Builder
builder()
Returns a builder used to create an instance of the bean.void
collectCurrencies(ImmutableSet.Builder<Currency> builder)
Collects all the currencies referred to by this calculation.void
collectIndices(ImmutableSet.Builder<Index> builder)
Collects all the indices referred to by this calculation.ImmutableList<RateAccrualPeriod>
createAccrualPeriods(Schedule accrualSchedule, Schedule paymentSchedule, ReferenceData refData)
Creates accrual periods based on the specified schedule.boolean
equals(Object obj)
DayCount
getDayCount()
Gets the day count convention.Optional<IborRateStubCalculation>
getFinalStub()
Gets the rate to be used in final stub, optional.Optional<DaysAdjustment>
getFirstFixingDateOffset()
Gets the offset of the first fixing date from the first adjusted reset date, optional.OptionalDouble
getFirstRate()
Gets the rate of the first reset period, which may be a stub, optional.OptionalDouble
getFirstRegularRate()
Gets the rate of the first regular reset period, optional.DaysAdjustment
getFixingDateOffset()
Gets the offset of the fixing date from each adjusted reset date.FixingRelativeTo
getFixingRelativeTo()
Gets the base date that each fixing is made relative to, defaulted to 'PeriodStart'.Optional<ValueSchedule>
getGearing()
Gets the gearing multiplier, optional.IborIndex
getIndex()
Gets the Ibor index.Optional<IborRateStubCalculation>
getInitialStub()
Gets the rate to be used in initial stub, optional.NegativeRateMethod
getNegativeRateMethod()
Gets the negative rate method, defaulted to 'AllowNegative'.Optional<ResetSchedule>
getResetPeriods()
Gets the reset schedule, used when averaging rates, optional.Optional<ValueSchedule>
getSpread()
Gets the spread rate, with a 5% rate expressed as 0.05, optional.SwapLegType
getType()
Gets the type of the leg, such as Fixed or Ibor.int
hashCode()
static IborRateCalculation.Meta
meta()
The meta-bean forIborRateCalculation
.IborRateCalculation.Meta
metaBean()
static IborRateCalculation
of(IborIndex index)
Obtains a rate calculation for the specified index.IborRateCalculation.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.String
toString()
-
-
-
Method Detail
-
of
public static IborRateCalculation of(IborIndex index)
Obtains a rate calculation for the specified index.The calculation will use the day count and fixing offset of the index. All optional fields will be set to their default values. Thus, fixing will be in advance, with no spread, gearing or reset periods. If this method provides insufficient control, use the builder.
- Parameters:
index
- the index- Returns:
- the calculation
-
getType
public SwapLegType getType()
Description copied from interface:RateCalculation
Gets the type of the leg, such as Fixed or Ibor.This provides a high level categorization of the swap leg.
- Specified by:
getType
in interfaceRateCalculation
- Returns:
- the leg type
-
collectCurrencies
public void collectCurrencies(ImmutableSet.Builder<Currency> builder)
Description copied from interface:RateCalculation
Collects all the currencies referred to by this calculation.This collects the complete set of currencies for the calculation, not just the payment currencies.
- Specified by:
collectCurrencies
in interfaceRateCalculation
- Parameters:
builder
- the builder to populate
-
collectIndices
public void collectIndices(ImmutableSet.Builder<Index> builder)
Description copied from interface:RateCalculation
Collects all the indices referred to by this calculation.A calculation will typically refer to at least one index, such as 'GBP-LIBOR-3M'. Each index that is referred to must be added to the specified builder.
- Specified by:
collectIndices
in interfaceRateCalculation
- Parameters:
builder
- the builder to use
-
createAccrualPeriods
public ImmutableList<RateAccrualPeriod> createAccrualPeriods(Schedule accrualSchedule, Schedule paymentSchedule, ReferenceData refData)
Description copied from interface:RateCalculation
Creates accrual periods based on the specified schedule.The specified accrual schedule defines the period dates to be created. One instance of
RateAccrualPeriod
must be created for each period in the schedule.- Specified by:
createAccrualPeriods
in interfaceRateCalculation
- Parameters:
accrualSchedule
- the accrual schedulepaymentSchedule
- the payment schedulerefData
- the reference data to use when resolving- Returns:
- the accrual periods
-
meta
public static IborRateCalculation.Meta meta()
The meta-bean forIborRateCalculation
.- Returns:
- the meta-bean, not null
-
builder
public static IborRateCalculation.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public IborRateCalculation.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getDayCount
public DayCount getDayCount()
Gets the day count convention.This is used to convert dates to a numerical value.
When building, this will default to the day count of the index if not specified.
- Specified by:
getDayCount
in interfaceRateCalculation
- Returns:
- the value of the property, not null
-
getIndex
public IborIndex getIndex()
Gets the Ibor index.The rate to be paid is based on this index It will be a well known market index such as 'GBP-LIBOR-3M'.
- Returns:
- the value of the property, not null
-
getResetPeriods
public Optional<ResetSchedule> getResetPeriods()
Gets the reset schedule, used when averaging rates, optional.Most swaps have a single fixing for each accrual period. This property allows multiple fixings to be defined by dividing the accrual periods into reset periods.
If this property is not present, then the reset period is the same as the accrual period. If this property is present, then the accrual period is divided as per the information in the reset schedule, multiple fixing dates are calculated, and rate averaging performed.
- Returns:
- the optional value of the property, not null
-
getFixingRelativeTo
public FixingRelativeTo getFixingRelativeTo()
Gets the base date that each fixing is made relative to, defaulted to 'PeriodStart'.The fixing date is relative to either the start or end of each reset period.
Note that in most cases, the reset frequency matches the accrual frequency and thus there is only one fixing for the accrual period.
- Returns:
- the value of the property, not null
-
getFixingDateOffset
public DaysAdjustment getFixingDateOffset()
Gets the offset of the fixing date from each adjusted reset date.The offset is applied to the base date specified by
fixingRelativeTo
. The offset is typically a negative number of business days.Note that in most cases, the reset frequency matches the accrual frequency and thus there is only one fixing for the accrual period.
When building, this will default to the fixing offset of the index if not specified.
- Returns:
- the value of the property, not null
-
getNegativeRateMethod
public NegativeRateMethod getNegativeRateMethod()
Gets the negative rate method, defaulted to 'AllowNegative'.This is used when the interest rate, observed or calculated, goes negative. It does not apply if the rate is fixed, such as in a stub or using
firstRegularRate
.Defined by the 2006 ISDA definitions article 6.4.
- Returns:
- the value of the property, not null
-
getFirstRegularRate
public OptionalDouble getFirstRegularRate()
Gets the rate of the first regular reset period, optional. A 5% rate will be expressed as 0.05.In certain circumstances two counterparties agree the rate of the first fixing when the contract starts, and it is used in place of one observed fixing. For all other fixings, the rate is observed via the normal fixing process.
This property allows the rate of the first reset period of the first regular accrual period to be controlled. Note that if there is an initial stub, this will be the second reset period. Other calculation elements, such as gearing or spread, still apply to the rate specified here.
If the first rate applies to the initial stub rather than the regular accrual periods it must be specified using
initialStub
. Alternatively,firstRate
can be used.This property follows the definition in FpML. See also
firstRate
.- Returns:
- the optional value of the property, not null
-
getFirstRate
public OptionalDouble getFirstRate()
Gets the rate of the first reset period, which may be a stub, optional. A 5% rate will be expressed as 0.05.In certain circumstances two counterparties agree the rate of the first fixing when the contract starts, and it is used in place of one observed fixing. For all other fixings, the rate is observed via the normal fixing process.
This property allows the rate of the first reset period to be controlled, irrespective of whether that is an initial stub or a regular period. Other calculation elements, such as gearing or spread, still apply to the rate specified here.
This property is similar to
firstRegularRate
. This property operates on the first reset period, whether that is an initial stub or a regular period. By contrast,firstRegularRate
operates on the first regular period, and never on a stub.If either
firstRegularRate
orinitialStub
are present, this property is ignored.If this property is not present, then the first rate is observed via the normal fixing process.
- Returns:
- the optional value of the property, not null
-
getFirstFixingDateOffset
public Optional<DaysAdjustment> getFirstFixingDateOffset()
Gets the offset of the first fixing date from the first adjusted reset date, optional.If present, this offset is used instead of
fixingDateOffset
for the first reset period of the swap, which will be either an initial stub or the first reset period of the first regular accrual period.The offset is applied to the base date specified by
fixingRelativeTo
. The offset is typically a negative number of business days.If this property is not present, then the
fixingDateOffset
applies to all fixings.- Returns:
- the optional value of the property, not null
-
getInitialStub
public Optional<IborRateStubCalculation> getInitialStub()
Gets the rate to be used in initial stub, optional.The initial stub of a swap may have different rate rules to the regular accrual periods. A fixed rate may be specified, a different floating rate or a linearly interpolated floating rate. This may not be present if there is no initial stub, or if the index during the stub is the same as the main floating rate index.
If this property is not present, then the main index applies during any initial stub. If this property is present and there is no initial stub, it is ignored.
- Returns:
- the optional value of the property, not null
-
getFinalStub
public Optional<IborRateStubCalculation> getFinalStub()
Gets the rate to be used in final stub, optional.The final stub of a swap may have different rate rules to the regular accrual periods. A fixed rate may be specified, a different floating rate or a linearly interpolated floating rate. This may not be present if there is no final stub, or if the index during the stub is the same as the main floating rate index.
If this property is not present, then the main index applies during any final stub. If this property is present and there is no final stub, it is ignored.
- Returns:
- the optional value of the property, not null
-
getGearing
public Optional<ValueSchedule> getGearing()
Gets the gearing multiplier, optional.This defines the gearing as an initial value and a list of adjustments. The gearing is only permitted to change at accrual period boundaries.
When calculating the rate, the fixing rate is multiplied by the gearing. A gearing of 1 has no effect. If both gearing and spread exist, then the gearing is applied first.
If this property is not present, then no gearing applies.
Gearing is also known as leverage.
- Returns:
- the optional value of the property, not null
-
getSpread
public Optional<ValueSchedule> getSpread()
Gets the spread rate, with a 5% rate expressed as 0.05, optional.This defines the spread as an initial value and a list of adjustments. The spread is only permitted to change at accrual period boundaries. Spread is a per annum rate.
When calculating the rate, the spread is added to the fixing rate. A spread of 0 has no effect. If both gearing and spread exist, then the gearing is applied first.
If this property is not present, then no spread applies.
Defined by the 2006 ISDA definitions article 6.2e.
- Returns:
- the optional value of the property, not null
-
toBuilder
public IborRateCalculation.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-