Class ImmutableFraConvention
- java.lang.Object
-
- com.opengamma.strata.product.fra.type.ImmutableFraConvention
-
- All Implemented Interfaces:
Named
,FraConvention
,TradeConvention
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class ImmutableFraConvention extends Object implements FraConvention, org.joda.beans.ImmutableBean, Serializable
A market convention for forward rate agreement (FRA) trades.This defines the market convention for a FRA against a particular index. 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 name of the convention is the same as the name of the index by default. The getters will default any missing information on the fly, avoiding both null and
Optional
.The convention is defined by six dates.
- Trade date, the date that the trade is agreed
- Spot date, the base for date calculations, typically 2 business days after the trade date
- Start date, the date on which the implied deposit starts, typically a number of months after the spot date
- End date, the date on which the implied deposit ends, typically a number of months after the spot date
- Fixing date, the date on which the index is to be observed, typically 2 business days before the start date
- Payment date, the date on which payment is made, typically the same as the start date
FraTemplate
, not by this convention.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ImmutableFraConvention.Builder
The bean-builder forImmutableFraConvention
.static class
ImmutableFraConvention.Meta
The meta-bean forImmutableFraConvention
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableFraConvention.Builder
builder()
Returns a builder used to create an instance of the bean.FraTrade
createTrade(LocalDate tradeDate, Period periodToStart, Period periodToEnd, BuySell buySell, double notional, double fixedRate, ReferenceData refData)
Creates a trade based on this convention, specifying the end of the FRA.boolean
equals(Object obj)
BusinessDayAdjustment
getBusinessDayAdjustment()
Gets the business day adjustment to apply to the start and end date, providing a default result if no override specified.Currency
getCurrency()
Gets the primary currency, providing a default result if no override specified.DayCount
getDayCount()
Gets the day count convention applicable, providing a default result if no override specified.FraDiscountingMethod
getDiscounting()
Gets the method to use for discounting, providing a default result if no override specified.DaysAdjustment
getFixingDateOffset()
Gets the offset of the fixing date from the start date, providing a default result if no override specified.IborIndex
getIndex()
Gets the Ibor index.String
getName()
Gets the convention name, such as 'GBP-LIBOR-3M'.DaysAdjustment
getPaymentDateOffset()
Gets the offset of the payment date from the start date, providing a default result if no override specified.DaysAdjustment
getSpotDateOffset()
Gets the offset of the spot value date from the trade date, providing a default result if no override specified.int
hashCode()
static ImmutableFraConvention.Meta
meta()
The meta-bean forImmutableFraConvention
.ImmutableFraConvention.Meta
metaBean()
static ImmutableFraConvention
of(IborIndex index)
Obtains a convention based on the specified index.ImmutableFraConvention.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.String
toString()
FraTrade
toTrade(TradeInfo tradeInfo, LocalDate startDate, LocalDate endDate, LocalDate paymentDate, BuySell buySell, double notional, double fixedRate)
Creates a trade based on this convention.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.opengamma.strata.product.fra.type.FraConvention
calculateSpotDateFromTradeDate, createTrade, toTrade
-
-
-
-
Method Detail
-
of
public static ImmutableFraConvention of(IborIndex index)
Obtains a convention based on the specified index.The standard market convention for a FRA is based exclusively on the index. This creates an instance that contains the index. The instance is not dereferenced using the
FraConvention
name, as such the result of this method andFraConvention.of(IborIndex)
can differ.Use the builder for unusual conventions.
- Parameters:
index
- the index, the market convention values are extracted from the index- Returns:
- the convention
-
getName
public String getName()
Gets the convention name, such as 'GBP-LIBOR-3M'. This is the same as the name of the index by default.This will default to the name of the index if not specified.
- Specified by:
getName
in interfaceFraConvention
- Specified by:
getName
in interfaceNamed
- Returns:
- the convention name
-
getCurrency
public Currency getCurrency()
Gets the primary currency, providing a default result if no override specified.This is the currency of the FRA 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.
- Returns:
- the currency, 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.
- Returns:
- the day count, not null
-
getSpotDateOffset
public DaysAdjustment getSpotDateOffset()
Gets the offset of the spot value date from the trade date, providing a default result if no override specified.The offset is applied to the trade date and is typically plus 2 business days. The start and end date of the FRA term are relative to the spot date.
This will default to the effective date offset of the index if not specified.
- Specified by:
getSpotDateOffset
in interfaceFraConvention
- Returns:
- the spot date offset, not null
-
getBusinessDayAdjustment
public BusinessDayAdjustment getBusinessDayAdjustment()
Gets the business day adjustment to apply to the start and end date, providing a default result if no override specified.The start and end date are typically defined as valid business days and thus do not need to be adjusted. If this optional property is present, then the start and end date will be adjusted as defined here.
This will default to 'ModifiedFollowing' using the index fixing calendar if not specified.
- Returns:
- the business day adjustment, not null
-
getFixingDateOffset
public DaysAdjustment getFixingDateOffset()
Gets the offset of the fixing date from the start date, providing a default result if no override specified.The offset is applied to the start date and is typically minus 2 business days. The data model permits the offset to differ from that of the index, however the two are typically the same.
This will default to the fixing date offset of the index if not specified.
- Returns:
- the fixing date offset, not null
-
getPaymentDateOffset
public DaysAdjustment getPaymentDateOffset()
Gets the offset of the payment date from the start date, providing a default result if no override specified.Defines the offset from the start date to the payment date. In most cases, the payment date is the same as the start date, so the default of zero is appropriate.
This will default to zero if not specified.
- Returns:
- the payment date offset, not null
-
getDiscounting
public FraDiscountingMethod getDiscounting()
Gets the method to use for discounting, providing a default result if no override specified.There are different approaches FRA pricing in the area of discounting. This method specifies the approach for this FRA.
This will default 'AFMA' if the index has the currency 'AUD' or 'NZD' and to 'ISDA' otherwise.
- Returns:
- the discounting method, not null
-
createTrade
public FraTrade createTrade(LocalDate tradeDate, Period periodToStart, Period periodToEnd, BuySell buySell, double notional, double fixedRate, ReferenceData refData)
Description copied from interface:FraConvention
Creates a trade based on this convention, specifying the end of the FRA.This returns a trade based on the specified periods. For example, a '2 x 5' FRA has a period to the start date of 2 months and a period to the end date of 5 months.
The notional is unsigned, with buy/sell determining the direction of the trade. If buying the FRA, the floating rate is received from the counterparty, with the fixed rate being paid. If selling the FRA, the floating rate is paid to the counterparty, with the fixed rate being received.
The start date will be the trade date, plus spot offset, plus period to start, adjusted to a valid business day. The end date will be the trade date, plus spot offset, plus period to end, adjusted to a valid business day. The adjustment of the start and end date occurs at trade creation. The payment date offset is also applied at trade creation. When the Fra is resolved, the start and end date are not adjusted again but the payment date is.
- Specified by:
createTrade
in interfaceFraConvention
- Parameters:
tradeDate
- the date of the tradeperiodToStart
- the period between the spot date and the start dateperiodToEnd
- the period between the spot date and the end datebuySell
- the buy/sell flagnotional
- the notional amount, in the payment currency of the templatefixedRate
- the fixed rate, typically derived from the marketrefData
- the reference data, used to resolve the trade dates- Returns:
- the trade
-
toTrade
public FraTrade toTrade(TradeInfo tradeInfo, LocalDate startDate, LocalDate endDate, LocalDate paymentDate, BuySell buySell, double notional, double fixedRate)
Description copied from interface:FraConvention
Creates a trade based on this convention.This returns a trade based on the specified dates. The notional is unsigned, with buy/sell determining the direction of the trade. If buying the FRA, the floating rate is received from the counterparty, with the fixed rate being paid. If selling the FRA, the floating rate is paid to the counterparty, with the fixed rate being received.
- Specified by:
toTrade
in interfaceFraConvention
- Parameters:
tradeInfo
- additional information about the tradestartDate
- the start date, which should be adjusted to be a valid business dayendDate
- the end date, which should be adjusted to be a valid business daypaymentDate
- the payment date, which should be adjusted to be a valid business daybuySell
- the buy/sell flagnotional
- the notional amount, in the payment currency of the templatefixedRate
- the fixed rate, typically derived from the market- Returns:
- the trade
-
meta
public static ImmutableFraConvention.Meta meta()
The meta-bean forImmutableFraConvention
.- Returns:
- the meta-bean, not null
-
builder
public static ImmutableFraConvention.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public ImmutableFraConvention.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getIndex
public IborIndex getIndex()
Gets the Ibor index.The floating rate to be paid is based on this index It will be a well known market index such as 'GBP-LIBOR-3M'.
- Specified by:
getIndex
in interfaceFraConvention
- Returns:
- the value of the property, not null
-
toBuilder
public ImmutableFraConvention.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-