java.lang.Object
net.finmath.singleswaprate.calibration.AbstractCubeCalibration
- Direct Known Subclasses:
SABRCubeParallelCalibration
,StaticCubeCalibration
Abstract class providing a default method of calibrating a parametric cube to market data, which can be implemented quickly for any cube by implementing the methods:
buildCube
initializeParameters
applyParameterBounds
- Author:
- Christian Fries, Roland Bachl
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
Compact identifier for the swaptions to be created during the optimization. -
Constructor Summary
ConstructorDescriptionAbstractCubeCalibration
(LocalDate referenceDate, SwaptionDataLattice cashPayerPremiums, SwaptionDataLattice cashReceiverPremiums, VolatilityCubeModel model, AnnuityMapping.AnnuityMappingType annuityMappingType) Create the calibrator. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract double[]
applyParameterBounds
(double[] parameters) Apply bounds to parameters.protected abstract VolatilityCube
Build the cube from a set of parameters.Run the calibration.double[]
int
getModel()
int
double
int
double
protected abstract void
Prepare the parameters for the start of the calibration.boolean
void
setCalibrationParameters
(int maxIterations, int numberOfThreads) Set the parameters for calibration.void
setInitialParameters
(double[] initialParameters) void
setReplicationParameters
(boolean useAsOffset, double lowerBound, double upperBound, int numberOfEvaluationPoints) Set the parameters for the swaption replication.
-
Constructor Details
-
AbstractCubeCalibration
public AbstractCubeCalibration(LocalDate referenceDate, SwaptionDataLattice cashPayerPremiums, SwaptionDataLattice cashReceiverPremiums, VolatilityCubeModel model, AnnuityMapping.AnnuityMappingType annuityMappingType) Create the calibrator.- Parameters:
referenceDate
- The reference date of the cube.cashPayerPremiums
- The lattice containing market targets for cash settled payer swaptions. The lattice needs to be quoted in QuotingConvention.PRICE.cashReceiverPremiums
- The lattice containing market targets for cash settled receiver swaptions. The lattice needs to be quoted in QuotingConvention.PRICE.model
- The model providing context.annuityMappingType
- The type of annuity mapping to be used for calibration.- Throws:
IllegalArgumentException
- Triggers when data is not provided in QuotingConvention.Price.
-
-
Method Details
-
buildCube
Build the cube from a set of parameters. These need to be an array of all parameters to be calibrated.- Parameters:
name
- The name the cube will carry.parameters
- The parameters of the cube as array.- Returns:
- The volatility cube.
-
initializeParameters
protected abstract void initializeParameters()Prepare the parameters for the start of the calibration. -
applyParameterBounds
protected abstract double[] applyParameterBounds(double[] parameters) Apply bounds to parameters. Such as volatility larger zero.- Parameters:
parameters
- The raw parameters of the cube as array.- Returns:
- The parameters with their respective bounds applied.
-
calibrate
Run the calibration.- Parameters:
cubeName
- The name of the final cube.- Returns:
- The calibrated cube.
- Throws:
SolverException
- Thrown, when solvers fail to find suitable parameters.
-
setCalibrationParameters
public void setCalibrationParameters(int maxIterations, int numberOfThreads) Set the parameters for calibration.- Parameters:
maxIterations
- The maximum number of iterations done during calibration.numberOfThreads
- The number of processor threads to be used.
-
getMaxIterations
public int getMaxIterations()- Returns:
- The maximum number of iterations of the optimizer.
-
getNumberOfThreads
public int getNumberOfThreads()- Returns:
- The number of threads the optimizer is allowed to use.
-
setReplicationParameters
public void setReplicationParameters(boolean useAsOffset, double lowerBound, double upperBound, int numberOfEvaluationPoints) Set the parameters for the swaption replication.- Parameters:
useAsOffset
- Are the values of lower and upperBound to be understood as offsets from the par swap rate?lowerBound
- The lowest strike allowed.upperBound
- The maximal strike allowed.numberOfEvaluationPoints
- The number of points to be evaluated during the integration.
-
isReplicationUseAsOffset
public boolean isReplicationUseAsOffset()- Returns:
- True when the replication bounds are to be understood as offset from the par swap rate.
-
getReplicationLowerBound
public double getReplicationLowerBound()- Returns:
- The lowest strike allowed during swaption replication.
-
getReplicationUpperBound
public double getReplicationUpperBound()- Returns:
- The maximal strike allowed during swaption replication.
-
getReplicationNumberOfEvaluationPoints
public int getReplicationNumberOfEvaluationPoints()- Returns:
- The number of points to be evaluated during swaption replication.
-
getReferenceDate
- Returns:
- the referenceDate
-
getModel
- Returns:
- the model
-
getForwardCurveName
- Returns:
- the forwardCurveName
-
getInitialParameters
public double[] getInitialParameters()- Returns:
- the initialParameters
-
setInitialParameters
public void setInitialParameters(double[] initialParameters) - Parameters:
initialParameters
- the initialParameters to set
-