public final class FxSwap extends Object implements FxProduct, Resolvable<ResolvedFxSwap>, org.joda.beans.ImmutableBean, Serializable
An FX swap is a financial instrument that represents the exchange of an equivalent amount in two different currencies between counterparties on two different dates.
The two exchanges are based on the same currency pair, with the two payment flows in the opposite directions.
For example, an FX swap might represent the payment of USD 1,000 and the receipt of EUR 932 on one date, and the payment of EUR 941 and the receipt of USD 1,000 at a later date.
| Modifier and Type | Class and Description |
|---|---|
static class |
FxSwap.Meta
The meta-bean for
FxSwap. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
CurrencyPair |
getCurrencyPair()
Gets the currency pair in conventional order.
|
FxSingle |
getFarLeg()
Gets the foreign exchange transaction at the later date.
|
FxSingle |
getNearLeg()
Gets the foreign exchange transaction at the earlier date.
|
int |
hashCode() |
static FxSwap.Meta |
meta()
The meta-bean for
FxSwap. |
FxSwap.Meta |
metaBean() |
static FxSwap |
of(CurrencyAmount amount,
FxRate nearRate,
LocalDate nearDate,
FxRate farRate,
LocalDate farDate)
Creates an
FxSwap using two FX rates, near and far, specifying a date adjustment. |
static FxSwap |
of(CurrencyAmount amount,
FxRate nearRate,
LocalDate nearDate,
FxRate farRate,
LocalDate farDate,
BusinessDayAdjustment paymentDateAdjustment)
Creates an
FxSwap using two FX rates, near and far, specifying a date adjustment. |
static FxSwap |
of(FxSingle nearLeg,
FxSingle farLeg)
Creates an
FxSwap from two transactions. |
static FxSwap |
ofForwardPoints(CurrencyAmount amount,
FxRate nearRate,
double decimalForwardPoints,
LocalDate nearDate,
LocalDate farDate)
Creates an
FxSwap using decimal forward points. |
static FxSwap |
ofForwardPoints(CurrencyAmount amount,
FxRate nearRate,
double decimalForwardPoints,
LocalDate nearDate,
LocalDate farDate,
BusinessDayAdjustment paymentDateAdjustment)
Creates an
FxSwap using decimal forward points, specifying a date adjustment. |
ResolvedFxSwap |
resolve(ReferenceData refData) |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitallCurrencies, isCrossCurrencyallPaymentCurrenciespublic static FxSwap of(FxSingle nearLeg, FxSingle farLeg)
FxSwap from two transactions.
The transactions must be passed in with value dates in the correct order. The currency pair of each leg must match and have amounts flowing in opposite directions.
nearLeg - the earlier legfarLeg - the later legpublic static FxSwap of(CurrencyAmount amount, FxRate nearRate, LocalDate nearDate, FxRate farRate, LocalDate farDate)
FxSwap using two FX rates, near and far, specifying a date adjustment.
The FX rate at the near date is specified as nearRate.
The FX rate at the far date is specified as farRate.
The FX rates must have the same currency pair.
The two currencies are specified by the FX rates. The amount must be specified using one of the currencies of the near FX rate. The near date must be before the far date. Conventions will be used to determine the base and counter currency.
amount - the amount being exchanged, positive if being received in the near leg, negative if being paidnearRate - the near FX ratefarRate - the far FX ratenearDate - the near value datefarDate - the far value dateIllegalArgumentException - if the FX rate and amount do not have a currency in common,
or if the FX rate currencies differpublic static FxSwap of(CurrencyAmount amount, FxRate nearRate, LocalDate nearDate, FxRate farRate, LocalDate farDate, BusinessDayAdjustment paymentDateAdjustment)
FxSwap using two FX rates, near and far, specifying a date adjustment.
The FX rate at the near date is specified as nearRate.
The FX rate at the far date is specified as farRate.
The FX rates must have the same currency pair.
The two currencies are specified by the FX rates. The amount must be specified using one of the currencies of the near FX rate. The near date must be before the far date. Conventions will be used to determine the base and counter currency.
amount - the amount being exchanged, positive if being received in the near leg, negative if being paidnearRate - the near FX ratefarRate - the far FX ratenearDate - the near value datefarDate - the far value datepaymentDateAdjustment - the adjustment to apply to the payment datesIllegalArgumentException - if the FX rate and amount do not have a currency in common,
or if the FX rate currencies differpublic static FxSwap ofForwardPoints(CurrencyAmount amount, FxRate nearRate, double decimalForwardPoints, LocalDate nearDate, LocalDate farDate)
FxSwap using decimal forward points.
The FX rate at the near date is specified as nearRate.
The FX rate at the far date is equal to nearRate + forwardPoints.
Thus "FX forward spread" might be a better name for the concept.
The two currencies are specified by the near FX rate. The amount must be specified using one of the currencies of the near FX rate. The near date must be before the far date. Conventions will be used to determine the base and counter currency.
amount - the amount being exchanged, positive if being received in the near leg, negative if being paidnearRate - the near FX ratedecimalForwardPoints - the decimal forward points, where the far FX rate is (nearRate + forwardPoints)nearDate - the near value datefarDate - the far value dateIllegalArgumentException - if the FX rate and amount do not have a currency in commonpublic static FxSwap ofForwardPoints(CurrencyAmount amount, FxRate nearRate, double decimalForwardPoints, LocalDate nearDate, LocalDate farDate, BusinessDayAdjustment paymentDateAdjustment)
FxSwap using decimal forward points, specifying a date adjustment.
The FX rate at the near date is specified as nearRate.
The FX rate at the far date is equal to nearRate + forwardPoints
Thus "FX forward spread" might be a better name for the concept.
The two currencies are specified by the near FX rate. The amount must be specified using one of the currencies of the near FX rate. The near date must be before the far date. Conventions will be used to determine the base and counter currency.
amount - the amount being exchanged, positive if being received in the near leg, negative if being paidnearRate - the near FX ratedecimalForwardPoints - the decimal forward points, where the far FX rate is (nearRate + forwardPoints)nearDate - the near value datefarDate - the far value datepaymentDateAdjustment - the adjustment to apply to the payment datesIllegalArgumentException - if the FX rate and amount do not have a currency in commonpublic CurrencyPair getCurrencyPair()
getCurrencyPair in interface FxProductpublic ResolvedFxSwap resolve(ReferenceData refData)
resolve in interface Resolvable<ResolvedFxSwap>public static FxSwap.Meta meta()
FxSwap.public FxSwap.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic FxSingle getNearLeg()
This provides details of a single foreign exchange at a specific date. The payment date of this transaction must be before that of the far leg.
public FxSingle getFarLeg()
This provides details of a single foreign exchange at a specific date. The payment date of this transaction must be after that of the near leg.
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.