public class BlackScholes extends Object
Modifier and Type | Method and Description |
---|---|
static double |
carryRho(boolean isCall,
double S,
double X,
double T,
double r,
double b,
double v)
Computes the generalized Black-Scholes carryRho (first order partial derivative of option price with respect to cost-of-carry).
|
static double |
charm(boolean isCall,
double S,
double X,
double T,
double r,
double b,
double v)
Computes the generalized Black-Scholes charm (first order partial derivative of Delta with respect to time to expiry).
|
static double |
delta(boolean isCall,
double S,
double X,
double T,
double r,
double b,
double v)
Computes the generalized Black-Scholes delta (first order partial derivative of option price with respect to stock price).
|
static double |
driftlessTheta(double S,
double X,
double T,
double r,
double b,
double v)
Computes the generalized Black-Scholes driftlessTheta (theta assuing the risk free rate and the cost of carry are zero).
|
static double |
gamma(double S,
double X,
double T,
double r,
double b,
double v)
Computes the generalized Black-Scholes gamma (second order partial derivative of option price with respect to stock price).
|
static double |
gammaP(double S,
double X,
double T,
double r,
double b,
double v)
Computes the generalized Black-Scholes percentage gamma (first order partial derivative of delta with respect to ln(stock price)).
|
static double |
impliedVolBisect(double P,
Boolean isCall,
double S,
double X,
double T,
double r,
double b)
Generalized Black-Scholes implied vol fitter using a bisection algorithm.
|
static double |
impliedVolBisect(double P,
Boolean isCall,
double S,
double X,
double T,
double r,
double b,
double eps,
int maxIters)
Generalized Black-Scholes implied vol fitter using a bisection algorithm.
|
static double |
impliedVolNewton(double P,
Boolean isCall,
double S,
double X,
double T,
double r,
double b)
Generalized Black-Scholes implied vol fitter using a newton algorithm.
|
static double |
impliedVolNewton(double P,
Boolean isCall,
double S,
double X,
double T,
double r,
double b,
double eps,
int maxIters)
Generalized Black-Scholes implied vol fitter using a newton algorithm.
|
static double |
impliedVolNewtonP(double P,
Boolean isCall,
double S,
double X,
double T,
double r,
double b)
Generalized Black-Scholes implied vol fitter using a newton algorithm based on log(vol).
|
static double |
impliedVolNewtonP(double P,
Boolean isCall,
double S,
double X,
double T,
double r,
double b,
double eps,
int maxIters)
Generalized Black-Scholes implied vol fitter using a newton algorithm based on log(vol).
|
static double |
price(boolean isCall,
double S,
double X,
double T,
double r,
double b,
double v)
Computes the generalized Black-Scholes option price.
|
static double |
rho(boolean isCall,
double S,
double X,
double T,
double r,
double b,
double v)
Computes the generalized Black-Scholes rho (first order partial derivative of option price with respect to risk-free rate).
|
static double |
strikeDelta(boolean isCall,
double S,
double X,
double T,
double r,
double b,
double v)
Computes the generalized Black-Scholes strikeDelta (first order partial derivative of option price with respect to strike price).
|
static double |
strikeFromDeltaBisect(double delta,
Boolean isCall,
double S,
double T,
double r,
double b,
double v)
Finds the Generalized Black-Scholes strike from the delta.
|
static double |
strikeFromDeltaBisect(double delta,
Boolean isCall,
double S,
double T,
double r,
double b,
double v,
double eps,
int maxIters)
Finds the Generalized Black-Scholes strike from the delta.
|
static double |
theta(boolean isCall,
double S,
double X,
double T,
double r,
double b,
double v)
Computes the generalized Black-Scholes theta (first order partial derivative of option price with respect to time to expiry).
|
static double |
vega(double S,
double X,
double T,
double r,
double b,
double v)
Computes the generalized Black-Scholes vega (first order partial derivative of option price with respect to volatility).
|
static double |
vegaBleed(double S,
double X,
double T,
double r,
double b,
double v)
Computes the generalized Black-Scholes vegaBleed (first order partial derivative of Vega with respect to time to expiry).
|
static double |
vegaP(double S,
double X,
double T,
double r,
double b,
double v)
Computes the generalized Black-Scholes percentage vega (first order partial derivative of vega with respect to ln(volatility)).
|
static double |
vomma(double S,
double X,
double T,
double r,
double b,
double v)
Computes the generalized Black-Scholes vomma (second order partial derivative of option price with respect to volatility).
|
static double |
vommaP(double S,
double X,
double T,
double r,
double b,
double v)
Computes the generalized Black-Scholes percentage vomma (first order partial derivative of Vega with respect to ln(volatility)).
|
public static double price(boolean isCall, double S, double X, double T, double r, double b, double v)
isCall
- true for call; false for put.S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double delta(boolean isCall, double S, double X, double T, double r, double b, double v)
isCall
- true for call; false for put.S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double gamma(double S, double X, double T, double r, double b, double v)
S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double gammaP(double S, double X, double T, double r, double b, double v)
S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double vega(double S, double X, double T, double r, double b, double v)
S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double vegaP(double S, double X, double T, double r, double b, double v)
S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double vomma(double S, double X, double T, double r, double b, double v)
S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double vommaP(double S, double X, double T, double r, double b, double v)
S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double vegaBleed(double S, double X, double T, double r, double b, double v)
S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double charm(boolean isCall, double S, double X, double T, double r, double b, double v)
isCall
- true for call; false for put.S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double theta(boolean isCall, double S, double X, double T, double r, double b, double v)
isCall
- true for call; false for put.S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double driftlessTheta(double S, double X, double T, double r, double b, double v)
S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double rho(boolean isCall, double S, double X, double T, double r, double b, double v)
isCall
- true for call; false for put.S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double carryRho(boolean isCall, double S, double X, double T, double r, double b, double v)
isCall
- true for call; false for put.S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double strikeDelta(boolean isCall, double S, double X, double T, double r, double b, double v)
isCall
- true for call; false for put.S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double impliedVolBisect(double P, Boolean isCall, double S, double X, double T, double r, double b)
P
- option priceisCall
- true for call; false for put.S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carrypublic static double impliedVolBisect(double P, Boolean isCall, double S, double X, double T, double r, double b, double eps, int maxIters)
P
- option priceisCall
- true for call; false for put.S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryeps
- volatility convergence tolerancemaxIters
- maximum number of optimization iterationspublic static double impliedVolNewton(double P, Boolean isCall, double S, double X, double T, double r, double b)
P
- option priceisCall
- true for call; false for put.S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carrypublic static double impliedVolNewton(double P, Boolean isCall, double S, double X, double T, double r, double b, double eps, int maxIters)
P
- option priceisCall
- true for call; false for put.S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryeps
- volatility convergence tolerancemaxIters
- maximum number of optimization iterationspublic static double impliedVolNewtonP(double P, Boolean isCall, double S, double X, double T, double r, double b)
P
- option priceisCall
- true for call; false for put.S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carrypublic static double impliedVolNewtonP(double P, Boolean isCall, double S, double X, double T, double r, double b, double eps, int maxIters)
P
- option priceisCall
- true for call; false for put.S
- underlying stock priceX
- strike priceT
- years to expiryr
- risk-free rateb
- cost-of-carryeps
- volatility convergence tolerancemaxIters
- maximum number of optimization iterationspublic static double strikeFromDeltaBisect(double delta, Boolean isCall, double S, double T, double r, double b, double v)
delta
- deltaisCall
- true for call; false for put.S
- underlying stock priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilitypublic static double strikeFromDeltaBisect(double delta, Boolean isCall, double S, double T, double r, double b, double v, double eps, int maxIters)
delta
- deltaisCall
- true for call; false for put.S
- underlying stock priceT
- years to expiryr
- risk-free rateb
- cost-of-carryv
- volatilityeps
- volatility convergence tolerancemaxIters
- maximum number of optimization iterations