public interface SingleCurrencySwapConvention extends TradeConvention, Named
This defines the market convention for a a swap. Each different type of swap has its own convention - this interface provides an abstraction.
| Modifier and Type | Method and Description |
|---|---|
default LocalDate |
calculateSpotDateFromTradeDate(LocalDate tradeDate,
ReferenceData refData)
Calculates the spot date from the trade date.
|
default SwapTrade |
createTrade(LocalDate tradeDate,
Period periodToStart,
Tenor tenor,
BuySell buySell,
double notional,
double fixedRateOrSpread,
ReferenceData refData)
Creates a forward-starting trade based on this convention.
|
default SwapTrade |
createTrade(LocalDate tradeDate,
Tenor tenor,
BuySell buySell,
double notional,
double fixedRateOrSpread,
ReferenceData refData)
Creates a spot-starting trade based on this 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 SingleCurrencySwapConvention |
of(String uniqueName)
Obtains an instance from the specified unique name.
|
default SwapTrade |
toTrade(LocalDate tradeDate,
LocalDate startDate,
LocalDate endDate,
BuySell buySell,
double notional,
double fixedRateOrSpread)
Creates a trade based on this convention.
|
SwapTrade |
toTrade(TradeInfo tradeInfo,
LocalDate startDate,
LocalDate endDate,
BuySell buySell,
double notional,
double fixedRateOrSpread)
Creates a trade based on this convention.
|
static SingleCurrencySwapConvention of(String uniqueName)
uniqueName - the unique nameIllegalArgumentException - if the name is not knownDaysAdjustment getSpotDateOffset()
The offset is applied to the trade date to find the start date. A typical value is "plus 2 business days".
default SwapTrade createTrade(LocalDate tradeDate, Tenor tenor, BuySell buySell, double notional, double fixedRateOrSpread, ReferenceData refData)
This returns a trade based on the specified tenor. For example, a tenor of 5 years creates a swap starting on the spot date and maturing 5 years later.
See the instrument-level documentation to understand how the fixed rate or spread is applied.
tradeDate - the date of the tradetenor - the tenor of the swapbuySell - the buy/sell flagnotional - the notional amountfixedRateOrSpread - the fixed rate or spread in decimal form, typically derived from the marketrefData - the reference data, used to resolve the trade datesReferenceDataNotFoundException - if an identifier cannot be resolved in the reference datadefault SwapTrade createTrade(LocalDate tradeDate, Period periodToStart, Tenor tenor, BuySell buySell, double notional, double fixedRateOrSpread, ReferenceData refData)
This returns a trade based on the specified period and tenor. For example, a period of 3 months and a tenor of 5 years creates a swap starting three months after the spot date and maturing 5 years later.
See the instrument-level documentation to understand how the fixed rate or spread is applied.
tradeDate - the date of the tradeperiodToStart - the period between the spot date and the start datetenor - the tenor of the swapbuySell - the buy/sell flagnotional - the notional amountfixedRateOrSpread - the fixed rate or spread in decimal form, typically derived from the marketrefData - the reference data, used to resolve the trade datesReferenceDataNotFoundException - if an identifier cannot be resolved in the reference datadefault SwapTrade toTrade(LocalDate tradeDate, LocalDate startDate, LocalDate endDate, BuySell buySell, double notional, double fixedRateOrSpread)
This returns a trade based on the specified dates.
See the instrument-level documentation to understand how the fixed rate or spread is applied.
tradeDate - the date of the tradestartDate - the start dateendDate - the end datebuySell - the buy/sell flagnotional - the notional amountfixedRateOrSpread - the fixed rate or spread in decimal form, typically derived from the marketSwapTrade toTrade(TradeInfo tradeInfo, LocalDate startDate, LocalDate endDate, BuySell buySell, double notional, double fixedRateOrSpread)
This returns a trade based on the specified dates.
See the instrument-level documentation to understand how the fixed rate or spread is applied.
tradeInfo - additional information about the tradestartDate - the start dateendDate - the end datebuySell - the buy/sell flagnotional - the notional amountfixedRateOrSpread - the fixed rate or spread in decimal form, typically derived from the marketdefault LocalDate calculateSpotDateFromTradeDate(LocalDate tradeDate, ReferenceData refData)
tradeDate - the trade daterefData - the reference data, used to resolve the dateReferenceDataNotFoundException - if an identifier cannot be resolved in the reference dataString getName()
This name is used in serialization and can be parsed using of(String).
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.