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.
With vol <= 0 every function returns the deterministic limit
instead of dividing by σ√T: delta is the discounted in-the-money indicator
on the forward (one half at F = K), gamma is 0, vega is 0 except exactly
at the forward, theta and rho are the derivatives of the discounted forward
intrinsic value.
-
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 from a market price, throughImpliedVolatility.black(BlackScholes.OptionType, double, double, double, double)on the forward F = S e^{(r-q)T} and the undiscounted price.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 from a market price, throughImpliedVolatility.black(BlackScholes.OptionType, double, double, double, double)on the forward F = S e^{(r-q)T} and the undiscounted price. Accurate to a few ulps of σ wherever the price itself carries information, including deep wings and very short or long expiries. Returns NaN when the price is outside the attainable range (below intrinsic, or at or above the discounted zero-strike bound) and 0 when it equals intrinsic exactly. -
intrinsic
-