net.finmath.marketdata.products
Class Swap
- java.lang.Object
-
- net.finmath.marketdata.products.AbstractAnalyticProduct
-
- net.finmath.marketdata.products.Swap
-
- All Implemented Interfaces:
- AnalyticProductInterface, ProductInterface
public class Swap extends AbstractAnalyticProduct implements AnalyticProductInterface
Implements the valuation of a swap using curves (discount curve, forward curve). The swap valuation supports distinct discounting and forward curve. Support for day counting is limited to the capabilities ofTimeDiscretizationInterface. The swap is just the composition of twoSwapLegs, namely the receiver leg and the payer leg. The value of the swap is the value of the receiver leg minus the value of the payer leg.
-
-
Constructor Summary
Constructors Constructor and Description Swap(ScheduleInterface scheduleReceiveLeg, double spreadReceive, java.lang.String discountCurveReceiveName, ScheduleInterface schedulePayLeg, java.lang.String forwardCurvePayName, java.lang.String discountCurvePayName)Creates a swap with notional exchange.Swap(ScheduleInterface scheduleReceiveLeg, java.lang.String forwardCurveReceiveName, double spreadReceive, java.lang.String discountCurveReceiveName, ScheduleInterface schedulePayLeg, java.lang.String forwardCurvePayName, double spreadPay, java.lang.String discountCurvePayName)Creates a swap with notional exchange.Swap(ScheduleInterface scheduleReceiveLeg, java.lang.String forwardCurveReceiveName, double spreadReceive, java.lang.String discountCurveReceiveName, ScheduleInterface schedulePayLeg, java.lang.String forwardCurvePayName, double spreadPay, java.lang.String discountCurvePayName, boolean isNotionalExchanged)Creates a swap with notional exchange.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static doublegetForwardSwapRate(ScheduleInterface fixSchedule, ScheduleInterface floatSchedule, ForwardCurveInterface forwardCurve)static doublegetForwardSwapRate(ScheduleInterface fixSchedule, ScheduleInterface floatSchedule, ForwardCurveInterface forwardCurve, AnalyticModelInterface model)static doublegetForwardSwapRate(TimeDiscretizationInterface fixTenor, TimeDiscretizationInterface floatTenor, ForwardCurveInterface forwardCurve)static doublegetForwardSwapRate(TimeDiscretizationInterface fixTenor, TimeDiscretizationInterface floatTenor, ForwardCurveInterface forwardCurve, DiscountCurveInterface discountCurve)SwapLeggetLegPayer()Return the payer leg of the swap, i.e.SwapLeggetLegReceiver()Return the receiver leg of the swap, i.e.doublegetValue(double evaluationTime, AnalyticModelInterface model)Return the valuation of the product using the given model.java.lang.StringtoString()-
Methods inherited from class net.finmath.marketdata.products.AbstractAnalyticProduct
getValue, getValue
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.finmath.modelling.ProductInterface
getValue
-
-
-
-
Constructor Detail
-
Swap
public Swap(ScheduleInterface scheduleReceiveLeg, java.lang.String forwardCurveReceiveName, double spreadReceive, java.lang.String discountCurveReceiveName, ScheduleInterface schedulePayLeg, java.lang.String forwardCurvePayName, double spreadPay, java.lang.String discountCurvePayName, boolean isNotionalExchanged)
Creates a swap with notional exchange. The swap has a unit notional of 1.- Parameters:
scheduleReceiveLeg- Schedule of the receiver leg.forwardCurveReceiveName- Name of the forward curve, leave empty if this is a fix leg.spreadReceive- Fixed spread on the forward or fix rate.discountCurveReceiveName- Name of the discount curve for the receiver leg.schedulePayLeg- Schedule of the payer leg.forwardCurvePayName- Name of the forward curve, leave empty if this is a fix leg.spreadPay- Fixed spread on the forward or fix rate.discountCurvePayName- Name of the discount curve for the payer leg.isNotionalExchanged- If true, both leg will pay notional at the beginning of each swap period and receive notional at the end of the swap period. Note that the cash flow date for the notional is periodStart and periodEnd (not fixingDate and paymentDate).
-
Swap
public Swap(ScheduleInterface scheduleReceiveLeg, java.lang.String forwardCurveReceiveName, double spreadReceive, java.lang.String discountCurveReceiveName, ScheduleInterface schedulePayLeg, java.lang.String forwardCurvePayName, double spreadPay, java.lang.String discountCurvePayName)
Creates a swap with notional exchange. The swap has a unit notional of 1.- Parameters:
scheduleReceiveLeg- Schedule of the receiver leg.forwardCurveReceiveName- Name of the forward curve, leave empty if this is a fix leg.spreadReceive- Fixed spread on the forward or fix rate.discountCurveReceiveName- Name of the discount curve for the receiver leg.schedulePayLeg- Schedule of the payer leg.forwardCurvePayName- Name of the forward curve, leave empty if this is a fix leg.spreadPay- Fixed spread on the forward or fix rate.discountCurvePayName- Name of the discount curve for the payer leg.
-
Swap
public Swap(ScheduleInterface scheduleReceiveLeg, double spreadReceive, java.lang.String discountCurveReceiveName, ScheduleInterface schedulePayLeg, java.lang.String forwardCurvePayName, java.lang.String discountCurvePayName)
Creates a swap with notional exchange. The swap has a unit notional of 1.- Parameters:
scheduleReceiveLeg- Schedule of the receiver leg.spreadReceive- Fixed spread on the forward or fix rate.discountCurveReceiveName- Name of the discount curve for the receiver leg.schedulePayLeg- Schedule of the payer leg.forwardCurvePayName- Name of the forward curve, leave empty if this is a fix leg.discountCurvePayName- Name of the discount curve for the payer leg.
-
-
Method Detail
-
getValue
public double getValue(double evaluationTime, AnalyticModelInterface model)Description copied from interface:AnalyticProductInterfaceReturn the valuation of the product using the given model. The model has to implement the modes ofAnalyticModelInterface.- Specified by:
getValuein interfaceAnalyticProductInterface- Parameters:
evaluationTime- The evaluation time as double. Cash flows prior and including this time are not considered.model- The model under which the product is valued.- Returns:
- The value of the product using the given model.
-
getForwardSwapRate
public static double getForwardSwapRate(TimeDiscretizationInterface fixTenor, TimeDiscretizationInterface floatTenor, ForwardCurveInterface forwardCurve)
-
getForwardSwapRate
public static double getForwardSwapRate(TimeDiscretizationInterface fixTenor, TimeDiscretizationInterface floatTenor, ForwardCurveInterface forwardCurve, DiscountCurveInterface discountCurve)
-
getForwardSwapRate
public static double getForwardSwapRate(ScheduleInterface fixSchedule, ScheduleInterface floatSchedule, ForwardCurveInterface forwardCurve)
-
getForwardSwapRate
public static double getForwardSwapRate(ScheduleInterface fixSchedule, ScheduleInterface floatSchedule, ForwardCurveInterface forwardCurve, AnalyticModelInterface model)
-
getLegReceiver
public SwapLeg getLegReceiver()
Return the receiver leg of the swap, i.e. the leg who's value is added to the swap value.- Returns:
- The receiver leg of the swap.
-
getLegPayer
public SwapLeg getLegPayer()
Return the payer leg of the swap, i.e. the leg who's value is subtracted from the swap value.- Returns:
- The payer leg of the swap.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG