- java.lang.Object
-
- net.finmath.singleswaprate.calibration.AbstractCubeCalibration
-
- Direct Known Subclasses:
SABRCubeParallelCalibration
,StaticCubeCalibration
public abstract class AbstractCubeCalibration extends Object
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
Nested Classes Modifier and Type Class Description protected class
AbstractCubeCalibration.SwaptionInfo
Compact identifier for the swaptions to be created during the optimization.
-
Constructor Summary
Constructors Constructor Description AbstractCubeCalibration(LocalDate referenceDate, SwaptionDataLattice cashPayerPremiums, SwaptionDataLattice cashReceiverPremiums, VolatilityCubeModel model, AnnuityMapping.AnnuityMappingType annuityMappingType)
Create the calibrator.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract double[]
applyParameterBounds(double[] parameters)
Apply bounds to parameters.protected abstract VolatilityCube
buildCube(String name, double[] parameters)
Build the cube from a set of parameters.VolatilityCube
calibrate(String cubeName)
Run the calibration.String
getForwardCurveName()
double[]
getInitialParameters()
int
getMaxIterations()
VolatilityCubeModel
getModel()
int
getNumberOfThreads()
LocalDate
getReferenceDate()
double
getReplicationLowerBound()
int
getReplicationNumberOfEvaluationPoints()
double
getReplicationUpperBound()
protected abstract void
initializeParameters()
Prepare the parameters for the start of the calibration.boolean
isReplicationUseAsOffset()
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 Detail
-
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 Detail
-
buildCube
protected abstract VolatilityCube buildCube(String name, double[] parameters)
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
public VolatilityCube calibrate(String cubeName) throws SolverException
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
public LocalDate getReferenceDate()
- Returns:
- the referenceDate
-
getModel
public VolatilityCubeModel getModel()
- Returns:
- the model
-
getForwardCurveName
public String getForwardCurveName()
- Returns:
- the forwardCurveName
-
getInitialParameters
public double[] getInitialParameters()
- Returns:
- the initialParameters
-
setInitialParameters
public void setInitialParameters(double[] initialParameters)
- Parameters:
initialParameters
- the initialParameters to set
-
-