Class BlackScholes
java.lang.Object
com.quantfinlib.pricing.BlackScholes
Black-Scholes-Merton option pricing and Greeks with a continuous carry
yield
q: set q to the dividend yield for equities or the
foreign interest rate for FX (Garman-Kohlhagen). All rates and volatility
are annualized; theta is per year; vega/rho are per 1.00 change.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordFull Greek set for one option.static enum -
Method Summary
Modifier and TypeMethodDescriptionstatic doubledelta(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears) static doublegamma(double spot, double strike, double rate, double carry, double vol, double timeYears) static BlackScholes.Greeksgreeks(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears) static doubleimpliedVol(BlackScholes.OptionType type, double marketPrice, double spot, double strike, double rate, double carry, double timeYears) Implied volatility by bisection.static doubleintrinsic(BlackScholes.OptionType type, double spot, double strike) static doubleprice(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears) static doublerho(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears) Per 1.00 change in the domestic rate.static doubletheta(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears) Per year (divide by 365 for per-calendar-day).static doublevega(double spot, double strike, double rate, double carry, double vol, double timeYears) Per 1.00 change in volatility (divide by 100 for per-vol-point).
-
Method Details
-
price
public static double price(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears) -
delta
public static double delta(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears) -
gamma
public static double gamma(double spot, double strike, double rate, double carry, double vol, double timeYears) -
vega
public static double vega(double spot, double strike, double rate, double carry, double vol, double timeYears) Per 1.00 change in volatility (divide by 100 for per-vol-point). -
theta
public static double theta(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears) Per year (divide by 365 for per-calendar-day). -
rho
public static double rho(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears) Per 1.00 change in the domestic rate. -
greeks
public static BlackScholes.Greeks greeks(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears) -
impliedVol
public static double impliedVol(BlackScholes.OptionType type, double marketPrice, double spot, double strike, double rate, double carry, double timeYears) Implied volatility by bisection. ReturnsNaNwhen the price is not attainable inside the [1e-4, 5.0] vol bracket (below intrinsic, or above the maximum BS price) — a stale or rounded market price must surface as "no vol", not silently come back as the 500% search bound and poison a smile. -
intrinsic
-