Class ImmutableFxSwapConvention
- java.lang.Object
-
- com.opengamma.strata.product.fx.type.ImmutableFxSwapConvention
-
- All Implemented Interfaces:
Named
,FxSwapConvention
,TradeConvention
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class ImmutableFxSwapConvention extends Object implements FxSwapConvention, org.joda.beans.ImmutableBean, Serializable
A market convention for FX swap tradesThis defines the market convention for a FX swap based on a particular currency pair.
The convention is defined by four 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
- Near date, the date on which the near leg of the swap is exchanged, typically equal to the spot date
- Far date, the date on which the far leg of the swap is exchanged, typically a number of months or years after the spot date
FxSwapTemplate
, not by this convention.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ImmutableFxSwapConvention.Builder
The bean-builder forImmutableFxSwapConvention
.static class
ImmutableFxSwapConvention.Meta
The meta-bean forImmutableFxSwapConvention
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableFxSwapConvention.Builder
builder()
Returns a builder used to create an instance of the bean.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.CurrencyPair
getCurrencyPair()
Gets the currency pair associated with the convention.String
getName()
Gets the name that uniquely identifies this convention.DaysAdjustment
getSpotDateOffset()
Gets the offset of the spot value date from the trade date.int
hashCode()
static ImmutableFxSwapConvention.Meta
meta()
The meta-bean forImmutableFxSwapConvention
.ImmutableFxSwapConvention.Meta
metaBean()
static ImmutableFxSwapConvention
of(CurrencyPair currencyPair, DaysAdjustment spotDateOffset)
Obtains a convention based on the specified currency pair and spot date offset.static ImmutableFxSwapConvention
of(CurrencyPair currencyPair, DaysAdjustment spotDateOffset, BusinessDayAdjustment businessDayAdjustment)
Obtains a convention based on the specified currency pair, spot date offset and adjustment.ImmutableFxSwapConvention.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.String
toString()
FxSwapTrade
toTrade(TradeInfo tradeInfo, LocalDate startDate, LocalDate endDate, BuySell buySell, double notional, double nearFxRate, double farLegForwardPoints)
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.fx.type.FxSwapConvention
calculateSpotDateFromTradeDate, createTrade, createTrade, toTrade
-
-
-
-
Method Detail
-
of
public static ImmutableFxSwapConvention of(CurrencyPair currencyPair, DaysAdjustment spotDateOffset)
Obtains a convention based on the specified currency pair and spot date offset.Use the builder for unusual conventions.
- Parameters:
currencyPair
- the currency pair associated to the conventionspotDateOffset
- the spot date offset- Returns:
- the convention
-
of
public static ImmutableFxSwapConvention of(CurrencyPair currencyPair, DaysAdjustment spotDateOffset, BusinessDayAdjustment businessDayAdjustment)
Obtains a convention based on the specified currency pair, spot date offset and adjustment.Use the builder for unusual conventions.
- Parameters:
currencyPair
- the currency pair associated to the conventionspotDateOffset
- the spot date offsetbusinessDayAdjustment
- the business day adjustment to apply- Returns:
- the convention
-
getName
public String getName()
Description copied from interface:FxSwapConvention
Gets the name that uniquely identifies this convention.This name is used in serialization and can be parsed using
FxSwapConvention.of(String)
.- Specified by:
getName
in interfaceFxSwapConvention
- Specified by:
getName
in interfaceNamed
- Returns:
- the unique name
-
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 spot date offset calendar if not specified.
- Returns:
- the business day adjustment, not null
-
toTrade
public FxSwapTrade toTrade(TradeInfo tradeInfo, LocalDate startDate, LocalDate endDate, BuySell buySell, double notional, double nearFxRate, double farLegForwardPoints)
Description copied from interface:FxSwapConvention
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 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.
- Specified by:
toTrade
in interfaceFxSwapConvention
- Parameters:
tradeInfo
- additional information about the tradestartDate
- the start dateendDate
- the end datebuySell
- the buy/sell flagnotional
- the notional amount, in the payment currency of the templatenearFxRate
- the FX rate for the near legfarLegForwardPoints
- the FX points to be added to the FX rate at the far leg- Returns:
- the trade
-
meta
public static ImmutableFxSwapConvention.Meta meta()
The meta-bean forImmutableFxSwapConvention
.- Returns:
- the meta-bean, not null
-
builder
public static ImmutableFxSwapConvention.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public ImmutableFxSwapConvention.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getCurrencyPair
public CurrencyPair getCurrencyPair()
Gets the currency pair associated with the convention.- Specified by:
getCurrencyPair
in interfaceFxSwapConvention
- Returns:
- the value of the property, not null
-
getSpotDateOffset
public DaysAdjustment getSpotDateOffset()
Gets the offset of the spot value date from the trade date.The offset is applied to the trade date and is typically plus 2 business days in the joint calendar of the two currencies. The start and end date of the FX swap are relative to the spot date.
- Specified by:
getSpotDateOffset
in interfaceFxSwapConvention
- Returns:
- the value of the property, not null
-
toBuilder
public ImmutableFxSwapConvention.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-