Record Class SviSlice

java.lang.Object
java.lang.Record
com.quantfinlib.pricing.SviSlice
Record Components:
a - variance level
b - wing slope scale, ≥ 0
rho - rotation, in (−1, 1)
m - horizontal shift (log-moneyness)
sigma - ATM curvature, > 0

public record SviSlice(double a, double b, double rho, double m, double sigma) extends Record
One expiry of the raw SVI parametrisation (Gatheral 2004, "A parsimonious arbitrage-free implied volatility parameterization", Global Derivatives; Gatheral and Jacquier 2014, "Arbitrage-free SVI volatility surfaces", Quantitative Finance 14(1), equation 3.1):
  w(k) = a + b ( ρ (k − m) + √((k − m)² + σ²) )

where w is total implied variance σ_BS²·T and k = ln(K/F) is log-moneyness against the forward. The parameter set is admissible when b ≥ 0, |ρ| < 1, σ > 0 and a + bσ√(1−ρ²) ≥ 0, which keeps w non-negative everywhere (Gatheral-Jacquier, section 3.1).

Butterfly arbitrage. A slice is free of butterfly arbitrage if and only if the density factor g(k) = (1 − k w'/(2w))² − (w'²/4)(1/w + 1/4) + w''/2 is non-negative (Gatheral-Jacquier 2014, lemma 2.2) and d₊ → −∞ in the right wing. The Black density is g(k)/√(2πw)·exp(−d₋²/2); minDensityFactor(double, double, int) checks g on a grid.

Calibration (calibrate(double[], double[], double[])) is Levenberg-Marquardt on weighted total-variance residuals in a reparametrisation that keeps every admissibility bound and Lee's (2004) wing bound b(1+|ρ|) ≤ 4, plus an optional penalty residual on negative g over a grid that extends half a unit of log-moneyness past the quotes. Weights are the caller's: vega weights or the reciprocal of the bid-ask spread in variance terms are the usual choices. The fit is multi-start (27 starts) because the SVI objective has several local minima.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    Weight of the min(g, 0) penalty residuals in calibrate(double[], double[], double[]).
  • Constructor Summary

    Constructors
    Constructor
    Description
    SviSlice(double a, double b, double rho, double m, double sigma)
    Creates an instance of a SviSlice record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    a()
    Returns the value of the a record component.
    double
    b()
    Returns the value of the b record component.
    static SviSlice
    calibrate(double[] k, double[] w, double[] weights)
    Calibrates a slice to total-variance quotes with the butterfly penalty on.
    static SviSlice
    calibrate(double[] k, double[] w, double[] weights, boolean butterflyPenalty)
    Calibrates a slice; butterflyPenalty adds residuals BUTTERFLY_PENALTY·min(g, 0) on a 121-point grid over [min k − 0.5, max k + 0.5].
    double
    curvature(double k)
    Second derivative d²w/dk².
    double
    densityFactor(double k)
    Gatheral-Jacquier density factor g(k); negative means butterfly arbitrage.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    double
    impliedVol(double k, double t)
    Implied volatility at log-moneyness k for expiry t years.
    double
    m()
    Returns the value of the m record component.
    double
    minDensityFactor(double kMin, double kMax, int n)
    Minimum of g over n equally spaced points of [kMin, kMax].
    double
    rho()
    Returns the value of the rho record component.
    double
    rmse(double[] k, double[] w)
    Root-mean-square total-variance error against quotes (unweighted).
    double
    Returns the value of the sigma record component.
    double
    slope(double k)
    First derivative dw/dk.
    final String
    Returns a string representation of this record class.
    double
    totalVariance(double k)
    Total implied variance at log-moneyness k.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • SviSlice

      public SviSlice(double a, double b, double rho, double m, double sigma)
      Creates an instance of a SviSlice record class.
      Parameters:
      a - the value for the a record component
      b - the value for the b record component
      rho - the value for the rho record component
      m - the value for the m record component
      sigma - the value for the sigma record component
  • Method Details

    • totalVariance

      public double totalVariance(double k)
      Total implied variance at log-moneyness k.
    • slope

      public double slope(double k)
      First derivative dw/dk.
    • curvature

      public double curvature(double k)
      Second derivative d²w/dk².
    • impliedVol

      public double impliedVol(double k, double t)
      Implied volatility at log-moneyness k for expiry t years.
    • densityFactor

      public double densityFactor(double k)
      Gatheral-Jacquier density factor g(k); negative means butterfly arbitrage.
    • minDensityFactor

      public double minDensityFactor(double kMin, double kMax, int n)
      Minimum of g over n equally spaced points of [kMin, kMax].
    • rmse

      public double rmse(double[] k, double[] w)
      Root-mean-square total-variance error against quotes (unweighted).
    • calibrate

      public static SviSlice calibrate(double[] k, double[] w, double[] weights)
      Calibrates a slice to total-variance quotes with the butterfly penalty on.
      Parameters:
      k - log-moneyness ln(K/F) of each quote
      w - market total variance σ²T of each quote
      weights - residual weights, or null for equal weights
    • calibrate

      public static SviSlice calibrate(double[] k, double[] w, double[] weights, boolean butterflyPenalty)
      Calibrates a slice; butterflyPenalty adds residuals BUTTERFLY_PENALTY·min(g, 0) on a 121-point grid over [min k − 0.5, max k + 0.5]. At least five quotes are required.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • a

      public double a()
      Returns the value of the a record component.
      Returns:
      the value of the a record component
    • b

      public double b()
      Returns the value of the b record component.
      Returns:
      the value of the b record component
    • rho

      public double rho()
      Returns the value of the rho record component.
      Returns:
      the value of the rho record component
    • m

      public double m()
      Returns the value of the m record component.
      Returns:
      the value of the m record component
    • sigma

      public double sigma()
      Returns the value of the sigma record component.
      Returns:
      the value of the sigma record component