Module net.finmath.lib
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
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract AnnuityMapping
Since most annuity mappings require data from models to be created, but models are only provided at execution ofgetValue
, the product needs to dynamically be able to build its annuity mapping.double
int
double
double
getValue(double evaluationTime, AnnuityMapping annuityMapping, VolatilityCubeModel model)
Return the valuation of the product using the given model.double
getValue(double evaluationTime, VolatilityCubeModel model)
Return the valuation of the product using the given model.protected abstract double
hedgeWeight(double swapRate, AnnuityMapping annuityMapping, VolatilityCubeModel model)
Essentially the second derivative of the payoff function.protected abstract double
payoffFunction(double swapRate, AnnuityMapping annuityMapping, VolatilityCubeModel model)
Payoff function of the product.void
setIntegrationParameters(double lowerBound, double upperBound, int numberOfEvaluationPoints)
Set the parameters for replication.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 thehedgeweight
and added after the integration.protected double
valueCall(double optionStrike, VolatilityCubeModel model, double swapRate)
Value of a call option on the swap rate.protected double
valuePut(double optionStrike, VolatilityCubeModel model, double swapRate)
Value of a put option on the swap rate.Methods inherited from class net.finmath.singleswaprate.products.AbstractAnalyticVolatilityCubeProduct
getValue, getValue, getValue
-
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
Description copied from interface:AnalyticVolatilityCubeProduct
Return the valuation of the product using the given model. The model has to implement the modes ofVolatilityCubeModel
.- 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 ofVolatilityCubeModel
. 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 ofgetValue
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 thehedgeweight
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
Since most annuity mappings require data from models to be created, but models are only provided at execution ofgetValue
, the product needs to dynamically be able to build its annuity mapping. This method may be left to returnnull
, 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
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
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
- Returns:
- the fixSchedule
-
getFloatSchedule
- Returns:
- the floatSchedule
-
getDiscountCurveName
- Returns:
- the discountCurveName
-
getForwardCurveName
- Returns:
- the forwardCurveName
-
getVolatilityCubeName
- Returns:
- the volatilityCubeName
-