Class Swap
java.lang.Object
net.finmath.finitedifference.interestrate.products.Swap
- All Implemented Interfaces:
FiniteDifferenceProduct<FiniteDifferenceInterestRateModel>, FiniteDifferenceInterestRateProduct, Product
Finite-difference valuation of a reduced-scope swap.
The swap value is
V_{\mathrm{swap}} = V_{\mathrm{receiver\ leg}} - V_{\mathrm{payer\ leg}}.
In line with SwapLeg, this class is interpreted as a remaining
forward-looking swap in the current Markovian PDE setting. It is valued
directly from discount bonds and forward rates and therefore does not require
a PDE solver.
- Author:
- Alessandro Gnoatto
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a swap with valuelegReceiver - legPayer.Swap(Schedule scheduleReceiveLeg, String forwardCurveReceiveName, double[] notionalsReceive, double[] spreadsReceive, Schedule schedulePayLeg, String forwardCurvePayName, double[] notionalsPay, double[] spreadsPay, boolean isNotionalExchanged) Creates a swap from leg specifications. -
Method Summary
Modifier and TypeMethodDescriptionstatic doublegetForwardSwapRate(double evaluationTime, Schedule fixSchedule, Schedule floatSchedule, String forwardCurveName, FiniteDifferenceInterestRateModel model, double... stateVariables) Returns the forward swap rate corresponding to the given fixed-leg and floating-leg schedules under the specified model state.Returns the payer leg.Returns the receiver leg.double[]getValue(double evaluationTime, FiniteDifferenceInterestRateModel model) Returns the value.doublegetValueAt(double evaluationTime, double stateVariable, FiniteDifferenceInterestRateModel model) Returns the swap value at the given evaluation time and state.double[][]Returns the value.toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface FiniteDifferenceInterestRateProduct
applyEventCondition, getEventTimes, getModelClassMethods inherited from interface FiniteDifferenceProduct
getValue
-
Constructor Details
-
Swap
-
Swap
public Swap(Schedule scheduleReceiveLeg, String forwardCurveReceiveName, double[] notionalsReceive, double[] spreadsReceive, Schedule schedulePayLeg, String forwardCurvePayName, double[] notionalsPay, double[] spreadsPay, boolean isNotionalExchanged) Creates a swap from leg specifications.- Parameters:
scheduleReceiveLeg- The receiver-leg schedule.forwardCurveReceiveName- The receiver-leg forwarding-curve name.notionalsReceive- The receiver-leg notionals.spreadsReceive- The receiver-leg spreads.schedulePayLeg- The payer-leg schedule.forwardCurvePayName- The payer-leg forwarding-curve name.notionalsPay- The payer-leg notionals.spreadsPay- The payer-leg spreads.isNotionalExchanged- True if notional exchange is included on both legs.
-
-
Method Details
-
getValue
Description copied from interface:FiniteDifferenceProductReturns the value.- Specified by:
getValuein interfaceFiniteDifferenceProduct<FiniteDifferenceInterestRateModel>- Parameters:
evaluationTime- The value.model- The value.- Returns:
- The value.
-
getValues
Description copied from interface:FiniteDifferenceProductReturns the value.- Specified by:
getValuesin interfaceFiniteDifferenceProduct<FiniteDifferenceInterestRateModel>- Parameters:
model- The value.- Returns:
- The value.
-
getValueAt
public double getValueAt(double evaluationTime, double stateVariable, FiniteDifferenceInterestRateModel model) Returns the swap value at the given evaluation time and state.- Parameters:
evaluationTime- The evaluation time.stateVariable- The state variable.model- The finite-difference interest-rate model.- Returns:
- The swap value.
-
getLegReceiver
-
getLegPayer
-
getForwardSwapRate
public static double getForwardSwapRate(double evaluationTime, Schedule fixSchedule, Schedule floatSchedule, String forwardCurveName, FiniteDifferenceInterestRateModel model, double... stateVariables) Returns the forward swap rate corresponding to the given fixed-leg and floating-leg schedules under the specified model state.The returned quantity is
S(t,x) = \frac{V_{\mathrm{float}}(t,x)}{A(t,x)},
where
A(t,x)is the swap annuity of the fixed-leg schedule.- Parameters:
evaluationTime- The evaluation time.fixSchedule- The fixed-leg schedule.floatSchedule- The floating-leg schedule.forwardCurveName- The forwarding-curve name of the floating leg.model- The finite-difference interest-rate model.stateVariables- The current state variables.- Returns:
- The forward swap rate.
-
toString
-