Login     Register

        Contact Us     Search

XLeratorDB/financial-options Documentation

SQL Server non-recombining tree function for implied volatility


NonRecombiningTreeIV

Updated: 31 Mar 2014


Use the scalar function NonRecombiningTreeIV to calculate the implied volatility of American or European options paying discrete dividends using a non-recombining tree as suggested in Options, Futures, and Other Derivatives, 8th Edition, by John C. Hull. The NonRecombiningTreeIV calculation creates a new binomial tree at every node where there is a dividend payment, potentially creating millions of nodes and should be used sparingly. Primarily, the NonRecombiningTreeIV function should only be used for American Call options where the dividend is very large in relation to the price of the asset, as the recombining tree calculation for dividend-paying stocks tends to underestimate the theoretical value.
Syntax
SELECT [wctOptions].[wct].[NonRecombiningTreeIV](
  <@CallPut, nvarchar(4000),>
 ,<@AmEur, nvarchar(4000),>
 ,<@AssetPrice, float,>
 ,<@StrikePrice, float,>
 ,<@TimeToMaturity, float,>
 ,<@RiskFreeRate, float,>
 ,<@DividendRate, float,>
 ,<@Dividend_RangeQuery, nvarchar(max),>
 ,<@Price, float,>
 ,<@NumberOfSteps, int,>)
Arguments
@CallPut
identifies the option as being a call ('C') or a put ('P'). @CallPut is an expression of type nvarchar or of a type that can be implicitly converted to nvarchar.
@AmEur
identifies the option as being American ('A') or European ('E'). @AmEur is an expression of type nvarchar or of a type that can be implicitly converted to nvarchar.
@AssetPrice
the price of the underlying asset. @AssetPrice is an expression of type float or of a type that can be implicitly converted to float.
@StrikePrice
the exercise price of the option. @StrikePrice is an expression of type float or of a type that can be implicitly converted to float.
@TimeToMaturity
the time to expiration of the option, expressed in years. @TimeToMaturity is an expression of type float or of a type that can be implicitly converted to float.
@RiskFreeRate
the annualized, continuously compounded zero-coupon risk-free rate over the life of the option. @RiskFreeRate is an expression of type float or of a type that can be implicitly converted to float.
@DividendRate
the annualized, continuously compounded zero-coupon dividend rate over the life of the option, used in addition to the discrete dividends. @DividendRate is an expression of type float or of a type that can be implicitly converted to float.
@Dividend_RangeQuery
a string containing an SQL statement which, when executed, provides the function with the times and amounts of the dividends to be used in the calculation. The results of the SQL must contain exactly two columns, the first being the time value, as a float or as a value that implicitly converts to float, and the second being the dividend amount as float, or as a value that implicitly converts to float. @Dividend_RangeQuery is an expression of type nvarchar or of a type that can be implicitly converted to nvarchar.
@Price
the price of the option. @Price is an expression of type float or of a type that can be implicitly converted to float.
@NumberOfSteps
the number of steps in the binomial tree. @NumberOfSteps is an expression of type int or of a type that can be implicitly converted to int.
Return Type
float
Remarks
·         @Volatility must be greater than zero (@Volatility > 0).
·         @TimeToMaturity must be greater than zero (@TimeToMaturity > 0).
·         @AssetPrice must be greater than zero (@AssetPrice > 0).
·         @StrikePrice must be greater than zero (@StrikePrice > 0).
·         @NumberOfSteps must be greater than 1 (@NumberOfSteps > 1)
·         Negative time values returned by @Dividend_RangeQuery are ignored.
·         Time values returned by @Dividend_RangeQuery that are greater than @TimeToMaturity are ignored.
·         If @RiskFreeRate is NULL then @RiskFreeRate is set to zero.
·         If @DividendRate is NULL then @DividendRate is set to zero.
·         If @NumberOfSteps is NULL then @NumberOfSteps is set to 100.
·         To calculate the price and/or Greeks of the option us NonRecombiningTree.
·         To calculate the implied volatility using proportional dividends (where the dividend is specified with a time and a percentage rather than a monetary value) use ProportionalDividendsIV.
Examples
Calculate the volatility for an American call option expiring in one year with asset price of 100, a strike price of 100 and a theoretical value of 11.9444. The risk-free rate is 2.75%. A single dividend of 50 will be paid in 10 months' time. The number of steps is 100.
SELECT wct.NonRecombiningTreeIV(
       'C'        --Put/Call
      ,'A'        --American/European
      ,100        --Asset Price
      ,100        --Strike Price
      ,1          --Time-to-maturity
      ,.0275      --Risk-free rate
      ,NULL       --Dividend rate
      ,'SELECT 0.83333333333, 50'   --Discrete Dividends
      ,11.9444    --Price
      ,100        --Number of Steps
      ) as VOLATILITY
This produces the following result.
            VOLATILITY
----------------------
              0.300002

 

See Also

 



Copyright 2008-2013 WestClinTech LLC         Privacy Policy        Terms of Service