finMath lib documentation
net.finmath.singleswaprate.products

## Class AbstractSingleSwapRateProduct

• ### Constructor Summary

Constructors
Constructor and Description
AbstractSingleSwapRateProduct(Schedule fixSchedule, Schedule floatSchedule, String discountCurveName, String forwardCurveName, String volatilityCubeName)
Create the single swap rate product.
• ### Method Summary

All Methods
Modifier and Type Method and Description
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.
String getDiscountCurveName()
Schedule getFixSchedule()
Schedule getFloatSchedule()
String getForwardCurveName()
double getIntegrationLowerBound()
int getIntegrationNumberOfEvaluationPoints()
double getIntegrationUpperBound()
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.
String getVolatilityCubeName()
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 the hedgeweight 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
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Methods inherited from interface net.finmath.modelling.Product

getValues
• ### Constructor Detail

• #### 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 Detail

• #### 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.

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:
• #### 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