Class ForwardCurve
java.lang.Object
com.quantfinlib.pricing.ForwardCurve
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 -
Method Summary
Modifier and TypeMethodDescriptionaddPoint(double tenorYears, double outrightForward) Adds (or replaces) an outright forward attenorYears > 0.doubleforward(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).doubleforwardPoints(double tenorYears) Forward points at the tenor (outright minus spot).doubleimpliedRateDifferential(double tenorYears) Implied continuously compounded rate differential (domestic minus foreign) from covered interest parity,F = S·e^{(rd−rf)t}, fortenorYears > 0.doublemispricingBps(double tenorYears, double domesticRate, double foreignRate) Covered-interest-parity check: market forward versus the deposit-implied forward, in basis points (positive = market forward rich).doublespot()static doubletheoreticalForward(double spot, double domesticRate, double foreignRate, double tenorYears) CIP-theoretical forward from simple deposit rates.
-
Constructor Details
-
ForwardCurve
public ForwardCurve(double spot)
-
-
Method Details
-
addPoint
Adds (or replaces) an outright forward attenorYears > 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}, fortenorYears > 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 throughtheoreticalForwardshows 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).
-