WebCab Options and Futures Demo
v2.5
(J2SE Edition)

webcab.lib.finance.options
Class ImpliedVolatility

java.lang.Object
  |
  +--webcab.lib.finance.options.ImpliedVolatility
All Implemented Interfaces:
Serializable

public class ImpliedVolatility
extends Object
implements Serializable

This class calculates the implied volatility for a given European (call or put) option.

Remark: In order to solve the formulae resulting from the Back-Scholes analysis we have applied a numerical procedures known as Ridders method with a precision of 10E-6.

See Also:
Serialized Form

Constructor Summary
ImpliedVolatility()
          Creates a new instance.
 
Method Summary
 double callOnCurrencyVolatility(double foreignRiskFree, double exchangeRate, double strike, double riskFreeRate, Date evaluationDate, Date maturityDate, double callValue, BusinessCalendar businessCalendar)
          Calculates the implied volatility of a currency from the Black-Scholes formulae, knowing the value of a call option on that currency.
 double callOnCurrencyVolatility(double foreignRiskFree, double exchangeRate, double strike, double riskFreeRate, double timeToMaturity, double callValue)
          Calculates the implied volatility of a currency from the Black-Scholes formulae, knowing the value of a call option on that currency.
 double callOnFuturesVolatility(double futuresPrice, double strike, double riskFreeRate, Date evaluationDate, Date maturityDate, double callValue, BusinessCalendar businessCalendar)
          Calculates the implied volatility of a futures contract from the Black-Scholes formulae, knowing the value of a call option on that contract.
 double callOnFuturesVolatility(double futuresPrice, double strike, double riskFreeRate, double timeToMaturity, double callValue)
          Calculates the implied volatility of a futures contract from the Black-Scholes formulae, knowing the value of a call option on that contract.
 double callOnIndexVolatility(double yield, double indexValue, double strike, double riskFreeRate, Date evaluationDate, Date maturityDate, double callValue, BusinessCalendar businessCalendar)
          Calculates the implied volatility of an index from the Black-Scholes formulae, knowing the value of a call option on that index.
 double callOnIndexVolatility(double yield, double indexValue, double strike, double riskFreeRate, double timeToMaturity, double callValue)
          Calculates the implied volatility of an index from the Black-Scholes formulae, knowing the value of a call option on that index.
 double callVolatility(double assetPrice, double strike, double riskFreeRate, Date evaluationDate, Date maturityDate, double callValue, BusinessCalendar businessCalendar)
          Calculates the implied volatility of a non-dividend paying stock from the Black-Scholes formulae, knowing the value of a call option on that stock.
 double callVolatility(double assetPrice, double strike, double riskFreeRate, double timeToMaturity, double callValue)
          Calculates the implied volatility of a non-dividend paying stock from the Black-Scholes formulae, knowing the value of a call option on that stock.
 double callWithYieldVolatility(double yield, double assetPrice, double strike, double riskFreeRate, Date evaluationDate, Date maturityDate, double callValue, BusinessCalendar businessCalendar)
          Calculates the implied volatility of a stock which pays dividends during the option live from the Black-Scholes formulae, knowing the value of a call option on that stock.
 double callWithYieldVolatility(double yield, double assetPrice, double strike, double riskFreeRate, double timeToMaturity, double callValue)
          Calculates the implied volatility of a stock which pays dividends during the option live from the Black-Scholes formulae, knowing the value of a call option on that stock.
 double putOnCurrencyVolatility(double foreignRiskFree, double exchangeRate, double strike, double riskFreeRate, Date evaluationDate, Date maturityDate, double putValue, BusinessCalendar businessCalendar)
          Calculates the implied volatility of a currency from the Black-Scholes formulae, knowing the value of a put option on that currency.
 double putOnCurrencyVolatility(double foreignRiskFree, double exchangeRate, double strike, double riskFreeRate, double timeToMaturity, double putValue)
          Calculates the implied volatility of a currency from the Black-Scholes formulae, knowing the value of a put option on that currency.
 double putOnFuturesVolatility(double futuresPrice, double strike, double riskFreeRate, Date evaluationDate, Date maturityDate, double putValue, BusinessCalendar businessCalendar)
          Calculates the implied volatility of a futures contract from the Black-Scholes formulae, knowing the value of a put option on that contract.
 double putOnFuturesVolatility(double futuresPrice, double strike, double riskFreeRate, double timeToMaturity, double putValue)
          Calculates the implied volatility of a futures contract from the Black-Scholes formulae, knowing the value of a put option on that contract.
 double putOnIndexVolatility(double yield, double indexValue, double strike, double riskFreeRate, Date evaluationDate, Date maturityDate, double putValue, BusinessCalendar businessCalendar)
          Calculates the implied volatility of an index from the Black-Scholes formulae, knowing the value of a call option on that index.
 double putOnIndexVolatility(double yield, double indexValue, double strike, double riskFreeRate, double timeToMaturity, double putValue)
          Calculates the implied volatility of an index from the Black-Scholes formulae, knowing the value of a call option on that index.
 double putVolatility(double assetPrice, double strike, double riskFreeRate, Date evaluationDate, Date maturityDate, double putValue, BusinessCalendar businessCalendar)
          Calculates the implied volatility of a non-dividend paying stock from the Black-Scholes formulae, knowing the value of a put option on that stock.
 double putVolatility(double assetPrice, double strike, double riskFreeRate, double timeToMaturity, double putValue)
          Calculates the implied volatility of a non-dividend paying stock from the Black-Scholes formulae, knowing the value of a put option on that stock.
 double putWithYieldVolatility(double yield, double assetPrice, double strike, double riskFreeRate, Date evaluationDate, Date maturityDate, double putValue, BusinessCalendar businessCalendar)
          Calculates the implied volatility of a stock which pays dividends during the option life from the Black-Scholes formulae, knowing the value of a put option on that stock.
 double putWithYieldVolatility(double yield, double assetPrice, double strike, double riskFreeRate, double timeToMaturity, double putValue)
          Calculates the implied volatility of a stock which pays dividends during the option life from the Black-Scholes formulae, knowing the value of a put option on that stock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImpliedVolatility

public ImpliedVolatility()
Creates a new instance.

Method Detail

callVolatility

public double callVolatility(double assetPrice,
                             double strike,
                             double riskFreeRate,
                             Date evaluationDate,
                             Date maturityDate,
                             double callValue,
                             BusinessCalendar businessCalendar)
                      throws OptionsException,
                             ImpliedVolatilityDemoException
Calculates the implied volatility of a non-dividend paying stock from the Black-Scholes formulae, knowing the value of a call option on that stock.

Parameters:
assetPrice - the stock price at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
callValue - the market value of the call option
evaluationDate - the date when the implied volatility of the option contract is evaluated
maturityDate - the date when the option contract matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

callVolatility

public double callVolatility(double assetPrice,
                             double strike,
                             double riskFreeRate,
                             double timeToMaturity,
                             double callValue)
                      throws OptionsException,
                             ImpliedVolatilityDemoException
Calculates the implied volatility of a non-dividend paying stock from the Black-Scholes formulae, knowing the value of a call option on that stock.

Parameters:
assetPrice - the stock price at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
timeToMaturity - the time (in years) until the option contract matures
callValue - the market value of the call option
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

putVolatility

public double putVolatility(double assetPrice,
                            double strike,
                            double riskFreeRate,
                            Date evaluationDate,
                            Date maturityDate,
                            double putValue,
                            BusinessCalendar businessCalendar)
                     throws OptionsException,
                            ImpliedVolatilityDemoException
Calculates the implied volatility of a non-dividend paying stock from the Black-Scholes formulae, knowing the value of a put option on that stock.

Parameters:
assetPrice - the stock price at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
putValue - the market value of the put option
evaluationDate - the date when the implied volatility of the option contract is evaluated
maturityDate - the date when the option contract matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

putVolatility

public double putVolatility(double assetPrice,
                            double strike,
                            double riskFreeRate,
                            double timeToMaturity,
                            double putValue)
                     throws OptionsException,
                            ImpliedVolatilityDemoException
Calculates the implied volatility of a non-dividend paying stock from the Black-Scholes formulae, knowing the value of a put option on that stock.

Parameters:
assetPrice - the stock price at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
timeToMaturity - the time (in years) until the option contract matures
putValue - the market value of the put option
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

callWithYieldVolatility

public double callWithYieldVolatility(double yield,
                                      double assetPrice,
                                      double strike,
                                      double riskFreeRate,
                                      Date evaluationDate,
                                      Date maturityDate,
                                      double callValue,
                                      BusinessCalendar businessCalendar)
                               throws OptionsException,
                                      ImpliedVolatilityDemoException
Calculates the implied volatility of a stock which pays dividends during the option live from the Black-Scholes formulae, knowing the value of a call option on that stock.

Parameters:
yield - the continuous dividend yield paid by the underlying asset
assetPrice - the stock price at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
callValue - the market value of the call option
evaluationDate - the date when the implied volatility of the option contract is evaluated
maturityDate - the date when the option contract matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

callWithYieldVolatility

public double callWithYieldVolatility(double yield,
                                      double assetPrice,
                                      double strike,
                                      double riskFreeRate,
                                      double timeToMaturity,
                                      double callValue)
                               throws OptionsException,
                                      ImpliedVolatilityDemoException
Calculates the implied volatility of a stock which pays dividends during the option live from the Black-Scholes formulae, knowing the value of a call option on that stock.

Parameters:
yield - the continuous dividend yield paid by the underlying asset
assetPrice - the stock price at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
timeToMaturity - the time (in years) until the option contract matures
callValue - the market value of the call option
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

putWithYieldVolatility

public double putWithYieldVolatility(double yield,
                                     double assetPrice,
                                     double strike,
                                     double riskFreeRate,
                                     Date evaluationDate,
                                     Date maturityDate,
                                     double putValue,
                                     BusinessCalendar businessCalendar)
                              throws OptionsException,
                                     ImpliedVolatilityDemoException
Calculates the implied volatility of a stock which pays dividends during the option life from the Black-Scholes formulae, knowing the value of a put option on that stock.

Parameters:
yield - the continuous dividend yield paid by the underlying asset
assetPrice - the stock price at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
putValue - the market value of the put option
evaluationDate - the date when the implied volatility of the option contract is evaluated
maturityDate - the date when the option contract matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

putWithYieldVolatility

public double putWithYieldVolatility(double yield,
                                     double assetPrice,
                                     double strike,
                                     double riskFreeRate,
                                     double timeToMaturity,
                                     double putValue)
                              throws OptionsException,
                                     ImpliedVolatilityDemoException
Calculates the implied volatility of a stock which pays dividends during the option life from the Black-Scholes formulae, knowing the value of a put option on that stock.

Parameters:
yield - the continuous dividend yield paid by the underlying asset
assetPrice - the stock price at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
timeToMaturity - the time (in years) until the option contract matures
putValue - the market value of the put option
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

callOnIndexVolatility

public double callOnIndexVolatility(double yield,
                                    double indexValue,
                                    double strike,
                                    double riskFreeRate,
                                    Date evaluationDate,
                                    Date maturityDate,
                                    double callValue,
                                    BusinessCalendar businessCalendar)
                             throws OptionsException,
                                    ImpliedVolatilityDemoException
Calculates the implied volatility of an index from the Black-Scholes formulae, knowing the value of a call option on that index.

Parameters:
yield - the continuous yield of the index
indexValue - the value of the index at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
callValue - the market value of the call option
evaluationDate - the date when the implied volatility of the option contract is evaluated
maturityDate - the date when the option contract matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

callOnIndexVolatility

public double callOnIndexVolatility(double yield,
                                    double indexValue,
                                    double strike,
                                    double riskFreeRate,
                                    double timeToMaturity,
                                    double callValue)
                             throws OptionsException,
                                    ImpliedVolatilityDemoException
Calculates the implied volatility of an index from the Black-Scholes formulae, knowing the value of a call option on that index.

Parameters:
yield - the continuous yield of the index
indexValue - the value of the index at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
timeToMaturity - the time (in years) until the option contract matures
callValue - the market value of the call option
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

putOnIndexVolatility

public double putOnIndexVolatility(double yield,
                                   double indexValue,
                                   double strike,
                                   double riskFreeRate,
                                   Date evaluationDate,
                                   Date maturityDate,
                                   double putValue,
                                   BusinessCalendar businessCalendar)
                            throws OptionsException,
                                   ImpliedVolatilityDemoException
Calculates the implied volatility of an index from the Black-Scholes formulae, knowing the value of a call option on that index.

Parameters:
yield - the continuous yield of the index
indexValue - the value of the index at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
putValue - the market value of the put option
evaluationDate - the date when the implied volatility of the option contract is evaluated
maturityDate - the date when the option contract matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

putOnIndexVolatility

public double putOnIndexVolatility(double yield,
                                   double indexValue,
                                   double strike,
                                   double riskFreeRate,
                                   double timeToMaturity,
                                   double putValue)
                            throws OptionsException,
                                   ImpliedVolatilityDemoException
Calculates the implied volatility of an index from the Black-Scholes formulae, knowing the value of a call option on that index.

Parameters:
yield - the continuous yield of the index
indexValue - the value of the index at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
timeToMaturity - the time (in years) until the option contract matures
putValue - the market value of the put option
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

callOnCurrencyVolatility

public double callOnCurrencyVolatility(double foreignRiskFree,
                                       double exchangeRate,
                                       double strike,
                                       double riskFreeRate,
                                       Date evaluationDate,
                                       Date maturityDate,
                                       double callValue,
                                       BusinessCalendar businessCalendar)
                                throws OptionsException,
                                       ImpliedVolatilityDemoException
Calculates the implied volatility of a currency from the Black-Scholes formulae, knowing the value of a call option on that currency.

Parameters:
foreignRiskFree - the continuously compounded risk free interest rate in the foreign currency
exchangeRate - the present exchange rate
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
callValue - the market value of the call option
evaluationDate - the date when the implied volatility of the option contract is evaluated
maturityDate - the date when the option contract matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

callOnCurrencyVolatility

public double callOnCurrencyVolatility(double foreignRiskFree,
                                       double exchangeRate,
                                       double strike,
                                       double riskFreeRate,
                                       double timeToMaturity,
                                       double callValue)
                                throws OptionsException,
                                       ImpliedVolatilityDemoException
Calculates the implied volatility of a currency from the Black-Scholes formulae, knowing the value of a call option on that currency.

Parameters:
foreignRiskFree - the continuously compounded risk free interest rate in the foreign currency
exchangeRate - the present exchange rate
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
timeToMaturity - the time (in years) until the option contract matures
callValue - the market value of the call option
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

putOnCurrencyVolatility

public double putOnCurrencyVolatility(double foreignRiskFree,
                                      double exchangeRate,
                                      double strike,
                                      double riskFreeRate,
                                      Date evaluationDate,
                                      Date maturityDate,
                                      double putValue,
                                      BusinessCalendar businessCalendar)
                               throws OptionsException,
                                      ImpliedVolatilityDemoException
Calculates the implied volatility of a currency from the Black-Scholes formulae, knowing the value of a put option on that currency.

Parameters:
foreignRiskFree - the continuously compounded risk free interest rate in the foreign currency
exchangeRate - the present exchange rate
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
putValue - the market value of the put option
evaluationDate - the date when the implied volatility of the option contract is evaluated
maturityDate - the date when the option contract matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

putOnCurrencyVolatility

public double putOnCurrencyVolatility(double foreignRiskFree,
                                      double exchangeRate,
                                      double strike,
                                      double riskFreeRate,
                                      double timeToMaturity,
                                      double putValue)
                               throws OptionsException,
                                      ImpliedVolatilityDemoException
Calculates the implied volatility of a currency from the Black-Scholes formulae, knowing the value of a put option on that currency.

Parameters:
foreignRiskFree - the continuously compounded risk free interest rate in the foreign currency
exchangeRate - the present exchange rate
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
timeToMaturity - the time (in years) until the option contract matures
putValue - the market value of the put option
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

callOnFuturesVolatility

public double callOnFuturesVolatility(double futuresPrice,
                                      double strike,
                                      double riskFreeRate,
                                      Date evaluationDate,
                                      Date maturityDate,
                                      double callValue,
                                      BusinessCalendar businessCalendar)
                               throws OptionsException,
                                      ImpliedVolatilityDemoException
Calculates the implied volatility of a futures contract from the Black-Scholes formulae, knowing the value of a call option on that contract.

Parameters:
futuresPrice - the futures price at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
callValue - the market value of the call option
evaluationDate - the date when the implied volatility of the option contract is evaluated
maturityDate - the date when the option contract matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

callOnFuturesVolatility

public double callOnFuturesVolatility(double futuresPrice,
                                      double strike,
                                      double riskFreeRate,
                                      double timeToMaturity,
                                      double callValue)
                               throws OptionsException,
                                      ImpliedVolatilityDemoException
Calculates the implied volatility of a futures contract from the Black-Scholes formulae, knowing the value of a call option on that contract.

Parameters:
futuresPrice - the futures price at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
timeToMaturity - the time (in years) until the option contract matures
callValue - the market value of the call option
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

putOnFuturesVolatility

public double putOnFuturesVolatility(double futuresPrice,
                                     double strike,
                                     double riskFreeRate,
                                     Date evaluationDate,
                                     Date maturityDate,
                                     double putValue,
                                     BusinessCalendar businessCalendar)
                              throws OptionsException,
                                     ImpliedVolatilityDemoException
Calculates the implied volatility of a futures contract from the Black-Scholes formulae, knowing the value of a put option on that contract.

Parameters:
futuresPrice - the futures price at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
putValue - the market value of the put option
evaluationDate - the date when the implied volatility of the option contract is evaluated
maturityDate - the date when the option contract matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

putOnFuturesVolatility

public double putOnFuturesVolatility(double futuresPrice,
                                     double strike,
                                     double riskFreeRate,
                                     double timeToMaturity,
                                     double putValue)
                              throws OptionsException,
                                     ImpliedVolatilityDemoException
Calculates the implied volatility of a futures contract from the Black-Scholes formulae, knowing the value of a put option on that contract.

Parameters:
futuresPrice - the futures price at time zero
strike - the strike of the option
riskFreeRate - the continuously compounded risk free interest rate
timeToMaturity - the time (in years) until the option contract matures
putValue - the market value of the put option
Throws:
OptionsException - thrown when the implied volatility cannot be deduced from the given values.
ImpliedVolatilityDemoException

WebCab Options and Futures Demo
v2.5
(J2SE Edition)