Class SwaptionGeneralizedAnalyticApproximation

  • All Implemented Interfaces:
    Product, Swaption, TermStructureMonteCarloProduct, MonteCarloProduct

    public class SwaptionGeneralizedAnalyticApproximation
    extends AbstractLIBORMonteCarloProduct
    implements Swaption
    This class implements an analytic swaption valuation formula under a LIBOR market model. The algorithm implemented here is the OIS discounting version of the algorithm described in ISBN 0470047224 (see SwaptionSingleCurveAnalyticApproximation). The approximation assumes that the forward rates (LIBOR) follow a normal model or log-normal model and that the model provides the integrated instantaneous covariance of the forward rates or the integrated instantaneous covariance of the log-forward rates The getValue method calculates the approximated integrated instantaneous variance of the swap rate, using the approximation \[ \frac{d log(S(t))}{d log(L(t))} \approx \frac{d log(S(0))}{d log(L(0))} = : w. \] Since \( L \) is a vector, \( w \) is a gradient (vector). The class then approximates the Black volatility of a swaption via \[ \sigma_S^{2} T := \sum_{i,j} w_{i} \gamma_{i,j} w_{j} \] where \( (\gamma_{i,j})_{i,j = 1,...,m} \) is the covariance matrix of the forward rates. The valuation can be performed in terms of value or implied Black volatility.
    Version:
    1.0
    Author:
    Christian Fries, Lorenzo Torricelli
    Date:
    17.05.2017.
    • Constructor Detail

      • SwaptionGeneralizedAnalyticApproximation

        public SwaptionGeneralizedAnalyticApproximation​(double swaprate,
                                                        double[] swapTenor,
                                                        SwaptionGeneralizedAnalyticApproximation.ValueUnit valueUnit,
                                                        SwaptionGeneralizedAnalyticApproximation.StateSpace stateSpace)
        Create an analytic swaption approximation product for log normal forward rate model. Note: It is implicitly assumed that swapTenor[0] is the exercise date (no forward starting).
        Parameters:
        swaprate - The strike swap rate of the swaption.
        swapTenor - The swap tenor in doubles.
        valueUnit - The unit of the quantity returned by the getValues method.
        stateSpace - The state space of the LMM (lognormal or normal)
      • SwaptionGeneralizedAnalyticApproximation

        public SwaptionGeneralizedAnalyticApproximation​(double swaprate,
                                                        TimeDiscretization swapTenor,
                                                        SwaptionGeneralizedAnalyticApproximation.StateSpace stateSpace)
        Create an analytic swaption approximation product for log normal forward rate model. Note: It is implicitly assumed that swapTenor.getTime(0) is the exercise date (no forward starting).
        Parameters:
        swaprate - The strike swap rate of the swaption.
        swapTenor - The swap tenor in doubles.
        stateSpace - The state space of the LMM (lognormal or normal)
    • Method Detail

      • getValue

        public RandomVariable getValue​(double evaluationTime,
                                       TermStructureMonteCarloSimulationModel model)
        Description copied from interface: TermStructureMonteCarloProduct
        This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime. Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time. Cashflows prior evaluationTime are not considered.
        Specified by:
        getValue in interface TermStructureMonteCarloProduct
        Specified by:
        getValue in class AbstractLIBORMonteCarloProduct
        Parameters:
        evaluationTime - The time on which this products value should be observed.
        model - The model used to price the product.
        Returns:
        The random variable representing the value of the product discounted to evaluation time
      • getValues

        public RandomVariable getValues​(double evaluationTime,
                                        TimeDiscretization timeDiscretization,
                                        LIBORMarketModel model)
        Calculates the approximated integrated instantaneous variance of the swap rate, using the approximation d S/d L (t) = d S/d L (0).
        Parameters:
        evaluationTime - Time at which the product is evaluated.
        timeDiscretization - The time discretization used for integrating the covariance.
        model - A model implementing the LIBORModelMonteCarloSimulationModel
        Returns:
        Depending on the value of value unit, the method returns either the approximated integrated instantaneous variance of the swap rate (ValueUnit.INTEGRATEDVARIANCE) or the value using the Black formula (ValueUnit.VALUE).
        To dos:
        make initial values an arg and use evaluation time.
      • getLogSwapRateDerivative

        public Map<String,​double[]> getLogSwapRateDerivative​(TimeDiscretization liborPeriodDiscretization,
                                                                   DiscountCurve discountCurve,
                                                                   ForwardCurve forwardCurve)
        This function calculate the partial derivative d log(S) / d log(Lk) for a given swap rate with respect to a vector of forward rates (on a given forward rate tenor). It also returns some useful other quantities like the corresponding discount factors and swap annuities.
        Parameters:
        liborPeriodDiscretization - The libor period discretization.
        discountCurve - The discount curve. If this parameter is null, the discount curve will be calculated from the forward curve.
        forwardCurve - The forward curve.
        Returns:
        A map containing the partial derivatives (key "value"), the discount factors (key "discountFactors") and the annuities (key "annuities") as vectors of double[] (indexed by forward rate tenor index starting at swap start)
      • getSwapRateDerivative

        public Map<String,​double[]> getSwapRateDerivative​(TimeDiscretization liborPeriodDiscretization,
                                                                AnalyticModel model,
                                                                DiscountCurve discountCurve,
                                                                ForwardCurve forwardCurve)
        Returns the derivative of the swap rate (associated with this swap) with respect to the forward rates dS/dL_{i}.
        Parameters:
        liborPeriodDiscretization - Forward rate discretization.
        model - The analytic model providing the context for discountCurve and forwardCurve.
        discountCurve - The discount curve.
        forwardCurve - The forward curve.
        Returns:
        A map containing the derivative of the swap rate with respect to the forward rates dS/dL_{i} under the key "values".