public class AnalyticFormulas extends Object
| Modifier and Type | Method and Description |
|---|---|
static double |
bachelierOptionImpliedVolatility(double forward,
double optionMaturity,
double optionStrike,
double payoffUnit,
double optionValue)
Calculates the Bachelier option implied volatility of a call, i.e., the payoff
max(S(T)-K,0), where S follows a normal process with constant volatility.
|
static double |
bachelierOptionValue(double forward,
double volatility,
double optionMaturity,
double optionStrike,
double payoffUnit)
Calculates the option value of a call, i.e., the payoff max(S(T)-K,0) P, where S follows a
normal process with constant volatility, i.e., a Bachelier model.
|
static RandomVariableInterface |
bachelierOptionValue(RandomVariableInterface forward,
RandomVariableInterface volatility,
double optionMaturity,
double optionStrike,
RandomVariableInterface payoffUnit)
Calculates the option value of a call, i.e., the payoff max(S(T)-K,0) P, where S follows a
normal process with constant volatility, i.e., a Bachelier model.
|
static double |
blackModelCapletValue(double forward,
double volatility,
double optionMaturity,
double optionStrike,
double periodLength,
double discountFactor)
Calculate the value of a caplet assuming the Black'76 model.
|
static double |
blackModelDgitialCapletValue(double forward,
double volatility,
double periodLength,
double discountFactor,
double optionMaturity,
double optionStrike)
Calculate the value of a digital caplet assuming the Black'76 model.
|
static double |
blackModelSwaptionValue(double forwardSwaprate,
double volatility,
double optionMaturity,
double optionStrike,
double swapAnnuity)
Calculate the value of a swaption assuming the Black'76 model.
|
static double |
blackScholesATMOptionValue(double volatility,
double optionMaturity,
double forward,
double payoffUnit)
Calculates the Black-Scholes option value of an atm call option.
|
static double |
blackScholesDigitalOptionDelta(double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
Calculates the delta of a digital option under a Black-Scholes model
|
static double |
blackScholesDigitalOptionValue(double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
Calculates the Black-Scholes option value of a digital call option.
|
static double |
blackScholesGeneralizedOptionValue(double forward,
double volatility,
double optionMaturity,
double optionStrike,
double payoffUnit)
Calculates the Black-Scholes option value of a call, i.e., the payoff max(S(T)-K,0) P, where S follows a log-normal process with constant log-volatility.
|
static RandomVariableInterface |
blackScholesGeneralizedOptionValue(RandomVariableInterface forward,
RandomVariableInterface volatility,
double optionMaturity,
double optionStrike,
RandomVariableInterface payoffUnit)
Calculates the Black-Scholes option value of a call, i.e., the payoff max(S(T)-K,0) P, where S follows a log-normal process with constant log-volatility.
|
static double |
blackScholesOptionDelta(double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
Calculates the delta of a call option under a Black-Scholes model
The method also handles cases where the forward and/or option strike is negative
and some limit cases where the forward or the option strike is zero.
|
static RandomVariableInterface |
blackScholesOptionDelta(RandomVariableInterface initialStockValue,
RandomVariableInterface riskFreeRate,
RandomVariableInterface volatility,
double optionMaturity,
double optionStrike)
Calculates the delta of a call option under a Black-Scholes model
The method also handles cases where the forward and/or option strike is negative
and some limit cases where the forward or the option strike is zero.
|
static RandomVariableInterface |
blackScholesOptionDelta(RandomVariableInterface initialStockValue,
RandomVariableInterface riskFreeRate,
RandomVariableInterface volatility,
double optionMaturity,
RandomVariableInterface optionStrike)
Calculates the delta of a call option under a Black-Scholes model
The method also handles cases where the forward and/or option strike is negative
and some limit cases where the forward or the option strike is zero.
|
static double |
blackScholesOptionGamma(double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
This static method calculated the gamma of a call option under a Black-Scholes model
|
static RandomVariableInterface |
blackScholesOptionGamma(RandomVariableInterface initialStockValue,
RandomVariableInterface riskFreeRate,
RandomVariableInterface volatility,
double optionMaturity,
double optionStrike)
This static method calculated the gamma of a call option under a Black-Scholes model
|
static double |
blackScholesOptionImpliedVolatility(double forward,
double optionMaturity,
double optionStrike,
double payoffUnit,
double optionValue)
Calculates the Black-Scholes option implied volatility of a call, i.e., the payoff
max(S(T)-K,0), where S follows a log-normal process with constant log-volatility.
|
static double |
blackScholesOptionRho(double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
This static method calculated the rho of a call option under a Black-Scholes model
|
static double |
blackScholesOptionValue(double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
Calculates the Black-Scholes option value of a call, i.e., the payoff max(S(T)-K,0), where S follows a log-normal process with constant log-volatility.
|
static double |
blackScholesOptionVega(double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
This static method calculated the vega of a call option under a Black-Scholes model
|
static double |
huntKennedyCMSAdjustedRate(double forwardSwaprate,
double volatility,
double swapAnnuity,
double optionMaturity,
double swapMaturity,
double payoffUnit)
Calculate the adjusted forward swaprate corresponding to a change of payoff unit from the given swapAnnuity to the given payoffUnit
using the Black-Scholes model for the swap rate together with the Hunt-Kennedy convexity adjustment.
|
static double |
huntKennedyCMSFloorValue(double forwardSwaprate,
double volatility,
double swapAnnuity,
double optionMaturity,
double swapMaturity,
double payoffUnit,
double optionStrike)
Calculate the value of a CMS strike using the Black-Scholes model for the swap rate together with
the Hunt-Kennedy convexity adjustment.
|
static double |
huntKennedyCMSOptionValue(double forwardSwaprate,
double volatility,
double swapAnnuity,
double optionMaturity,
double swapMaturity,
double payoffUnit,
double optionStrike)
Calculate the value of a CMS option using the Black-Scholes model for the swap rate together with
the Hunt-Kennedy convexity adjustment.
|
static double |
margrabeExchangeOptionValue(double spot1,
double spot2,
double volatility1,
double volatility2,
double correlation,
double optionMaturity)
Calculates the value of an Exchange option under a generalized Black-Scholes model, i.e., the payoff \( max(S_{1}(T)-S_{2}(T),0) \),
where \( S_{1} \) and \( S_{2} \) follow a log-normal process with constant log-volatility and constant instantaneous correlation.
|
static double |
price(Date settlementDate,
Date maturityDate,
double coupon,
double yield,
double redemption,
int frequency)
Re-implementation of the Excel PRICE function (a rather primitive bond price formula).
|
static double |
price(double timeToMaturity,
double coupon,
double yield,
double redemption,
int frequency)
Re-implementation of the Excel PRICE function (a rather primitive bond price formula).
|
public static double blackScholesGeneralizedOptionValue(double forward,
double volatility,
double optionMaturity,
double optionStrike,
double payoffUnit)
forward - The forward of the underlying.volatility - The Black-Scholes volatility.optionMaturity - The option maturity T.optionStrike - The option strike. If the option strike is ≤ 0.0 the method returns the value of the forward contract paying S(T)-K in T.payoffUnit - The payoff unit (e.g., the discount factor)public static RandomVariableInterface blackScholesGeneralizedOptionValue(RandomVariableInterface forward, RandomVariableInterface volatility, double optionMaturity, double optionStrike, RandomVariableInterface payoffUnit)
forward - The forward of the underlying.volatility - The Black-Scholes volatility.optionMaturity - The option maturity T.optionStrike - The option strike. If the option strike is ≤ 0.0 the method returns the value of the forward contract paying S(T)-K in T.payoffUnit - The payoff unit (e.g., the discount factor)public static double blackScholesOptionValue(double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
initialStockValue - The spot value of the underlying.riskFreeRate - The risk free rate r (df = exp(-r T)).volatility - The Black-Scholes volatility.optionMaturity - The option maturity T.optionStrike - The option strike. If the option strike is ≤ 0.0 the method returns the value of the forward contract paying S(T)-K in T.public static double blackScholesATMOptionValue(double volatility,
double optionMaturity,
double forward,
double payoffUnit)
volatility - The Black-Scholes volatility.optionMaturity - The option maturity T.forward - The forward, i.e., the expectation of the index under the measure associated with payoff unit.payoffUnit - The payoff unit, i.e., the discount factor or the anuity associated with the payoff.public static double blackScholesOptionDelta(double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
initialStockValue - The initial value of the underlying, i.e., the spot.riskFreeRate - The risk free rate of the bank account numerarie.volatility - The Black-Scholes volatility.optionMaturity - The option maturity T.optionStrike - The option strike.public static RandomVariableInterface blackScholesOptionDelta(RandomVariableInterface initialStockValue, RandomVariableInterface riskFreeRate, RandomVariableInterface volatility, double optionMaturity, double optionStrike)
initialStockValue - The initial value of the underlying, i.e., the spot.riskFreeRate - The risk free rate of the bank account numerarie.volatility - The Black-Scholes volatility.optionMaturity - The option maturity T.optionStrike - The option strike.public static RandomVariableInterface blackScholesOptionDelta(RandomVariableInterface initialStockValue, RandomVariableInterface riskFreeRate, RandomVariableInterface volatility, double optionMaturity, RandomVariableInterface optionStrike)
initialStockValue - The initial value of the underlying, i.e., the spot.riskFreeRate - The risk free rate of the bank account numerarie.volatility - The Black-Scholes volatility.optionMaturity - The option maturity T.optionStrike - The option strike.public static double blackScholesOptionGamma(double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
initialStockValue - The initial value of the underlying, i.e., the spot.riskFreeRate - The risk free rate of the bank account numerarie.volatility - The Black-Scholes volatility.optionMaturity - The option maturity T.optionStrike - The option strike.public static RandomVariableInterface blackScholesOptionGamma(RandomVariableInterface initialStockValue, RandomVariableInterface riskFreeRate, RandomVariableInterface volatility, double optionMaturity, double optionStrike)
initialStockValue - The initial value of the underlying, i.e., the spot.riskFreeRate - The risk free rate of the bank account numerarie.volatility - The Black-Scholes volatility.optionMaturity - The option maturity T.optionStrike - The option strike.public static double blackScholesOptionVega(double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
initialStockValue - The initial value of the underlying, i.e., the spot.riskFreeRate - The risk free rate of the bank account numerarie.volatility - The Black-Scholes volatility.optionMaturity - The option maturity T.optionStrike - The option strike.public static double blackScholesOptionRho(double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
initialStockValue - The initial value of the underlying, i.e., the spot.riskFreeRate - The risk free rate of the bank account numerarie.volatility - The Black-Scholes volatility.optionMaturity - The option maturity T.optionStrike - The option strike.public static double blackScholesOptionImpliedVolatility(double forward,
double optionMaturity,
double optionStrike,
double payoffUnit,
double optionValue)
max(S(T)-K,0)
, where S follows a log-normal process with constant log-volatility. The admissible values foroptionValue are between forward * payoffUnit - optionStrike (the inner value) and forward * payoffUnit.forward - The forward of the underlying.optionMaturity - The option maturity T.optionStrike - The option strike. If the option strike is ≤ 0.0 the method returns the value of the forward contract paying S(T)-K in T.payoffUnit - The payoff unit (e.g., the discount factor)optionValue - The option value. The admissible values for optionValue are between forward * payoffUnit - optionStrike (the inner value) and forward * payoffUnit.public static double blackScholesDigitalOptionValue(double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
initialStockValue - The initial value of the underlying, i.e., the spot.riskFreeRate - The risk free rate of the bank account numerarie.volatility - The Black-Scholes volatility.optionMaturity - The option maturity T.optionStrike - The option strike.public static double blackScholesDigitalOptionDelta(double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
initialStockValue - The initial value of the underlying, i.e., the spot.riskFreeRate - The risk free rate of the bank account numerarie.volatility - The Black-Scholes volatility.optionMaturity - The option maturity T.optionStrike - The option strike.public static double blackModelCapletValue(double forward,
double volatility,
double optionMaturity,
double optionStrike,
double periodLength,
double discountFactor)
forward - The forward (spot).volatility - The Black'76 volatility.optionMaturity - The option maturityoptionStrike - The option strike.periodLength - The period length of the underlying forward rate.discountFactor - The discount factor corresponding to the payment date (option maturity + period length).public static double blackModelDgitialCapletValue(double forward,
double volatility,
double periodLength,
double discountFactor,
double optionMaturity,
double optionStrike)
forward - The forward (spot).volatility - The Black'76 volatility.periodLength - The period length of the underlying forward rate.discountFactor - The discount factor corresponding to the payment date (option maturity + period length).optionMaturity - The option maturityoptionStrike - The option strike.public static double blackModelSwaptionValue(double forwardSwaprate,
double volatility,
double optionMaturity,
double optionStrike,
double swapAnnuity)
forwardSwaprate - The forward (spot)volatility - The Black'76 volatility.optionMaturity - The option maturity.optionStrike - The option strike.swapAnnuity - The swap annuity corresponding to the underlying swap.public static double margrabeExchangeOptionValue(double spot1,
double spot2,
double volatility1,
double volatility2,
double correlation,
double optionMaturity)
spot1 - Value of \( S_{1}(0) \)spot2 - Value of \( S_{2}(0) \)volatility1 - Volatility of \( \log(S_{1}(t)) \)volatility2 - Volatility of \( \log(S_{2}(t)) \)correlation - Instantaneous correlation of \( \log(S_{1}(t)) \) and \( \log(S_{2}(t)) \)optionMaturity - The option maturity \( T \).public static double bachelierOptionValue(double forward,
double volatility,
double optionMaturity,
double optionStrike,
double payoffUnit)
forward - The forward of the underlying.volatility - The Bachelier volatility.optionMaturity - The option maturity T.optionStrike - The option strike.payoffUnit - The payoff unit (e.g., the discount factor)public static RandomVariableInterface bachelierOptionValue(RandomVariableInterface forward, RandomVariableInterface volatility, double optionMaturity, double optionStrike, RandomVariableInterface payoffUnit)
forward - The forward of the underlying.volatility - The Bachelier volatility.optionMaturity - The option maturity T.optionStrike - The option strike.payoffUnit - The payoff unit (e.g., the discount factor)public static double bachelierOptionImpliedVolatility(double forward,
double optionMaturity,
double optionStrike,
double payoffUnit,
double optionValue)
max(S(T)-K,0)
, where S follows a normal process with constant volatility.forward - The forward of the underlying.optionMaturity - The option maturity T.optionStrike - The option strike. If the option strike is ≤ 0.0 the method returns the value of the forward contract paying S(T)-K in T.payoffUnit - The payoff unit (e.g., the discount factor)optionValue - The option value.public static double huntKennedyCMSOptionValue(double forwardSwaprate,
double volatility,
double swapAnnuity,
double optionMaturity,
double swapMaturity,
double payoffUnit,
double optionStrike)
forwardSwaprate - The forward swap ratevolatility - Volatility of the log of the swap rateswapAnnuity - The swap annuityoptionMaturity - The option maturityswapMaturity - The swap maturitypayoffUnit - The payoff unit, e.g., the discount factor corresponding to the payment dateoptionStrike - The option strikepublic static double huntKennedyCMSFloorValue(double forwardSwaprate,
double volatility,
double swapAnnuity,
double optionMaturity,
double swapMaturity,
double payoffUnit,
double optionStrike)
forwardSwaprate - The forward swap ratevolatility - Volatility of the log of the swap rateswapAnnuity - The swap annuityoptionMaturity - The option maturityswapMaturity - The swap maturitypayoffUnit - The payoff unit, e.g., the discount factor corresponding to the payment dateoptionStrike - The option strikepublic static double huntKennedyCMSAdjustedRate(double forwardSwaprate,
double volatility,
double swapAnnuity,
double optionMaturity,
double swapMaturity,
double payoffUnit)
forwardSwaprate - The forward swap ratevolatility - Volatility of the log of the swap rateswapAnnuity - The swap annuityoptionMaturity - The option maturityswapMaturity - The swap maturitypayoffUnit - The payoff unit, e.g., the discount factor corresponding to the payment datepublic static double price(Date settlementDate, Date maturityDate, double coupon, double yield, double redemption, int frequency)
settlementDate - Valuation date.maturityDate - Maturity date of the bond.coupon - Coupon payment.yield - Yield (discount factor, using frequency: 1/(1 + yield/frequency).redemption - Redemption (notional repayment).frequency - Frequency (1,2,4).public static double price(double timeToMaturity,
double coupon,
double yield,
double redemption,
int frequency)
timeToMaturity - The time to maturity.coupon - Coupon payment.yield - Yield (discount factor, using frequency: 1/(1 + yield/frequency).redemption - Redemption (notional repayment).frequency - Frequency (1,2,4).Copyright © 2015. All rights reserved.