Class CapletVolatilitySurface

  • All Implemented Interfaces:
    VolatilitySurface

    public class CapletVolatilitySurface
    extends Object
    implements VolatilitySurface
    This class implements a caplet volatility surface.
    Author:
    Daniel Willhalm, Christian Fries (review and fixes)
    • Constructor Detail

      • CapletVolatilitySurface

        public CapletVolatilitySurface​(String name,
                                       LocalDate referenceDate,
                                       double[][] volatilityMatrix,
                                       double[] maturityVector,
                                       double[] strikeVector,
                                       ForwardCurve forwardCurve,
                                       VolatilitySurface.QuotingConvention volatilityConvention,
                                       DiscountCurve discountCurve)
        The constructor of the caplet volatility surface class. A volatility matrix is used to create the surface
        Parameters:
        name - The name of the surface.
        referenceDate - The reference date of the surface.
        volatilityMatrix - The matrix with caplet volatilities as entries.
        maturityVector - The maturities of the rows of the volatility matrix.
        strikeVector - The caplet strikes.
        forwardCurve - The forward curve.
        volatilityConvention - The volatility convention.
        discountCurve - The discount curve.
      • CapletVolatilitySurface

        public CapletVolatilitySurface​(String name,
                                       LocalDate referenceDate,
                                       double volatility,
                                       double[] maturityVector,
                                       double[] strikeVector,
                                       ForwardCurve forwardCurve,
                                       VolatilitySurface.QuotingConvention volatilityConvention,
                                       DiscountCurve discountCurve)
        The constructor of the caplet volatility surface class. A single volatility is used and all matrix entries will be that value. This constructor is used if we want to price a cap given a cap volatility.
        Parameters:
        name - The name of the surface.
        referenceDate - The reference date of the surface.
        volatility - The volatility.
        maturityVector - The maturities of the rows of the volatility matrix.
        strikeVector - The caplet strikes.
        forwardCurve - The forward curve.
        volatilityConvention - The volatility convention.
        discountCurve - The discount curve.
    • Method Detail

      • getValue

        public double getValue​(double maturity,
                               double strike,
                               VolatilitySurface.QuotingConvention quotingConvention)
        Method that returns the volatility value.
        Specified by:
        getValue in interface VolatilitySurface
        Parameters:
        maturity - The desired maturity.
        strike - The desired strike
        quotingConvention - The desired quoting convention.
        Returns:
        the volatility value for the given maturity, strike and quoting convention.
      • getValue

        public double getValue​(AnalyticModel model,
                               double maturity,
                               double strike,
                               VolatilitySurface.QuotingConvention quotingConvention)
        Description copied from interface: VolatilitySurface
        Returns the price or implied volatility for the corresponding maturity and strike.
        Specified by:
        getValue in interface VolatilitySurface
        Parameters:
        model - An analytic model providing a context. Some curves do not need this (may be null).
        maturity - The option maturity for which the price or implied volatility is requested.
        strike - The option strike for which the price or implied volatility is requested.
        quotingConvention - The quoting convention to be used for the return value.
        Returns:
        The price or implied volatility depending on the quoting convention.
      • convertFromTo

        public double convertFromTo​(AnalyticModel model,
                                    double optionMaturity,
                                    double optionStrike,
                                    double value,
                                    VolatilitySurface.QuotingConvention fromQuotingConvention,
                                    VolatilitySurface.QuotingConvention toQuotingConvention)
        Convert the value of a caplet from one quoting convention to another quoting convention.
        Parameters:
        model - An analytic model providing the context when fetching required market date.
        optionMaturity - Option maturity of the caplet.
        optionStrike - Option strike of the caplet.
        value - Value of the caplet given in the form of fromQuotingConvention.
        fromQuotingConvention - The quoting convention of the given value.
        toQuotingConvention - The quoting convention requested.
        Returns:
        Value of the caplet given in the form of toQuotingConvention.
      • convertFromTo

        public double convertFromTo​(double optionMaturity,
                                    double optionStrike,
                                    double value,
                                    VolatilitySurface.QuotingConvention fromQuotingConvention,
                                    VolatilitySurface.QuotingConvention toQuotingConvention)
        Convert the value of a caplet from one quoting convention to another quoting convention.
        Parameters:
        optionMaturity - Option maturity of the caplet.
        optionStrike - Option strike of the caplet.
        value - Value of the caplet given in the form of fromQuotingConvention.
        fromQuotingConvention - The quoting convention of the given value.
        toQuotingConvention - The quoting convention requested.
        Returns:
        Value of the caplet given in the form of toQuotingConvention.