Record Class MultiCurrencyExposureSimulator.BasisFactor

java.lang.Object
java.lang.Record
com.quantfinlib.credit.MultiCurrencyExposureSimulator.BasisFactor
Record Components:
meanReversion - a_b, > 0
vol - sigma_b, ≥ 0
correlation - correlation of W_b with each market factor [W_d, W_1, W_S1, ...], length 1 + 2 n
Enclosing class:
MultiCurrencyExposureSimulator

public static record MultiCurrencyExposureSimulator.BasisFactor(double meanReversion, double vol, double[] correlation) extends Record
Stochastic projection-discount basis for domestic swaps that carry a projection curve (added in 2.3). Leaving it out (null) keeps the deterministic basis of 2.2.

Plain idea. The basis between the projection and the discount curve is not fixed: it widens in stress and drifts back. One mean-reverting factor y_b moves the log basis of every period, and it may be correlated with the rate and FX factors.

Formal statement. Under the domestic measure dy_b = -a_b y_b dt + sigma_b dW_b, y_b(0) = 0. For a period (S, T) with today's basis k0 = [P^f(0,S)/P^f(0,T)] / [P_d(0,S)/P_d(0,T)], the simulated projection ratio is

  X(t) = k0 * m(t) * P_d(t,S) / P_d(t,T),  m(t) = exp(e^{-a_b (S-t)} y_b(t) + D(t)),  t <= S
  D(t) = int_0^t [rho_db sigma_b sigma_d e^{-a_b (S-u)} B_d(S-u) - sigma_b^2 e^{-2 a_b (S-u)} / 2] du

so at the fixing the log basis multiplier is y_b(S) + D(S), and before it the factor loads through its own conditional mean e^{-a_b(S-t)} y_b(t). D is the drift that makes X a martingale under the T-forward measure, the condition that the forward projection rate be fair (Mercurio 2009, section 2; the drift is own algebra from the Girsanov shift dW^T = dW + sigma_d B_d(T-t) dt and is checked by a Monte Carlo martingale test). The floating coupon is worth k0 m(t) P_d(t,S) - P_d(t,T) before the fixing and (k0 m(S) / P_d(S,T) - 1) P_d(t,T) after. With sigma_b = 0 the factor is not simulated and results equal the deterministic basis path for path (tested). Foreign swaps keep a deterministic basis.

Worked example. sigma_b = 0.3 %, a_b = 0.5, rho = 0: a period fixing in 5y has log-basis standard deviation 0.003 * sqrt((1 - e^{-5}) / 1), about 0.30 % at the fixing (own arithmetic).

  • Constructor Summary

    Constructors
    Constructor
    Description
    BasisFactor(double meanReversion, double vol, double[] correlation)
    Validates and copies.
  • Method Summary

    Modifier and Type
    Method
    Description
    double[]
    Defensive copy.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    double
    Returns the value of the meanReversion record component.
    final String
    Returns a string representation of this record class.
    double
    vol()
    Returns the value of the vol record component.

    Methods inherited from class Object

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

    • BasisFactor

      public BasisFactor(double meanReversion, double vol, double[] correlation)
      Validates and copies.
  • Method Details

    • correlation

      public double[] correlation()
      Defensive copy.
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components 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.
    • meanReversion

      public double meanReversion()
      Returns the value of the meanReversion record component.
      Returns:
      the value of the meanReversion record component
    • vol

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