## Interface FxSwapConvention

• All Superinterfaces:
Named, TradeConvention
All Known Implementing Classes:
ImmutableFxSwapConvention

public interface FxSwapConvention
extends TradeConvention, Named
A market convention for FX Swap trades.

This defines the market convention for a FX swap based on a particular currency pair.

To manually create a convention, see ImmutableFxSwapConvention. To register a specific convention, see FxSwapConvention.ini.

• ### Method Summary

All Methods
Modifier and Type Method Description
default LocalDate calculateSpotDateFromTradeDate​(LocalDate tradeDate, ReferenceData refData)
Calculates the spot date from the trade date.
default FxSwapTrade createTrade​(LocalDate tradeDate, MarketTenor marketTenor, BuySell buySell, double notional, double nearFxRate, double farLegForwardPoints, ReferenceData refData)
Creates a trade based on this convention using a market tenor, such as ON, TN, SN, SW or 1M.
default FxSwapTrade createTrade​(LocalDate tradeDate, Period periodToNear, Period periodToFar, BuySell buySell, double notional, double nearFxRate, double farLegForwardPoints, ReferenceData refData)
Creates a trade based on this convention.
static ExtendedEnum<FxSwapConvention> extendedEnum()
Gets the extended enum helper.
CurrencyPair getCurrencyPair()
Gets the currency pair of 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.
static FxSwapConvention of​(CurrencyPair currencyPair)
Obtains the standard convention for the specified currency pair.
static FxSwapConvention of​(String uniqueName)
Obtains an instance from the specified unique name.
FxSwapTrade toTrade​(TradeInfo tradeInfo, LocalDate startDate, LocalDate endDate, BuySell buySell, double notional, double nearFxRate, double farLegForwardPoints)
Creates a trade based on this convention.
default FxSwapTrade toTrade​(LocalDate tradeDate, LocalDate startDate, LocalDate endDate, BuySell buySell, double notional, double nearFxRate, double farLegForwardPoints)
Creates a trade based on this convention.
• ### Method Detail

• #### of

static FxSwapConvention of​(String uniqueName)
Obtains an instance from the specified unique name.
Parameters:
uniqueName - the unique name
Returns:
the convention
Throws:
IllegalArgumentException - if the name is not known
• #### of

static FxSwapConvention of​(CurrencyPair currencyPair)
Obtains the standard convention for the specified currency pair.

The convention accessed will be for the conventional order of the currency pair.

Parameters:
currencyPair - the currency pair to get the convention for
Returns:
the convention
Throws:
IllegalArgumentException - if no convention has been defined for the pair
• #### extendedEnum

static ExtendedEnum<FxSwapConvention> extendedEnum()
Gets the extended enum helper.

This helper allows instances of the convention to be looked up. It also provides the complete set of available instances.

Returns:
the extended enum helper
• #### getCurrencyPair

CurrencyPair getCurrencyPair()
Gets the currency pair of the convention.
Returns:
the currency pair
• #### getSpotDateOffset

DaysAdjustment getSpotDateOffset()
Gets the offset of the spot value date from the trade date.

The offset is applied to the trade date to find the start date. A typical value is "plus 2 business days".

Returns:
the spot date offset, not null

default FxSwapTrade createTrade​(LocalDate tradeDate,
MarketTenor marketTenor,
double notional,
double nearFxRate,
double farLegForwardPoints,
ReferenceData refData)
Creates a trade based on this convention using a market tenor, such as ON, TN, SN, SW or 1M.

This returns a trade based on the market tenor. If the market tenor is ON or TN, the spot lag of the convention will be overridden.

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.

Parameters:
tradeDate - the date of the trade
marketTenor - the market tenor, defining the spot lag and tenor
buySell - the buy/sell flag
notional - the notional amount, in the first currency of the currency pair
nearFxRate - the FX rate for the near leg
farLegForwardPoints - the FX points to be added to the FX rate at the far leg
refData - the reference data, used to resolve the trade dates
Returns:
Throws:
ReferenceDataNotFoundException - if an identifier cannot be resolved in the reference data

default FxSwapTrade createTrade​(LocalDate tradeDate,
Period periodToNear,
Period periodToFar,
double notional,
double nearFxRate,
double farLegForwardPoints,
ReferenceData refData)
Creates a trade based on this convention.

This returns a trade based on the specified periods, starting from the spot date. 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 end date of 6 months

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.

Parameters:
tradeDate - the date of the trade
periodToNear - the period between the spot date and the near date
periodToFar - the period between the spot date and the far date
buySell - the buy/sell flag
notional - the notional amount, in the first currency of the currency pair
nearFxRate - the FX rate for the near leg
farLegForwardPoints - the FX points to be added to the FX rate at the far leg
refData - the reference data, used to resolve the trade dates
Returns:
Throws:
ReferenceDataNotFoundException - if an identifier cannot be resolved in the reference data

default FxSwapTrade toTrade​(LocalDate tradeDate,
LocalDate startDate,
LocalDate endDate,
double notional,
double nearFxRate,
double farLegForwardPoints)
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.

Parameters:
tradeDate - the date of the trade
startDate - the start date
endDate - the end date
buySell - the buy/sell flag
notional - the notional amount, in the payment currency of the template
nearFxRate - the FX rate for the near leg
farLegForwardPoints - the FX points to be added to the FX rate at the far leg
Returns:

FxSwapTrade toTrade​(TradeInfo tradeInfo,
LocalDate startDate,
LocalDate endDate,
double notional,
double nearFxRate,
double farLegForwardPoints)
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.

Parameters:
tradeInfo - additional information about the trade
startDate - the start date
endDate - the end date
buySell - the buy/sell flag
notional - the notional amount, in the payment currency of the template
nearFxRate - the FX rate for the near leg
farLegForwardPoints - the FX points to be added to the FX rate at the far leg
Returns:

default LocalDate calculateSpotDateFromTradeDate​(LocalDate tradeDate,
ReferenceData refData)
Calculates the spot date from the trade date.
Parameters:
tradeDate - the trade date
refData - the reference data, used to resolve the date
Returns:
the spot date
Throws:
ReferenceDataNotFoundException - if an identifier cannot be resolved in the reference data
• #### getName

String getName()
Gets the name that uniquely identifies this convention.

This name is used in serialization and can be parsed using of(String).

Specified by:
getName in interface Named
Returns:
the unique name