Class IborRateStubCalculation
- java.lang.Object
-
- com.opengamma.strata.product.swap.IborRateStubCalculation
-
- All Implemented Interfaces:
Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class IborRateStubCalculation extends Object implements org.joda.beans.ImmutableBean, Serializable
Defines the rates applicable in the initial or final stub of an Ibor swap leg.A standard swap leg consists of a regular periodic schedule and one or two stub periods at each end. This class defines what floating rate to use during a stub.
The rate may be specified in three ways.
- A fixed rate, applicable for the whole stub
- A floating rate based on a single Ibor index
- A floating rate based on linear interpolation between two Ibor indices
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IborRateStubCalculation.Builder
The bean-builder forIborRateStubCalculation
.static class
IborRateStubCalculation.Meta
The meta-bean forIborRateStubCalculation
.
-
Field Summary
Fields Modifier and Type Field Description static IborRateStubCalculation
NONE
An instance that has no special rate handling.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IborRateStubCalculation.Builder
builder()
Returns a builder used to create an instance of the bean.boolean
equals(Object obj)
OptionalDouble
getFixedRate()
Gets the fixed rate to use in the stub.Optional<IborIndex>
getIndex()
Gets the Ibor index to be used for the stub.Optional<IborIndex>
getIndexInterpolated()
Gets the second Ibor index to be used for the stub, linearly interpolated.Optional<CurrencyAmount>
getKnownAmount()
Gets the known amount to pay/receive for the stub.int
hashCode()
boolean
isFixedRate()
Checks if the stub has a fixed rate.boolean
isFloatingRate()
Checks if the stub has a floating rate.boolean
isInterpolated()
Checks if the stub has an interpolated rate.boolean
isKnownAmount()
Checks if the stub has a known amount.static IborRateStubCalculation.Meta
meta()
The meta-bean forIborRateStubCalculation
.IborRateStubCalculation.Meta
metaBean()
static IborRateStubCalculation
ofFixedRate(double fixedRate)
Obtains an instance with a single fixed rate.static IborRateStubCalculation
ofIborInterpolatedRate(IborIndex index1, IborIndex index2)
Obtains an instance with linear interpolation of two floating rates.static IborRateStubCalculation
ofIborRate(IborIndex index)
Obtains an instance with a single floating rate.static IborRateStubCalculation
ofKnownAmount(CurrencyAmount knownAmount)
Obtains an instance with a known amount of interest.IborRateStubCalculation.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.String
toString()
-
-
-
Field Detail
-
NONE
public static final IborRateStubCalculation NONE
An instance that has no special rate handling.
-
-
Method Detail
-
ofFixedRate
public static IborRateStubCalculation ofFixedRate(double fixedRate)
Obtains an instance with a single fixed rate.- Parameters:
fixedRate
- the fixed rate for the stub- Returns:
- the stub
-
ofKnownAmount
public static IborRateStubCalculation ofKnownAmount(CurrencyAmount knownAmount)
Obtains an instance with a known amount of interest.- Parameters:
knownAmount
- the known amount of interest- Returns:
- the stub
-
ofIborRate
public static IborRateStubCalculation ofIborRate(IborIndex index)
Obtains an instance with a single floating rate.- Parameters:
index
- the index that applies to the stub- Returns:
- the stub
- Throws:
IllegalArgumentException
- if the index is null
-
ofIborInterpolatedRate
public static IborRateStubCalculation ofIborInterpolatedRate(IborIndex index1, IborIndex index2)
Obtains an instance with linear interpolation of two floating rates.The two indices must be different, typically with one longer than another. The order of input of the indices does not matter.
- Parameters:
index1
- the first indexindex2
- the second index- Returns:
- the stub
- Throws:
IllegalArgumentException
- if the two indices are the same or either is null
-
isFixedRate
public boolean isFixedRate()
Checks if the stub has a fixed rate.- Returns:
- true if a fixed stub rate applies
-
isKnownAmount
public boolean isKnownAmount()
Checks if the stub has a known amount.- Returns:
- true if the stub has a known amount
-
isFloatingRate
public boolean isFloatingRate()
Checks if the stub has a floating rate.- Returns:
- true if a floating stub rate applies
-
isInterpolated
public boolean isInterpolated()
Checks if the stub has an interpolated rate.An interpolated rate exists when there are two different rates that need linear interpolation.
- Returns:
- true if linear interpolation applies
-
meta
public static IborRateStubCalculation.Meta meta()
The meta-bean forIborRateStubCalculation
.- Returns:
- the meta-bean, not null
-
builder
public static IborRateStubCalculation.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public IborRateStubCalculation.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getFixedRate
public OptionalDouble getFixedRate()
Gets the fixed rate to use in the stub. A 5% rate will be expressed as 0.05.In certain circumstances two counterparties agree a fixed rate for the stub. It is used in place of an observed fixing. Other calculation elements, such as gearing or spread, still apply.
If the fixed rate is present, then
knownAmount
,index
andindexInterpolated
must not be present.- Returns:
- the optional value of the property, not null
-
getKnownAmount
public Optional<CurrencyAmount> getKnownAmount()
Gets the known amount to pay/receive for the stub.If the known amount is present, then
fixedRate
,index
andindexInterpolated
must not be present.- Returns:
- the optional value of the property, not null
-
getIndex
public Optional<IborIndex> getIndex()
Gets the Ibor index to be used for the stub.This will be used throughout the stub unless
indexInterpolated
is present.If the index is present, then
fixedRate
andknownAmount
must not be present.- Returns:
- the optional value of the property, not null
-
getIndexInterpolated
public Optional<IborIndex> getIndexInterpolated()
Gets the second Ibor index to be used for the stub, linearly interpolated.This will be used with
index
to linearly interpolate the rate. This index may be shorter or longer thanindex
, but not the same.If the interpolated index is present, then
index
must also be present, andfixedRate
andknownAmount
must not be present.- Returns:
- the optional value of the property, not null
-
toBuilder
public IborRateStubCalculation.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-