Class AbstractSingleSwapRateProduct

java.lang.Object
net.finmath.singleswaprate.products.AbstractAnalyticVolatilityCubeProduct
net.finmath.singleswaprate.products.AbstractSingleSwapRateProduct
All Implemented Interfaces:
AnalyticProduct, Product, AnalyticVolatilityCubeProduct
Direct Known Subclasses:
AnnuityDummyProduct, CashSettledPayerSwaption, CashSettledReceiverSwaption, ConstantMaturitySwap, NormalizingDummyProduct

public abstract class AbstractSingleSwapRateProduct extends AbstractAnalyticVolatilityCubeProduct
An abstract class providing valuation methods for single swap rate products. Extending classes may use the valuation via replication of this class by implementing the methods:
  • payoffFunction
  • hedgeWeight
  • singularAddon
  • buildAnnuityMapping
Author:
Christian Fries, Roland Bachl
  • Constructor Details

    • AbstractSingleSwapRateProduct

      public AbstractSingleSwapRateProduct(Schedule fixSchedule, Schedule floatSchedule, String discountCurveName, String forwardCurveName, String volatilityCubeName)
      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.
  • Method Details

    • setIntegrationParameters

      public void setIntegrationParameters(double lowerBound, double upperBound, int numberOfEvaluationPoints)
      Set the parameters for replication.
      Parameters:
      lowerBound - The lowest strike the replication may use.
      upperBound - The largest strike the replication may use.
      numberOfEvaluationPoints - The number of points the replication may evaluate.
    • getIntegrationLowerBound

      public double getIntegrationLowerBound()
      Returns:
      The lowest strike the replication may use.
    • getIntegrationUpperBound

      public double getIntegrationUpperBound()
      Returns:
      The largest strike the replication may use.
    • getIntegrationNumberOfEvaluationPoints

      public int getIntegrationNumberOfEvaluationPoints()
      Returns:
      The number of points the replication may evaluate.
    • getValue

      public double getValue(double evaluationTime, VolatilityCubeModel model)
      Description copied from interface: AnalyticVolatilityCubeProduct
      Return the valuation of the product using the given model. The model has to implement the modes of VolatilityCubeModel.
      Parameters:
      evaluationTime - The evaluation time as double. Cash flows prior and including this time are not considered.
      model - The model under which the product is valued.
      Returns:
      The value of the product using the given model.
    • getValue

      public double getValue(double evaluationTime, AnnuityMapping annuityMapping, VolatilityCubeModel model)
      Return the valuation of the product using the given model. The model has to implement the modes of VolatilityCubeModel. This method allows to specify an annuity mapping to be used during the evaluation. This may be done to safe time, when many evaluations at different time, or of products with the same underlying swap rate, have to be done at once. Otherwise each call of getValue will first instantiate an individual annuity mapping. Which may take long for more elaborate implementations.
      Parameters:
      evaluationTime - The evaluation time as double. Cash flows prior and including this time are not considered.
      annuityMapping - The annuity mapping to be used during valuation. If left null a new mapping will be generated.
      model - The model under which the product is valued.
      Returns:
      The value of the product using the given model.
    • payoffFunction

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

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

      protected abstract double singularAddon(double swapRate, AnnuityMapping annuityMapping, VolatilityCubeModel model)
      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.
      Parameters:
      swapRate - The swap rate.
      annuityMapping - The annuity mapping to use.
      model - The model for context.
      Returns:
      The singular addon.
    • buildAnnuityMapping

      protected abstract AnnuityMapping buildAnnuityMapping(VolatilityCubeModel model)
      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.
      Parameters:
      model - The model for context.
      Returns:
      The annuity mapping.
    • valuePut

      protected double valuePut(double optionStrike, VolatilityCubeModel model, double swapRate)
      Value of a put option on the swap rate.
      Parameters:
      optionStrike - The strike of the option.
      model - The model for context.
      swapRate - The swap rate.
      Returns:
      The value of a put.
    • valueCall

      protected double valueCall(double optionStrike, VolatilityCubeModel model, double swapRate)
      Value of a call option on the swap rate.
      Parameters:
      optionStrike - The strike of the option.
      model - The model for context.
      swapRate - The swap rate.
      Returns:
      The value of a call.
    • getFixSchedule

      public Schedule getFixSchedule()
      Returns:
      the fixSchedule
    • getFloatSchedule

      public Schedule getFloatSchedule()
      Returns:
      the floatSchedule
    • getDiscountCurveName

      public String getDiscountCurveName()
      Returns:
      the discountCurveName
    • getForwardCurveName

      public String getForwardCurveName()
      Returns:
      the forwardCurveName
    • getVolatilityCubeName

      public String getVolatilityCubeName()
      Returns:
      the volatilityCubeName