Class InflationRateCalculation
- java.lang.Object
-
- com.opengamma.strata.product.swap.InflationRateCalculation
-
- All Implemented Interfaces:
RateCalculation
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class InflationRateCalculation extends Object implements RateCalculation, org.joda.beans.ImmutableBean, Serializable
Defines the calculation of a swap leg of a zero-coupon inflation coupon based on a price index.This defines the data necessary to calculate the amount payable on the leg. The amount is based on the observed value of a price index.
The index for a given month is given in the yield curve or in the time series. The pay-off for a unit notional is
(Index_End / Index_Start - 1)
.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InflationRateCalculation.Builder
The bean-builder forInflationRateCalculation
.static class
InflationRateCalculation.Meta
The meta-bean forInflationRateCalculation
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static InflationRateCalculation.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.RateComputation
createRateComputation(LocalDate endDate)
Creates a rate observation where the start index value is known.boolean
equals(Object obj)
DayCount
getDayCount()
Gets the day count convention.OptionalDouble
getFirstIndexValue()
Gets the initial value of the index, optional.Optional<ValueSchedule>
getGearing()
Gets the gearing multiplier, optional.PriceIndex
getIndex()
Gets the index of prices.PriceIndexCalculationMethod
getIndexCalculationMethod()
Gets reference price index calculation method.Period
getLag()
Gets the positive period between the price index and the accrual date, typically a number of months.SwapLegType
getType()
Gets the type of the leg, such as Fixed or Ibor.int
hashCode()
static InflationRateCalculation.Meta
meta()
The meta-bean forInflationRateCalculation
.InflationRateCalculation.Meta
metaBean()
static InflationRateCalculation
of(PriceIndex index, int monthLag, PriceIndexCalculationMethod indexCalculationMethod)
Obtains a rate calculation for the specified price index.static InflationRateCalculation
of(PriceIndex index, int monthLag, PriceIndexCalculationMethod indexCalculationMethod, double firstIndexValue)
Obtains a rate calculation for the specified price index with known start index value.InflationRateCalculation.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.String
toString()
-
-
-
Method Detail
-
of
public static InflationRateCalculation of(PriceIndex index, int monthLag, PriceIndexCalculationMethod indexCalculationMethod)
Obtains a rate calculation for the specified price index.The calculation will use the specified month lag. All optional fields will be set to their default values. Thus, fixing will be in advance, with no gearing. If this method provides insufficient control, use the builder.
- Parameters:
index
- the price indexmonthLag
- the month lagindexCalculationMethod
- the reference price index calculation method- Returns:
- the inflation rate calculation
-
of
public static InflationRateCalculation of(PriceIndex index, int monthLag, PriceIndexCalculationMethod indexCalculationMethod, double firstIndexValue)
Obtains a rate calculation for the specified price index with known start index value.The calculation will use the specified month lag. The first index value will be set to the specified value All other optional fields will be set to their default values. Thus, fixing will be in advance, with no gearing. If this method provides insufficient control, use the builder.
- Parameters:
index
- the price indexmonthLag
- the month lagindexCalculationMethod
- the reference price index calculation methodfirstIndexValue
- the first index value- Returns:
- the inflation rate 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
-
getDayCount
public DayCount getDayCount()
Description copied from interface:RateCalculation
Gets the day count convention.This is used to convert schedule period dates to a numerical value.
- Specified by:
getDayCount
in interfaceRateCalculation
- Returns:
- the day count convention
-
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
-
createRateComputation
public RateComputation createRateComputation(LocalDate endDate)
Creates a rate observation where the start index value is known.This is typically used for capital indexed bonds. The rate is calculated between the value of
firstIndexValue
and the observed value at the end month linked to the specified end date. This method requires thatfirstIndexValue
is present.- Parameters:
endDate
- the end date of the period- Returns:
- the rate observation
-
meta
public static InflationRateCalculation.Meta meta()
The meta-bean forInflationRateCalculation
.- Returns:
- the meta-bean, not null
-
builder
public static InflationRateCalculation.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public InflationRateCalculation.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getIndex
public PriceIndex getIndex()
Gets the index of prices.The pay-off is computed based on this index The most common implementations are provided in
PriceIndices
.- Returns:
- the value of the property, not null
-
getLag
public Period getLag()
Gets the positive period between the price index and the accrual date, typically a number of months.A price index is typically published monthly and has a delay before publication. The lag is subtracted from the accrual start and end date to locate the month of the data to be observed.
For example, the September data may be published in October or November. A 3 month lag will cause an accrual date in December to be based on the observed data for September, which should be available by then.
- Returns:
- the value of the property, not null
-
getIndexCalculationMethod
public PriceIndexCalculationMethod getIndexCalculationMethod()
Gets reference price index calculation method.This specifies how the reference index calculation occurs.
- Returns:
- the value of the property, not null
-
getFirstIndexValue
public OptionalDouble getFirstIndexValue()
Gets the initial value of the index, optional.This optional field specifies the initial value of the index. The value is applicable for the first regular accrual period. It is used in place of an observed fixing. Other calculation elements, such as gearing or spread, still apply. After the first accrual period, the rate is observed via the normal fixing process.
The method
createRateComputation(LocalDate)
allows this field to be used as the base for any end date, as typically seen in capital indexed bonds.If this property is not present, then the first value is observed via the normal fixing process.
- 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.
When calculating the index, the gearing acts as a overall factor of pay-off. The pay-off is
Gearing_Factor * (Index_End / Index_Start - 1)
. A gearing of 1 has no effect.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
-
toBuilder
public InflationRateCalculation.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-