public final class FraTemplate extends Object implements TradeTemplate, org.joda.beans.ImmutableBean, Serializable
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
FraTemplate.Builder
The bean-builder for
FraTemplate. |
static class |
FraTemplate.Meta
The meta-bean for
FraTemplate. |
| Modifier and Type | Method and 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 for
FraTemplate. |
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() |
public static FraTemplate of(Period periodToStart, IborIndex 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.
periodToStart - the period between the spot date and the start dateindex - the index that defines the market conventionpublic static FraTemplate of(Period periodToStart, Period periodToEnd, FraConvention 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.
periodToStart - the period between the spot date and the start dateperiodToEnd - the period between the spot date and the end dateconvention - the market conventionpublic FraTrade createTrade(LocalDate tradeDate, BuySell buySell, double notional, double fixedRate, ReferenceData refData)
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.
tradeDate - the date of the tradebuySell - the buy/sell flag, see Fra.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 datesReferenceDataNotFoundException - if an identifier cannot be resolved in the reference datapublic static FraTemplate.Meta meta()
FraTemplate.public static FraTemplate.Builder builder()
public FraTemplate.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic Period getPeriodToStart()
In a FRA described as '2 x 5', the period to the start date is 2 months.
public Period getPeriodToEnd()
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.
public FraConvention getConvention()
This specifies the market convention of the FRA to be created.
public FraTemplate.Builder toBuilder()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.