Docs / nablatensor-quant / com.nablatensor.quant.analytic

final class

CostOfCarry

The generalised Black-Scholes-Merton price for a European option under a lognormal underlying with a continuous cost of carry b:

d1 = (ln(S/K) + (b + sigma^2/2) T) / (sigma sqrt(T))
d2 = d1 - sigma sqrt(T)
call = S e^{(b-r)T} N(d1) - K e^{-rT} N(d2)
put  = K e^{-rT} N(-d2) - S e^{(b-r)T} N(-d1)

The single carry parameter recovers the whole vanilla family:

  • b = r — Black-Scholes on a non-dividend stock;
  • b = r - q — a stock or index with continuous dividend yield q (GeneralizedBsm);
  • b = r - r_f — an FX rate with foreign rate r_f (GarmanKohlhagen);
  • b = 0 — an option on a forward or futures price (Black76).

This class exposes the raw price function; the public wrappers add the AnalyticGreeks for their own parameterisation (which fixes how the carry moves with r).

Methods

static double price(OptionType type, double s, double k, double t, double r, double b, double sigma)
type
call or put
s
underlying level S
k
strike K
t
time to expiry in years T
r
continuously-compounded discount rate r
b
cost of carry b
sigma
lognormal volatility sigma