Class OvernightRateSwapLegConvention
- java.lang.Object
-
- com.opengamma.strata.product.swap.type.OvernightRateSwapLegConvention
-
- All Implemented Interfaces:
FloatRateSwapLegConvention
,SwapLegConvention
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class OvernightRateSwapLegConvention extends Object implements FloatRateSwapLegConvention, org.joda.beans.ImmutableBean, Serializable
A market convention for the floating leg of rate swap trades based on an Overnight index.This defines the market convention for a floating leg based on the observed value of an Overnight index such as 'GBP-SONIA' or 'EUR-EONIA'. In most cases, the index contains sufficient information to fully define the convention. As such, no other fields need to be specified when creating an instance. The getters will default any missing information on the fly, avoiding both null and
Optional
.There are two methods of accruing interest on an Overnight index - 'Compounded' and 'Averaged'. Averaging is primarily related to the 'USD-FED-FUND' index.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OvernightRateSwapLegConvention.Builder
The bean-builder forOvernightRateSwapLegConvention
.static class
OvernightRateSwapLegConvention.Meta
The meta-bean forOvernightRateSwapLegConvention
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OvernightRateSwapLegConvention.Builder
builder()
Returns a builder used to create an instance of the bean.boolean
equals(Object obj)
BusinessDayAdjustment
getAccrualBusinessDayAdjustment()
Gets the business day adjustment to apply to accrual schedule dates, providing a default result if no override specified.Frequency
getAccrualFrequency()
Gets the periodic frequency of accrual.OvernightAccrualMethod
getAccrualMethod()
Gets the method of accruing overnight interest, defaulted to 'Compounded'.CompoundingMethod
getCompoundingMethod()
Gets the compounding method to use when there is more than one accrual period in each payment period, providing a default result if no override specified.Currency
getCurrency()
Gets the leg currency, optional with defaulting getter.DayCount
getDayCount()
Gets the day count convention applicable, providing a default result if no override specified.BusinessDayAdjustment
getEndDateBusinessDayAdjustment()
Gets the business day adjustment to apply to the end date, providing a default result if no override specified.OvernightIndex
getIndex()
Gets the Overnight index.DaysAdjustment
getPaymentDateOffset()
Gets the offset of payment from the base date, providing a default result if no override specified.Frequency
getPaymentFrequency()
Gets the periodic frequency of payments, providing a default result if no override specified.int
getRateCutOffDays()
Gets the number of business days before the end of the period that the rate is cut off, defaulted to zero.RollConvention
getRollConvention()
Gets the convention defining how to roll dates, providing a default result if no override specified.BusinessDayAdjustment
getStartDateBusinessDayAdjustment()
Gets the business day adjustment to apply to the start date, providing a default result if no override specified.StubConvention
getStubConvention()
Gets the convention defining how to handle stubs, providing a default result if no override specified.int
hashCode()
static OvernightRateSwapLegConvention.Meta
meta()
The meta-bean forOvernightRateSwapLegConvention
.OvernightRateSwapLegConvention.Meta
metaBean()
static OvernightRateSwapLegConvention
of(OvernightIndex index, Frequency frequency, int paymentOffsetDays)
Obtains a convention based on the specified index, using the 'Compounded' accrual method.static OvernightRateSwapLegConvention
of(OvernightIndex index, Frequency frequency, int paymentOffsetDays, OvernightAccrualMethod accrualMethod)
Creates a convention based on the specified index, specifying the accrual method.OvernightRateSwapLegConvention.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.RateCalculationSwapLeg
toLeg(LocalDate startDate, LocalDate endDate, PayReceive payReceive, double notional)
Creates a leg based on this convention.RateCalculationSwapLeg
toLeg(LocalDate startDate, LocalDate endDate, PayReceive payReceive, double notional, double spread)
Creates a leg based on this convention.String
toString()
-
-
-
Method Detail
-
of
public static OvernightRateSwapLegConvention of(OvernightIndex index, Frequency frequency, int paymentOffsetDays)
Obtains a convention based on the specified index, using the 'Compounded' accrual method.The standard market convention for an Overnight rate leg is based on the index, frequency and payment offset, with the accrual method set to 'Compounded' and the stub convention set to 'SmartInitial'. Use the builder for unusual conventions.
- Parameters:
index
- the index, the market convention values are extracted from the indexfrequency
- the frequency of payment, which is also the frequency of accrualpaymentOffsetDays
- the lag in days of payment from the end of the accrual period using the fixing calendar- Returns:
- the convention
-
of
public static OvernightRateSwapLegConvention of(OvernightIndex index, Frequency frequency, int paymentOffsetDays, OvernightAccrualMethod accrualMethod)
Creates a convention based on the specified index, specifying the accrual method.The standard market convention for an Overnight rate leg is based on the index, frequency, payment offset and accrual type, with the stub convention set to 'SmartInitial'. Use the builder for unusual conventions.
The accrual method is usually 'Compounded'. The 'Averaged' method is primarily related to the 'USD-FED-FUND' index.
- Parameters:
index
- the index, the market convention values are extracted from the indexfrequency
- the frequency of payment, which is also the frequency of accrualpaymentOffsetDays
- the lag in days of payment from the end of the accrual period using the fixing calendaraccrualMethod
- the method of accruing overnight interest- Returns:
- the convention
-
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
3
means 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.
This will default to zero if not specified.
- Returns:
- the rate cut off
-
getCurrency
public Currency getCurrency()
Gets the leg currency, optional with defaulting getter.This is the currency of the swap leg and the currency that payment is made in. The data model permits this currency to differ from that of the index, however the two are typically the same.
This will default to the currency of the index if not specified.
- Specified by:
getCurrency
in interfaceFloatRateSwapLegConvention
- Returns:
- the start date business day adjustment, not null
-
getDayCount
public DayCount getDayCount()
Gets the day count convention applicable, providing a default result if no override specified.This is used to convert dates to a numerical value. The data model permits the day count to differ from that of the index, however the two are typically the same.
This will default to the day count of the index if not specified.
- Specified by:
getDayCount
in interfaceFloatRateSwapLegConvention
- Returns:
- the day count, not null
-
getAccrualFrequency
public Frequency getAccrualFrequency()
Gets the periodic frequency of accrual.Interest will be accrued over periods at the specified periodic frequency, such as every 3 months.
This will default to the term frequency if not specified.
- Returns:
- the accrual frequency, not null
-
getAccrualBusinessDayAdjustment
public BusinessDayAdjustment getAccrualBusinessDayAdjustment()
Gets the business day adjustment to apply to accrual schedule dates, providing a default result if no override specified.Each date in the calculated schedule is determined without taking into account weekends and holidays. The adjustment specified here is used to convert those dates to valid business days. The start date and end date have their own business day adjustment rules.
This will default to 'ModifiedFollowing' using the index fixing calendar if not specified.
- Specified by:
getAccrualBusinessDayAdjustment
in interfaceFloatRateSwapLegConvention
- Returns:
- the business day adjustment, not null
-
getStartDateBusinessDayAdjustment
public BusinessDayAdjustment getStartDateBusinessDayAdjustment()
Gets the business day adjustment to apply to the start date, providing a default result if no override specified.The start date property is an unadjusted date and as such might be a weekend or holiday. The adjustment specified here is used to convert the start date to a valid business day.
This will default to the
accrualDatesBusinessDayAdjustment
if not specified.- Specified by:
getStartDateBusinessDayAdjustment
in interfaceFloatRateSwapLegConvention
- Returns:
- the start date business day adjustment, not null
-
getEndDateBusinessDayAdjustment
public BusinessDayAdjustment getEndDateBusinessDayAdjustment()
Gets the business day adjustment to apply to the end date, providing a default result if no override specified.The end date property is an unadjusted date and as such might be a weekend or holiday. The adjustment specified here is used to convert the end date to a valid business day.
This will default to the
accrualDatesBusinessDayAdjustment
if not specified.- Specified by:
getEndDateBusinessDayAdjustment
in interfaceFloatRateSwapLegConvention
- Returns:
- the end date business day adjustment, not null
-
getStubConvention
public StubConvention getStubConvention()
Gets the convention defining how to handle stubs, providing a default result if no override specified.The stub convention is used during schedule construction to determine whether the irregular remaining period occurs at the start or end of the schedule. It also determines whether the irregular period is shorter or longer than the regular period.
This will default to 'SmartInitial' if not specified.
- Returns:
- the stub convention, not null
-
getRollConvention
public RollConvention getRollConvention()
Gets the convention defining how to roll dates, providing a default result if no override specified.The schedule periods are determined at the high level by repeatedly adding the frequency to the start date, or subtracting it from the end date. The roll convention provides the detailed rule to adjust the day-of-month or day-of-week.
This will default to 'EOM' if not specified.
- Returns:
- the roll convention, not null
-
getPaymentFrequency
public Frequency getPaymentFrequency()
Gets the periodic frequency of payments, providing a default result if no override specified.Regular payments will be made at the specified periodic frequency. The frequency must be the same as, or a multiple of, the accrual periodic frequency.
Compounding applies if the payment frequency does not equal the accrual frequency.
This will default to the accrual frequency if not specified.
- Returns:
- the payment frequency, not null
-
getPaymentDateOffset
public DaysAdjustment getPaymentDateOffset()
Gets the offset of payment from the base date, providing a default result if no override specified.The offset is applied to the unadjusted date specified by
paymentRelativeTo
. Offset can be based on calendar days or business days.- Specified by:
getPaymentDateOffset
in interfaceFloatRateSwapLegConvention
- Returns:
- the payment date offset, not null
-
getCompoundingMethod
public CompoundingMethod getCompoundingMethod()
Gets the compounding method to use when there is more than one accrual period in each payment period, providing a default result if no override specified.Compounding is used when combining accrual periods.
- Returns:
- the compounding method, not null
-
toLeg
public RateCalculationSwapLeg toLeg(LocalDate startDate, LocalDate endDate, PayReceive payReceive, double notional)
Creates a leg based on this convention.This returns a leg based on the specified date. The notional is unsigned, with pay/receive determining the direction of the leg. If the leg is 'Pay', the fixed rate is paid to the counterparty. If the leg is 'Receive', the fixed rate is received from the counterparty.
- Parameters:
startDate
- the start dateendDate
- the end datepayReceive
- determines if the leg is to be paid or receivednotional
- the notional- Returns:
- the leg
-
toLeg
public RateCalculationSwapLeg toLeg(LocalDate startDate, LocalDate endDate, PayReceive payReceive, double notional, double spread)
Creates a leg based on this convention.This returns a leg based on the specified date. The notional is unsigned, with pay/receive determining the direction of the leg. If the leg is 'Pay', the fixed rate is paid to the counterparty. If the leg is 'Receive', the fixed rate is received from the counterparty.
- Parameters:
startDate
- the start dateendDate
- the end datepayReceive
- determines if the leg is to be paid or receivednotional
- the notionalspread
- the spread to apply- Returns:
- the leg
-
meta
public static OvernightRateSwapLegConvention.Meta meta()
The meta-bean forOvernightRateSwapLegConvention
.- Returns:
- the meta-bean, not null
-
builder
public static OvernightRateSwapLegConvention.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public OvernightRateSwapLegConvention.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getIndex
public OvernightIndex getIndex()
Gets the Overnight index.The floating rate to be paid is based on this index It will be a well known market index such as 'GBP-SONIA'.
- Specified by:
getIndex
in interfaceFloatRateSwapLegConvention
- 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 - 'Compounded' and 'Averaged'. Averaging is primarily related to the 'USD-FED-FUND' index.
- Returns:
- the value of the property, not null
-
toBuilder
public OvernightRateSwapLegConvention.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-