Class OvernightRateCalculation
- java.lang.Object
-
- com.opengamma.strata.product.swap.OvernightRateCalculation
-
- All Implemented Interfaces:
RateCalculation,Serializable,org.joda.beans.Bean,org.joda.beans.ImmutableBean
public final class OvernightRateCalculation extends Object implements RateCalculation, org.joda.beans.ImmutableBean, Serializable
Defines the calculation of a floating rate swap leg based on an Overnight index.This defines the data necessary to calculate the amount payable on the leg. The amount is based on the observed value of an Overnight index such as 'GBP-SONIA' or 'USD-FED-FUND'.
The index is observed for each business day and averaged or compounded to produce a rate. The reset periods correspond to each business day and are inferred from the accrual period dates.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOvernightRateCalculation.BuilderThe bean-builder forOvernightRateCalculation.static classOvernightRateCalculation.MetaThe meta-bean forOvernightRateCalculation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OvernightRateCalculation.Builderbuilder()Returns a builder used to create an instance of the bean.voidcollectCurrencies(ImmutableSet.Builder<Currency> builder)Collects all the currencies referred to by this calculation.voidcollectIndices(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.booleanequals(Object obj)OvernightAccrualMethodgetAccrualMethod()Gets the method of accruing overnight interest, defaulted to 'Compounded'.DayCountgetDayCount()Gets the day count convention.Optional<ValueSchedule>getGearing()Gets the gearing multiplier, optional.OvernightIndexgetIndex()Gets the Overnight index.NegativeRateMethodgetNegativeRateMethod()Gets the negative rate method, defaulted to 'AllowNegative'.intgetRateCutOffDays()Gets the number of business days before the end of the period that the rate is cut off, defaulted to zero.Optional<ValueSchedule>getSpread()Gets the spread rate, optional.SwapLegTypegetType()Gets the type of the leg, such as Fixed or Ibor.inthashCode()static OvernightRateCalculation.Metameta()The meta-bean forOvernightRateCalculation.OvernightRateCalculation.MetametaBean()static OvernightRateCalculationof(OvernightIndex index)Obtains a rate calculation for the specified index with accrual by compounding.OvernightRateCalculation.BuildertoBuilder()Returns a builder that allows this bean to be mutated.StringtoString()
-
-
-
Method Detail
-
of
public static OvernightRateCalculation of(OvernightIndex index)
Obtains a rate calculation for the specified index with accrual by compounding.The calculation will use the day count of the index. All optional fields will be set to their default values. Thus, there will be no spread, gearing or rate cut-off. If this method provides insufficient control, use the builder.
- Parameters:
index- the index- Returns:
- the calculation
-
getType
public SwapLegType getType()
Description copied from interface:RateCalculationGets the type of the leg, such as Fixed or Ibor.This provides a high level categorization of the swap leg.
- Specified by:
getTypein interfaceRateCalculation- Returns:
- the leg type
-
collectCurrencies
public void collectCurrencies(ImmutableSet.Builder<Currency> builder)
Description copied from interface:RateCalculationCollects 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:
collectCurrenciesin interfaceRateCalculation- Parameters:
builder- the builder to populate
-
collectIndices
public void collectIndices(ImmutableSet.Builder<Index> builder)
Description copied from interface:RateCalculationCollects 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:
collectIndicesin interfaceRateCalculation- Parameters:
builder- the builder to use
-
createAccrualPeriods
public ImmutableList<RateAccrualPeriod> createAccrualPeriods(Schedule accrualSchedule, Schedule paymentSchedule, ReferenceData refData)
Description copied from interface:RateCalculationCreates accrual periods based on the specified schedule.The specified accrual schedule defines the period dates to be created. One instance of
RateAccrualPeriodmust be created for each period in the schedule.- Specified by:
createAccrualPeriodsin interfaceRateCalculation- Parameters:
accrualSchedule- the accrual schedulepaymentSchedule- the payment schedulerefData- the reference data to use when resolving- Returns:
- the accrual periods
-
meta
public static OvernightRateCalculation.Meta meta()
The meta-bean forOvernightRateCalculation.- Returns:
- the meta-bean, not null
-
builder
public static OvernightRateCalculation.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public OvernightRateCalculation.Meta metaBean()
- Specified by:
metaBeanin 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:
getDayCountin interfaceRateCalculation- Returns:
- the value of the property, not null
-
getIndex
public OvernightIndex getIndex()
Gets the Overnight index.The rate to be paid is based on this index It will be a well known market index such as 'GBP-SONIA'.
- Returns:
- the value of the property, not null
-
getAccrualMethod
public OvernightAccrualMethod getAccrualMethod()
Gets the method of accruing overnight interest, defaulted to 'Compounded'.Two methods of accrual are supported - compounding and averaging. Averaging is primarily related to the 'USD-FED-FUND' index.
- 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
-
getRateCutOffDays
public int getRateCutOffDays()
Gets the number of business days before the end of the period that the rate is cut off, defaulted to zero.When a rate cut-off applies, the final daily rate is determined this number of days before the end of the period, with any subsequent days having the same rate.
The amount must be zero or positive. A value of zero or one will have no effect on the standard calculation. The fixing holiday calendar of the index is used to determine business days.
For example, a value of
3means that the rate observed on(periodEndDate - 3 business days)is also to be used on(periodEndDate - 2 business days)and(periodEndDate - 1 business day).If there are multiple accrual periods in the payment period, then this will only apply to the last accrual period in the payment period.
- Returns:
- the value of the property
-
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, optional. A 5% rate will be expressed as 0.05.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 OvernightRateCalculation.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-