Class ForwardCurve

java.lang.Object
com.quantfinlib.pricing.ForwardCurve

public final class ForwardCurve extends Object
Implied FX forward curve from market outright forwards, with interpolation, implied rate differentials, and covered-interest-parity checks against deposit rates.

Thread safety: addPoint(double, double) serialises writers on a private lock and publishes a new immutable pillar array through a volatile field (copy on write), so readers on other threads never see a half-updated curve and never block.

  • Constructor Summary

    Constructors
    Constructor
    Description
    ForwardCurve(double spot)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    addPoint(double tenorYears, double outrightForward)
    Adds (or replaces) an outright forward at tenorYears > 0.
    double
    forward(double tenorYears)
    Interpolated outright forward at the tenor: linear in forward points between pillars, extrapolated with the slope of the last two pillars beyond the last one (unbounded, so keep queries near the quoted range).
    double
    forwardPoints(double tenorYears)
    Forward points at the tenor (outright minus spot).
    double
    impliedRateDifferential(double tenorYears)
    Implied continuously compounded rate differential (domestic minus foreign) from covered interest parity, F = S·e^{(rd−rf)t}, for tenorYears > 0.
    double
    mispricingBps(double tenorYears, double domesticRate, double foreignRate)
    Covered-interest-parity check: market forward versus the deposit-implied forward, in basis points (positive = market forward rich).
    double
     
    static double
    theoreticalForward(double spot, double domesticRate, double foreignRate, double tenorYears)
    CIP-theoretical forward from simple deposit rates.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ForwardCurve

      public ForwardCurve(double spot)
  • Method Details

    • addPoint

      public ForwardCurve addPoint(double tenorYears, double outrightForward)
      Adds (or replaces) an outright forward at tenorYears > 0.
    • spot

      public double spot()
    • forward

      public double forward(double tenorYears)
      Interpolated outright forward at the tenor: linear in forward points between pillars, extrapolated with the slope of the last two pillars beyond the last one (unbounded, so keep queries near the quoted range).
      Throws:
      IllegalStateException - if no forward point has been added
    • forwardPoints

      public double forwardPoints(double tenorYears)
      Forward points at the tenor (outright minus spot).
    • impliedRateDifferential

      public double impliedRateDifferential(double tenorYears)
      Implied continuously compounded rate differential (domestic minus foreign) from covered interest parity, F = S·e^{(rd−rf)t}, for tenorYears > 0.

      This method is continuous while theoreticalForward(double, double, double, double) uses simple deposit rates, each matching how its input is quoted. Feeding this output back through theoreticalForward shows a spurious basis (about 12bp at 1y and 5%) that is compounding convention, not arbitrage; convert first.

    • theoreticalForward

      public static double theoreticalForward(double spot, double domesticRate, double foreignRate, double tenorYears)
      CIP-theoretical forward from simple deposit rates.
    • mispricingBps

      public double mispricingBps(double tenorYears, double domesticRate, double foreignRate)
      Covered-interest-parity check: market forward versus the deposit-implied forward, in basis points (positive = market forward rich).