Class SwapAnnuity

All Implemented Interfaces:
Product, TermStructureMonteCarloProduct, MonteCarloProduct

public class SwapAnnuity extends AbstractTermStructureMonteCarloProduct
This class implements the valuation of a simple swap annuity, i.e., the \( \sum_{i=1}^{n} \delta_{i} P(T_{i}) \) where \( \delta_{i} \) are given weights (period length) and \( T_{i} \) are given maturities.
Version:
1.2
Author:
Christian Fries
  • Constructor Details

    • SwapAnnuity

      public SwapAnnuity(LocalDateTime referenceDate, double[] maturities, double[] periodLengths)
      Create a swap annuity with maturity \( T_{i} \) and period length \( \delta_{i} \). Here \( T_{i} \) is specified as a double offset to a given reference date \( t = 0 \).
      Parameters:
      referenceDate - The date corresponding to \( t = 0 \).
      maturities - The maturities given as doubles, following the FloatingpointDate convention as offsets to referenceDate.
      periodLengths - The period lengths (cash-flow weights).
    • SwapAnnuity

      public SwapAnnuity(double[] maturities, double[] periodLengths)
      Parameters:
      maturities - The maturities given as double.
      periodLengths - The period lengths (cash-flow weights).
    • SwapAnnuity

      public SwapAnnuity(TimeDiscretization timeDiscretization)
      Creates a swap annuity from a tenor discretization. Each time step is one weighted payment at the end of the step.
      Parameters:
      timeDiscretization - The payment tenor.
  • Method Details

    • getValue

      public RandomVariable getValue(double evaluationTime, TermStructureMonteCarloSimulationModel model) throws CalculationException
      This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime. Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time. Cashflows prior evaluationTime are not considered.
      Specified by:
      getValue in interface TermStructureMonteCarloProduct
      Specified by:
      getValue in class AbstractTermStructureMonteCarloProduct
      Parameters:
      evaluationTime - The time on which this products value should be observed.
      model - The model used to price the product.
      Returns:
      The random variable representing the value of the product discounted to evaluation time
      Throws:
      CalculationException - Thrown if the valuation fails, specific cause may be available via the cause() method.
    • getReferenceDate

      public LocalDateTime getReferenceDate()
    • getMaturities

      public double[] getMaturities()
      Returns:
      Returns the maturities.
    • getPeriodLengths

      public double[] getPeriodLengths()
      Returns:
      Returns the period lengths (cash-flow weights).
    • toString

      public String toString()
      Overrides:
      toString in class AbstractMonteCarloProduct