Class SwapLeg
- All Implemented Interfaces:
FiniteDifferenceProduct<FiniteDifferenceInterestRateModel>, FiniteDifferenceInterestRateProduct, Product
This class mirrors the role of the analytic and Monte Carlo swap-leg classes, but is adapted to the current Markovian finite-difference rates framework.
A leg is specified by
- a schedule,
- an optional forwarding-curve name,
- a notional for each period,
- a spread for each period,
- an optional flag for notional exchange.
If forwardCurveName is null or empty, the leg is interpreted
as a fixed leg and the spread is the fixed coupon rate.
Otherwise the coupon in period i is
\bigl(F(t;T_i^{\mathrm{fix}},T_i^{\mathrm{pay}}) + s_i\bigr)\delta_i.
Reduced-scope Markovian assumption:
- fixed-leg periods with
periodStart < evaluationTimeare ignored, - floating-leg periods with
fixingDate < evaluationTimeare ignored.
This means the product is interpreted as the remaining forward-looking leg from the current evaluation time onward. The class is therefore intended for forward/running swap valuation in the PDE setting and for swaption underlyings. It does not attempt to encode already-fixed-but-not-yet-paid floating coupons as additional state variables.
Since the product is linear, valuation is performed directly from discount bonds and forward rates. No PDE solver is required.
- Author:
- Alessandro Gnoatto
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a swap leg with constant notional equal to one, constant spread, and no notional exchange.SwapLeg(Schedule legSchedule, String forwardCurveName, double[] notionals, double[] spreads, boolean isNotionalExchanged) Creates a swap leg.Creates a swap leg with constant notional equal to one and constant spread. -
Method Summary
Modifier and TypeMethodDescriptionReturns the forwarding-curve name.double[]Returns the notionals.Returns the schedule.double[]Returns the spreads or fixed coupon rates.double[]getValue(double evaluationTime, FiniteDifferenceInterestRateModel model) Returns the value.doublegetValueAt(double evaluationTime, double stateVariable, FiniteDifferenceInterestRateModel model) Returns the leg value at the given evaluation time and state.double[][]Returns the value.booleanReturns whether the leg is fixed.booleanReturns whether notional exchange is included.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
-
SwapLeg
public SwapLeg(Schedule legSchedule, String forwardCurveName, double[] notionals, double[] spreads, boolean isNotionalExchanged) Creates a swap leg.- Parameters:
legSchedule- The leg schedule.forwardCurveName- The forwarding-curve name. Ifnullor empty, the leg is interpreted as fixed.notionals- The notionals for all periods.spreads- The spreads or fixed coupon rates for all periods.isNotionalExchanged- If true, notional exchange is included.
-
SwapLeg
public SwapLeg(Schedule legSchedule, String forwardCurveName, double spread, boolean isNotionalExchanged) Creates a swap leg with constant notional equal to one and constant spread.- Parameters:
legSchedule- The leg schedule.forwardCurveName- The forwarding-curve name. Ifnullor empty, the leg is interpreted as fixed.spread- The constant spread or fixed coupon rate.isNotionalExchanged- If true, notional exchange is included.
-
SwapLeg
Creates a swap leg with constant notional equal to one, constant spread, and no notional exchange.- Parameters:
legSchedule- The leg schedule.forwardCurveName- The forwarding-curve name. Ifnullor empty, the leg is interpreted as fixed.spread- The constant spread or fixed coupon rate.
-
-
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 leg 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 leg value.
-
getSchedule
-
getForwardCurveName
Returns the forwarding-curve name.- Returns:
- The forwarding-curve name, possibly
null.
-
getNotionals
public double[] getNotionals()Returns the notionals.- Returns:
- The notionals.
-
getSpreads
public double[] getSpreads()Returns the spreads or fixed coupon rates.- Returns:
- The spreads.
-
isNotionalExchanged
public boolean isNotionalExchanged()Returns whether notional exchange is included.- Returns:
- True if notional exchange is included.
-
isFixedLeg
public boolean isFixedLeg()Returns whether the leg is fixed.- Returns:
- True if the leg is fixed.
-
toString
-