public final class FxSwapTemplate extends Object implements TradeTemplate, org.joda.beans.ImmutableBean, Serializable
This defines almost all the data necessary to create a FxSwapTrade.
The trade date, notional, FX rate and forward points 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 convention is defined by four dates.
| Modifier and Type | Class and Description |
|---|---|
static class |
FxSwapTemplate.Builder
The bean-builder for
FxSwapTemplate. |
static class |
FxSwapTemplate.Meta
The meta-bean for
FxSwapTemplate. |
| Modifier and Type | Method and Description |
|---|---|
static FxSwapTemplate.Builder |
builder()
Returns a builder used to create an instance of the bean.
|
FxSwapTrade |
createTrade(LocalDate tradeDate,
BuySell buySell,
Currency buySellCurrency,
double buySellNotional,
double nearFxRate,
double forwardPoints,
ReferenceData refData)
Creates a trade based on this template.
|
FxSwapTrade |
createTrade(LocalDate tradeDate,
BuySell buySell,
double notional,
double nearFxRate,
double forwardPoints,
ReferenceData refData)
Creates a trade based on this template.
|
boolean |
equals(Object obj) |
FxSwapConvention |
getConvention()
Gets the underlying FX Swap convention.
|
CurrencyPair |
getCurrencyPair()
Gets the currency pair of the template.
|
Period |
getPeriodToFar()
Gets the period between the spot value date and the far date.
|
Period |
getPeriodToNear()
Gets the period between the spot value date and the near date.
|
int |
hashCode() |
static FxSwapTemplate.Meta |
meta()
The meta-bean for
FxSwapTemplate. |
FxSwapTemplate.Meta |
metaBean() |
static FxSwapTemplate |
of(Period periodToFar,
FxSwapConvention convention)
Obtains a template based on the specified period and convention.
|
static FxSwapTemplate |
of(Period periodToNear,
Period periodToFar,
FxSwapConvention convention)
Obtains a template based on the specified periods and convention.
|
FxSwapTemplate.Builder |
toBuilder()
Returns a builder that allows this bean to be mutated.
|
String |
toString() |
public static FxSwapTemplate of(Period periodToFar, FxSwapConvention convention)
The near date is equal to the spot date. The period from the spot date to the far date is specified
For example, a '6M' FX swap has a near leg on the spot date and a period from spot to the far date of 6 months
periodToFar - the period between the spot date and the far dateconvention - the market conventionpublic static FxSwapTemplate of(Period periodToNear, Period periodToFar, FxSwapConvention convention)
Both the period from the spot date to the near date and far date are specified.
For example, a '3M x 6M' FX swap has a period from spot to the start date of 3 months and a period from spot to the far date of 6 months
periodToNear - the period between the spot date and the near dateperiodToFar - the period between the spot date and the far dateconvention - the market conventionpublic CurrencyPair getCurrencyPair()
public FxSwapTrade createTrade(LocalDate tradeDate, BuySell buySell, double notional, double nearFxRate, double forwardPoints, 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 FX Swap, the amount in the first currency of the pair is received in the near leg and paid in the far leg, while the second currency is paid in the near leg and received in the far leg.
tradeDate - the date of the tradebuySell - the buy/sell flagnotional - the notional amount, in the first currency of the currency pairnearFxRate - the FX rate for the near legforwardPoints - the FX points to be added to the FX rate at the far legrefData - the reference data, used to resolve the trade datesReferenceDataNotFoundException - if an identifier cannot be resolved in the reference datapublic FxSwapTrade createTrade(LocalDate tradeDate, BuySell buySell, Currency buySellCurrency, double buySellNotional, double nearFxRate, double forwardPoints, 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 FX Swap, the amount in the specified currency is received in the near leg and paid in the far leg.
tradeDate - the date of the tradebuySell - the buy/sell flagbuySellCurrency - the currency being bought/soldbuySellNotional - the unsigned notional amount, in the buy/sell currencynearFxRate - the FX rate for the near legforwardPoints - the FX points to be added to the FX rate at the far legrefData - the reference data, used to resolve the trade datesReferenceDataNotFoundException - if an identifier cannot be resolved in the reference datapublic static FxSwapTemplate.Meta meta()
FxSwapTemplate.public static FxSwapTemplate.Builder builder()
public FxSwapTemplate.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic Period getPeriodToNear()
For example, a '3M x 6M' FX swap has a period from spot to the near date of 3 months
public Period getPeriodToFar()
For example, a '3M x 6M' FX swap has a period from spot to the far date of 6 months
public FxSwapConvention getConvention()
This specifies the market convention of the FX Swap to be created.
public FxSwapTemplate.Builder toBuilder()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.