Class Swap

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

public class Swap extends Object implements FiniteDifferenceInterestRateProduct
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 Details

    • Swap

      public Swap(SwapLeg legReceiver, SwapLeg legPayer)
      Creates a swap with value legReceiver - legPayer.
      Parameters:
      legReceiver - The receiver leg.
      legPayer - The payer leg.
    • 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

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

      public SwapLeg getLegReceiver()
      Returns the receiver leg.
      Returns:
      The receiver leg.
    • getLegPayer

      public SwapLeg getLegPayer()
      Returns the payer leg.
      Returns:
      The payer leg.
    • 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

      public String toString()
      Overrides:
      toString in class Object