Class SABRCubeCalibration


  • public class SABRCubeCalibration
    extends Object
    Calibration of SABRVolatilityCube using custom optimization. Increased performance compared to default approach, by using a SABRShiftedSmileCalibration to get initial values and then splitting the calibration of the entire cube into calibration of slices along individual maturities. The slices do not interact with each other, because the annuities depend only on sub-tenors of schedules with the same maturity.
    Author:
    Christian Fries, Roland Bachl
    • Constructor Detail

      • SABRCubeCalibration

        public SABRCubeCalibration​(LocalDate referenceDate,
                                   SwaptionDataLattice cashPayerPremiums,
                                   SwaptionDataLattice cashReceiverPremiums,
                                   SwaptionDataLattice physicalPremiumsATM,
                                   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.
        physicalPremiumsATM - Table containing physical settled swaption atm premiums.
        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.
      • SABRCubeCalibration

        public SABRCubeCalibration​(LocalDate referenceDate,
                                   SwaptionDataLattice cashPayerPremiums,
                                   SwaptionDataLattice cashReceiverPremiums,
                                   SwaptionDataLattice physicalPremiumsATM,
                                   VolatilityCubeModel model,
                                   AnnuityMapping.AnnuityMappingType annuityMappingType,
                                   double sabrDisplacement,
                                   double sabrBeta,
                                   double correlationDecay,
                                   double iborOisDecorrelation)
        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.
        physicalPremiumsATM - Table containing physical settled swaption atm premiums.
        model - The model providing context.
        annuityMappingType - The type of annuity mapping to be used for calibration.
        sabrDisplacement - The displacement parameter for the SABR curves in the resulting cube.
        sabrBeta - The beta parameter for the SABR curves in the resulting cube.
        correlationDecay - The correlation decay parameter for resulting cube.
        iborOisDecorrelation - The ibor ois decorrelation parameter for the resulting cube.
    • Method Detail

      • calibrate

        public SABRVolatilityCube calibrate​(String cubeName,
                                            int[] terminations)
                                     throws SolverException
        Run the calibration.
        Parameters:
        cubeName - The name of the final cube.
        terminations - The tenors, which are to be calibrated in each slice.
        Returns:
        The calibrated cube.
        Throws:
        SolverException - Thrown when either the calibration of final or initial parameters (if not provided) fails.
      • setInitialParameters

        public void setInitialParameters​(DataTable initialRhos,
                                         DataTable initialBaseVols,
                                         DataTable initialVolvols)
        Prepare the parameters for the start of the calibration.
        Parameters:
        initialRhos - The table of initial values for rhos.
        initialBaseVols - The table of initial values for base volatilities.
        initialVolvols - The table of initial values for volvols.
      • initializeParameters

        protected void initializeParameters​(int maturity)
        Prepare the parameters for the start of the calibration.
        Parameters:
        maturity - The maturity for which to calibrate.
      • applyParameterBounds

        protected 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.
      • 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.
      • getCorrelationDecay

        public double getCorrelationDecay()
      • setCorrelationDecay

        public void setCorrelationDecay​(double correlationDecay)
      • getIborOisDecorrelation

        public double getIborOisDecorrelation()
      • setIborOisDecorrelation

        public void setIborOisDecorrelation​(double iborOisDecorrelation)
      • getDisplacement

        public double getDisplacement()
      • getBeta

        public double getBeta()
      • isUseLinearInterpolation

        public boolean isUseLinearInterpolation()
        Returns:
        True if tables holding SABR parameters use linear interpolation, false if piecewise cubic spline.
      • setUseLinearInterpolation

        public void setUseLinearInterpolation​(boolean useLinearInterpolation)
        Parameters:
        useLinearInterpolation - Set whether the interpolation of SABR parameters should be linear as opposed to piecewise cubic spline.