Class SwapLeg

java.lang.Object
net.finmath.finitedifference.interestrate.products.SwapLeg
All Implemented Interfaces:
FiniteDifferenceProduct<FiniteDifferenceInterestRateModel>, FiniteDifferenceInterestRateProduct, Product

public class SwapLeg extends Object implements FiniteDifferenceInterestRateProduct
Finite-difference valuation of a reduced-scope swap leg.

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 < evaluationTime are ignored,
  • floating-leg periods with fixingDate < evaluationTime are 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 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. If null or 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. If null or empty, the leg is interpreted as fixed.
      spread - The constant spread or fixed coupon rate.
      isNotionalExchanged - If true, notional exchange is included.
    • SwapLeg

      public SwapLeg(Schedule legSchedule, String forwardCurveName, double spread)
      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. If null or empty, the leg is interpreted as fixed.
      spread - The constant spread or fixed coupon rate.
  • Method Details

    • getValue

      public double[] getValue(double evaluationTime, FiniteDifferenceInterestRateModel model)
      Description copied from interface: FiniteDifferenceProduct
      Returns the value.
      Specified by:
      getValue in interface FiniteDifferenceProduct<FiniteDifferenceInterestRateModel>
      Parameters:
      evaluationTime - The value.
      model - The value.
      Returns:
      The value.
    • getValues

      public double[][] getValues(FiniteDifferenceInterestRateModel model)
      Description copied from interface: FiniteDifferenceProduct
      Returns the value.
      Specified by:
      getValues in interface FiniteDifferenceProduct<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

      public Schedule getSchedule()
      Returns the schedule.
      Returns:
      The schedule.
    • getForwardCurveName

      public String 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

      public String toString()
      Overrides:
      toString in class Object