Logo

BinomialDiscreteDividendsTree

Updated 2024-02-13 20:46:28.303000

Syntax

SELECT * FROM [westclintech].[wct].[BinomialDiscreteDividendsTree](
  <@CallPut, nvarchar(4000),>
 ,<@AmEur, nvarchar(4000),>
 ,<@AssetPrice, float,>
 ,<@StrikePrice, float,>
 ,<@TimeToMaturity, float,>
 ,<@RiskFreeRate, float,>
 ,<@DividendRate, float,>
 ,<@Dividend_RangeQuery, nvarchar(max),>
 ,<@Volatility, float,>
 ,<@NumberOfSteps, int,>)

Description

Use the table-valued function BinomialDiscreteDividendsTree to return the option value, intrinsic value, underlying value, and present value of the dividend amounts for each node on a binomial tree for an American or European option paying discrete dividends.

Arguments

@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.

@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.

@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.

@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.

@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.

@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.

@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.

@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.

@Volatility

the volatility of the relative price change of the underlying asset. @Volatility is an expression of type float or of a type that can be implicitly converted to float.

@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.

Return Type

table

{"columns": [{"field": "colName", "headerName": "Name", "header": "name"}, {"field": "colDatatype", "headerName": "Type", "header": "type"}, {"field": "colDesc", "headerName": "Description", "header": "description", "minWidth": 1000}], "rows": [{"id": "32ddb3e5-f36f-4d03-a62f-8fa9cf9bdc0b", "colName": "node", "colDatatype": "int", "colDesc": "The node within the step"}, {"id": "26124bda-4fe9-4e2e-8967-aeecbfd82225", "colName": "stepno", "colDatatype": "int", "colDesc": "The step number"}, {"id": "94546f5d-2d65-4748-934b-e206a23ec668", "colName": "underlying", "colDatatype": "int", "colDesc": "the underlying value of the undelying asset at this step and node in the tree"}, {"id": "f185fade-1d42-4882-9429-dec82c2a2ad0", "colName": "intrinsic", "colDatatype": "float", "colDesc": "the intrinsic value of the option at this step and node in the tree"}, {"id": "0e52fbd2-bbf0-432f-9148-e1c94fd3857f", "colName": "price", "colDatatype": "float", "colDesc": "the theoretical value of the option at this step and node in the tree"}, {"id": "4381a9d1-9f4b-4301-b28e-0df9c57024ca", "colName": "PVDividends", "colDatatype": "float", "colDesc": "the present value of the dividends at this step and node in the tree"}]}

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.

Examples

In this example we have an American put where the underlying price is 50, the exercise price is 50, the risk-free rate is 0.10, the volatility is 0.4 and dividends are expected according to the following schedule:

{"columns":[{"field":"T","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"T":"0.071233","amt":"0.11"},{"T":"0.320548","amt":"0.11"},{"T":"0.569863","amt":"0.12"},{"T":"0.819178","amt":"0.12"}]}

The number of steps is 10 and the time-to-maturity is 1 (year).

SELECT *
FROM wct.BinomialDiscreteDividendsTree(
                                          'P',  --@CallPut
                                          'A',  --@AmEur
                                          50,   --@AssetPrice
                                          50,   --@StrikePrice
                                          1,    --@TimeToMaturity
                                          0.10, --@RiskFreeRate
                                          0,    --@DividendRate  
                                          'SELECT T, amt
      FROM (VALUES
            (0.071233,0.11),
            (0.320548,0.11),
            (0.569863,0.12),
            (0.819178,0.12)
            )n(T,amt)'                    ,
                                                --@Dividend_RangeQuery
                                          0.4,  --@Volatility
                                          10    --@NumberOfSteps
                                      );

This produces the following result which has been reformatted for presentation purposes.

{"columns":[{"field":"node","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"stepno","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"underlying","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"intrinsic","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"price","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVdividends","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"node":"0","stepno":"0","underlying":"50","intrinsic":"0","price":"6.01274568142758","PVdividends":"0.439663671284362"},{"node":"0","stepno":"1","underlying":"44.0054410839973","intrinsic":"5.99455891600274","price":"8.53852315216219","PVdividends":"0.333765472057695"},{"node":"1","stepno":"1","underlying":"56.5767857500315","intrinsic":"0","price":"3.68586064403495","PVdividends":"0.333765472057695"},{"node":"0","stepno":"2","underlying":"38.819813735215","intrinsic":"11.180186264785","price":"11.7811074579686","PVdividends":"0.337119870818801"},{"node":"1","stepno":"2","underlying":"49.8974561995344","intrinsic":"0.102543800465561","price":"5.56748543974702","PVdividends":"0.337119870818801"},{"node":"2","stepno":"2","underlying":"64.1639129137011","intrinsic":"0","price":"1.93670833570754","PVdividends":"0.337119870818801"},{"node":"0","stepno":"3","underlying":"34.2507646026395","intrinsic":"15.7492353973605","price":"15.7492353973605","PVdividends":"0.340507981847923"},{"node":"1","stepno":"3","underlying":"44.0121835937875","intrinsic":"5.98781640621251","price":"8.17163684481388","PVdividends":"0.340507981847923"},{"node":"2","stepno":"3","underlying":"56.5835282598217","intrinsic":"0","price":"3.1558989555241","PVdividends":"0.340507981847923"},{"node":"3","stepno":"3","underlying":"72.7736648429909","intrinsic":"0","price":"0.79442044077238","PVdividends":"0.340507981847923"},{"node":"0","stepno":"4","underlying":"30.1141599786656","intrinsic":"19.8858400213344","price":"19.8858400213344","PVdividends":"0.233052690804438"},{"node":"1","stepno":"4","underlying":"38.7157465552006","intrinsic":"11.2842534447994","price":"11.6010840012871","PVdividends":"0.233052690804438"},{"node":"2","stepno":"4","underlying":"49.7933890195201","intrinsic":"0.206610980479923","price":"5.012393116279","PVdividends":"0.233052690804438"},{"node":"3","stepno":"4","underlying":"64.0598457336867","intrinsic":"0","price":"1.42059801698672","PVdividends":"0.233052690804438"},{"node":"4","stepno":"4","underlying":"82.4330499450301","intrinsic":"0","price":"0.203778300197391","PVdividends":"0.233052690804438"},{"node":"0","stepno":"5","underlying":"26.5660883845229","intrinsic":"23.4339116154771","price":"23.4339116154771","PVdividends":"0.235394909286438"},{"node":"1","stepno":"5","underlying":"34.145651530078","intrinsic":"15.854348469922","price":"15.854348469922","PVdividends":"0.235394909286438"},{"node":"2","stepno":"5","underlying":"43.907070521226","intrinsic":"6.09292947877399","price":"7.71194085534807","PVdividends":"0.235394909286438"},{"node":"3","stepno":"5","underlying":"56.4784151872602","intrinsic":"0","price":"2.49744886302263","PVdividends":"0.235394909286438"},{"node":"4","stepno":"5","underlying":"72.6685517704295","intrinsic":"0","price":"0.405934688945269","PVdividends":"0.235394909286438"},{"node":"5","stepno":"5","underlying":"93.5191870481243","intrinsic":"0","price":"0.0120518374505379","PVdividends":"0.235394909286438"},{"node":"0","stepno":"6","underlying":"23.3195312573111","intrinsic":"26.6804687426889","price":"26.6804687426889","PVdividends":"0.117398477964423"},{"node":"1","stepno":"6","underlying":"29.9985057658256","intrinsic":"20.0014942341744","price":"20.0014942341744","PVdividends":"0.117398477964423"},{"node":"2","stepno":"6","underlying":"38.6000923423606","intrinsic":"11.3999076576394","price":"11.3999076576394","PVdividends":"0.117398477964423"},{"node":"3","stepno":"6","underlying":"49.6777348066801","intrinsic":"0.322265193319943","price":"4.2932664445935","PVdividends":"0.117398477964423"},{"node":"4","stepno":"6","underlying":"63.9441915208467","intrinsic":"0","price":"0.80787833729318","PVdividends":"0.117398477964423"},{"node":"5","stepno":"6","underlying":"82.3173957321901","intrinsic":"0","price":"0.0247438189220853","PVdividends":"0.117398477964423"},{"node":"6","stepno":"6","underlying":"105.979517291534","intrinsic":"0","price":"0","PVdividends":"0.117398477964423"},{"node":"0","stepno":"7","underlying":"20.5638798031067","intrinsic":"29.4361201968933","price":"29.4361201968933","PVdividends":"0.118578352283393"},{"node":"1","stepno":"7","underlying":"26.4492718275198","intrinsic":"23.5507281724802","price":"23.5507281724802","PVdividends":"0.118578352283393"},{"node":"2","stepno":"7","underlying":"34.028834973075","intrinsic":"15.971165026925","price":"15.971165026925","PVdividends":"0.118578352283393"},{"node":"3","stepno":"7","underlying":"43.790253964223","intrinsic":"6.20974603577704","price":"7.15586608261894","PVdividends":"0.118578352283393"},{"node":"4","stepno":"7","underlying":"56.3615986302572","intrinsic":"0","price":"1.60620535562963","PVdividends":"0.118578352283393"},{"node":"5","stepno":"7","underlying":"72.5517352134264","intrinsic":"0","price":"0.0508019277028683","PVdividends":"0.118578352283393"},{"node":"6","stepno":"7","underlying":"93.4023704911212","intrinsic":"0","price":"0","PVdividends":"0.118578352283393"},{"node":"7","stepno":"7","underlying":"120.255077338289","intrinsic":"0","price":"0","PVdividends":"0.118578352283393"},{"node":"0","stepno":"8","underlying":"18.1358014291689","intrinsic":"31.8641985708311","price":"31.8641985708311","PVdividends":"0.119770084536406"},{"node":"1","stepno":"8","underlying":"23.3219028638831","intrinsic":"26.6780971361169","price":"26.6780971361169","PVdividends":"0.119770084536406"},{"node":"2","stepno":"8","underlying":"30.0008773723976","intrinsic":"19.9991226276024","price":"19.9991226276024","PVdividends":"0.119770084536406"},{"node":"3","stepno":"8","underlying":"38.6024639489326","intrinsic":"11.3975360510674","price":"11.3975360510674","PVdividends":"0.119770084536406"},{"node":"4","stepno":"8","underlying":"49.680106413252","intrinsic":"0.319893586747959","price":"3.19001415482657","PVdividends":"0.119770084536406"},{"node":"5","stepno":"8","underlying":"63.9465631274187","intrinsic":"0","price":"0.104302244793099","PVdividends":"0.119770084536406"},{"node":"6","stepno":"8","underlying":"82.319767338762","intrinsic":"0","price":"0","PVdividends":"0.119770084536406"},{"node":"7","stepno":"8","underlying":"105.981888898106","intrinsic":"0","price":"0","PVdividends":"0.119770084536406"},{"node":"8","stepno":"8","underlying":"136.45539750601","intrinsic":"0","price":"0","PVdividends":"0.119770084536406"},{"node":"0","stepno":"9","underlying":"15.8754022869989","intrinsic":"34.1245977130011","price":"34.1245977130011","PVdividends":"0"},{"node":"1","stepno":"9","underlying":"20.4453014508233","intrinsic":"29.5546985491767","price":"29.5546985491767","PVdividends":"0"},{"node":"2","stepno":"9","underlying":"26.3306934752365","intrinsic":"23.6693065247635","price":"23.6693065247635","PVdividends":"0"},{"node":"3","stepno":"9","underlying":"33.9102566207916","intrinsic":"16.0897433792084","price":"16.0897433792084","PVdividends":"0"},{"node":"4","stepno":"9","underlying":"43.6716756119396","intrinsic":"6.32832438806043","price":"6.32832438806043","PVdividends":"0"},{"node":"5","stepno":"9","underlying":"56.2430202779738","intrinsic":"0","price":"0.214144595703311","PVdividends":"0"},{"node":"6","stepno":"9","underlying":"72.433156861143","intrinsic":"0","price":"0","PVdividends":"0"},{"node":"7","stepno":"9","underlying":"93.2837921388379","intrinsic":"0","price":"0","PVdividends":"0"},{"node":"8","stepno":"9","underlying":"120.136498986006","intrinsic":"0","price":"0","PVdividends":"0"},{"node":"9","stepno":"9","underlying":"154.71903594071","intrinsic":"0","price":"0","PVdividends":"0"},{"node":"0","stepno":"10","underlying":"13.9891185218845","intrinsic":"36.0108814781155","price":"36.0108814781155","PVdividends":"0"},{"node":"1","stepno":"10","underlying":"18.0160313446325","intrinsic":"31.9839686553675","price":"31.9839686553675","PVdividends":"0"},{"node":"2","stepno":"10","underlying":"23.2021327793467","intrinsic":"26.7978672206533","price":"26.7978672206533","PVdividends":"0"},{"node":"3","stepno":"10","underlying":"29.8811072878612","intrinsic":"20.1188927121388","price":"20.1188927121388","PVdividends":"0"},{"node":"4","stepno":"10","underlying":"38.4826938643962","intrinsic":"11.5173061356038","price":"11.5173061356038","PVdividends":"0"},{"node":"5","stepno":"10","underlying":"49.5603363287156","intrinsic":"0.439663671284364","price":"0.439663671284364","PVdividends":"0"},{"node":"6","stepno":"10","underlying":"63.8267930428823","intrinsic":"0","price":"0","PVdividends":"0"},{"node":"7","stepno":"10","underlying":"82.1999972542256","intrinsic":"0","price":"0","PVdividends":"0"},{"node":"8","stepno":"10","underlying":"105.862118813569","intrinsic":"0","price":"0","PVdividends":"0"},{"node":"9","stepno":"10","underlying":"136.335627421474","intrinsic":"0","price":"0","PVdividends":"0"},{"node":"10","stepno":"10","underlying":"175.581251468626","intrinsic":"0","price":"0","PVdividends":"0"}]}