Class ConstantMaturitySwap

All Implemented Interfaces:
AnalyticProduct, Product, AnalyticVolatilityCubeProduct

public class ConstantMaturitySwap extends AbstractSingleSwapRateProduct
A constant maturity swap.
Author:
Christian Fries, Roland Bachl
  • Constructor Details

    • ConstantMaturitySwap

      public ConstantMaturitySwap(Schedule fixSchedule, Schedule floatSchedule, String discountCurveName, String forwardCurveName, String volatilityCubeName, AnnuityMapping.AnnuityMappingType annuityMappingType)
      Create the single swap rate product.
      Parameters:
      fixSchedule - The fix schedule of the swap.
      floatSchedule - The float schedule of the swap.
      discountCurveName - The name of the discount curve.
      forwardCurveName - The name of the forward curve.
      volatilityCubeName - The name of the volatility cube.
      annuityMappingType - The type of annuity mapping to be used for evaluation.
  • Method Details

    • payoffFunction

      protected double payoffFunction(double swapRate, AnnuityMapping annuityMapping, VolatilityCubeModel model)
      Description copied from class: AbstractSingleSwapRateProduct
      Payoff function of the product. Dependent only on the swap rate.
      Specified by:
      payoffFunction in class AbstractSingleSwapRateProduct
      Parameters:
      swapRate - The swap rate.
      annuityMapping - The annuity mapping to use.
      model - The model for context.
      Returns:
      The payoff of the product.
    • hedgeWeight

      protected double hedgeWeight(double swapRate, AnnuityMapping annuityMapping, VolatilityCubeModel model)
      Description copied from class: AbstractSingleSwapRateProduct
      Essentially the second derivative of the payoff function. The hedgeweight determines the weight of the puts and calls under the integral when replicating.
      Specified by:
      hedgeWeight in class AbstractSingleSwapRateProduct
      Parameters:
      swapRate - The swap rate.
      annuityMapping - The annuity mapping to use.
      model - The model for context.
      Returns:
      The weight during replication.
    • singularAddon

      protected double singularAddon(double swapRate, AnnuityMapping annuityMapping, VolatilityCubeModel model)
      Description copied from class: AbstractSingleSwapRateProduct
      As some products have a portion of their weight in a singular point, this is portion is split off from the hedgeweight and added after the integration.
      Specified by:
      singularAddon in class AbstractSingleSwapRateProduct
      Parameters:
      swapRate - The swap rate.
      annuityMapping - The annuity mapping to use.
      model - The model for context.
      Returns:
      The singular addon.
    • buildAnnuityMapping

      protected AnnuityMapping buildAnnuityMapping(VolatilityCubeModel model)
      Description copied from class: AbstractSingleSwapRateProduct
      Since most annuity mappings require data from models to be created, but models are only provided at execution of getValue, the product needs to dynamically be able to build its annuity mapping. This method may be left to return null, if the product requires no annuity mapping or is intended to always receive an annuity mapping for evaluation.
      Specified by:
      buildAnnuityMapping in class AbstractSingleSwapRateProduct
      Parameters:
      model - The model for context.
      Returns:
      The annuity mapping.
    • analyticApproximation

      public static double analyticApproximation(double swaprate, double volatility, double swapAnnuity, double swapFixing, double swapMaturity, double payoffUnit)
      Analytic approximation of a CMS value.
      Parameters:
      swaprate - The underlying swap rate.
      volatility - The volatility of the swap rate.
      swapAnnuity - The annuity of the swap.
      swapFixing - The fixing time of the swap.
      swapMaturity - The maturity time of the swap.
      payoffUnit - The discount factor to be used.
      Returns:
      The value of the cms.