Class FraTemplate
- java.lang.Object
-
- com.opengamma.strata.product.fra.type.FraTemplate
-
- All Implemented Interfaces:
TradeTemplate
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class FraTemplate extends Object implements TradeTemplate, org.joda.beans.ImmutableBean, Serializable
A template for creating a forward rate agreement (FRA) trade.This defines almost all the data necessary to create a
FraTrade
. The trade date, notional and fixed rate are required to complete the template and create the trade. As such, it is often possible to get a market price for a trade based on the template. The market price is typically quoted as a bid/ask on the fixed rate.The template 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 value date
- End date, the date on which the implied deposit ends, typically a number of months after the spot value 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
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FraTemplate.Builder
The bean-builder forFraTemplate
.static class
FraTemplate.Meta
The meta-bean forFraTemplate
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FraTemplate.Builder
builder()
Returns a builder used to create an instance of the bean.FraTrade
createTrade(LocalDate tradeDate, BuySell buySell, double notional, double fixedRate, ReferenceData refData)
Creates a trade based on this template.boolean
equals(Object obj)
FraConvention
getConvention()
Gets the underlying FRA convention.Period
getPeriodToEnd()
Gets the period between the spot value date and the end date.Period
getPeriodToStart()
Gets the period between the spot value date and the start date.int
hashCode()
static FraTemplate.Meta
meta()
The meta-bean forFraTemplate
.FraTemplate.Meta
metaBean()
static FraTemplate
of(Period periodToStart, IborIndex index)
Obtains a template based on the specified period and index.static FraTemplate
of(Period periodToStart, Period periodToEnd, FraConvention convention)
Obtains a template based on the specified periods and convention.FraTemplate.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.String
toString()
-
-
-
Method Detail
-
of
public static FraTemplate of(Period periodToStart, IborIndex index)
Obtains a template based on the specified period and index.The period from the spot date to the start date is specified. The period from the spot date to the end date will be the period to start plus the tenor of the index.
For example, a '2 x 5' FRA has a period to the start date of 2 months. The index will be a 3 month index, such as 'USD-LIBOR-3M'. The period to the end date will be the period to the start date plus the index tenor.
- Parameters:
periodToStart
- the period between the spot date and the start dateindex
- the index that defines the market convention- Returns:
- the template
-
of
public static FraTemplate of(Period periodToStart, Period periodToEnd, FraConvention convention)
Obtains a template based on the specified periods and convention.The periods from the spot date to the start date and to the end date are specified.
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.
- Parameters:
periodToStart
- the period between the spot date and the start dateperiodToEnd
- the period between the spot date and the end dateconvention
- the market convention- Returns:
- the template
-
createTrade
public FraTrade createTrade(LocalDate tradeDate, BuySell buySell, double notional, double fixedRate, ReferenceData refData)
Creates a trade based on this template.This returns a trade based on the specified date. 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.
- Parameters:
tradeDate
- the date of the tradebuySell
- the buy/sell flag, seeFra.getBuySell()
notional
- 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
- Throws:
ReferenceDataNotFoundException
- if an identifier cannot be resolved in the reference data
-
meta
public static FraTemplate.Meta meta()
The meta-bean forFraTemplate
.- Returns:
- the meta-bean, not null
-
builder
public static FraTemplate.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public FraTemplate.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getPeriodToStart
public Period getPeriodToStart()
Gets the period between the spot value date and the start date.In a FRA described as '2 x 5', the period to the start date is 2 months.
- Returns:
- the value of the property, not null
-
getPeriodToEnd
public Period getPeriodToEnd()
Gets the period between the spot value date and the end date.In a FRA described as '2 x 5', the period to the end date is 5 months. The difference between the start date and the end date typically matches the tenor of the index, however this is not validated.
When building, this will default to the period to start plus the tenor of the index if not specified.
- Returns:
- the value of the property, not null
-
getConvention
public FraConvention getConvention()
Gets the underlying FRA convention.This specifies the market convention of the FRA to be created.
- Returns:
- the value of the property, not null
-
toBuilder
public FraTemplate.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-