Logo

SQL Server ProportionalDividendsTree Function

Updated 2023-11-16 23:10:41.363000

Description

Use the table-valued function ProportionalDividendsTree to return the option value, intrinsic value, and underlying value for each node on a binomial tree for an American or European option paying proportional dividends.

Syntax

SELECT * FROM [westclintech].[wct].[ProportionalDividendsTree](
  <@CallPut, nvarchar(4000),>
 ,<@AmEur, nvarchar(4000),>
 ,<@AssetPrice, float,>
 ,<@StrikePrice, float,>
 ,<@TimeToMaturity, float,>
 ,<@RiskFreeRate, float,>
 ,<@Dividend_RangeQuery, nvarchar(max),>
 ,<@Volatility, 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.

@Dividend_RangeQuery

a string containing an SQL statement which, when executed, provides the function with the times and proportions 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.

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

@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

table

colNamecolDatatypecolDesc
nodeintThe node within the step
stepnointThe step number
underlyingintthe underlying value of the undelying asset at this step and node in the tree
intrinsicfloatthe intrinsic value of the option at this step and node in the tree
pricefloatthe theoretical value of the option 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.

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:

Tyield
0.0712330.0022
0.3205480.0022
0.5698630.0024
0.8191780.0024

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

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

This produces the following result.

nodestepnounderlyingintrinsicprice
0049.54158357259390.4584164274060786.04438371660606
0143.96216930064026.037830699359828.58694813530436
1156.221738912249703.70186894937291
0238.738671670037111.261328329962911.8554942693136
1249.890.1099999999999995.59172830308186
2263.802642111459501.94505940656737
0334.135819652036115.864180347963915.8641803479639
1343.96216930064026.037830699359848.20822081647817
2356.617135587159403.16867091414881
3372.405749433624100.798655758390852
0430.013693655178719.986306344821319.9863063448213
1438.65344659236311.34655340763711.6564664643264
2449.7802420.219758000000025.03149732651719
3464.110000841895801.42749081279149
4482.168894226766500.205524039232251
0526.447526193756623.552473806243423.5524738062434
1534.060720848801715.939279151198315.9392791511983
2543.86545252817886.134547471821237.73980596087292
3556.492577888867602.50844740521884
4572.7545522180500.408988049974795
5593.24849519911400.0125658784852865
0623.249151465527626.750848534472426.7508485344724
1629.941660790406220.058339209593820.0583392095938
2638.560678320541311.439321679458711.4393216794587
3649.66076941920.3392305807999994.31049941864966
4663.956136839875200.81305735807369
5682.366574004377100.0257992047364512
66105.82206245714200
0720.486733470109229.513266529890829.5132665298908
1726.384052130891523.615947869108523.6159478691085
2733.978975118764516.021024881235516.0210248812355
3743.76017544211116.239824557888877.18257747901773
4756.356995701934301.61460082884405
5772.579941292726600.0529687570839301
6793.472829991092600
77120.09104145618100
0818.052540493686831.947459506313231.9474595063132
1823.249151465527626.750848534472426.7508485344724
2829.941660790406220.058339209593820.0583392095938
3838.560678320541311.439321679458711.4393216794587
4849.66076941920.3392305808000063.20265686589266
5863.956136839875200.108750996617051
6882.36657400437700
78106.07664640852300
88136.28404042749600
0915.869395315104134.130604684895934.1306046848959
1920.43756530978129.56243469021929.562434690219
2926.320730405777423.679269594222623.6792695942226
3933.897425578479516.102574421520516.1025744215205
4943.65515102105016.344848978949926.34484897894992
5956.221738912249700.223278398744791
6972.405749433624100
7993.24849519911400
89120.09104145618100
99154.66049298956600
01013.983825286458136.016174713541936.0161747135419
11018.009214396501931.990785603498131.9907856034981
21023.193353502010326.806646497989726.8066464979897
31029.869800804509320.130199195490720.1301991954907
41038.46813269257211.53186730742811.531867307428
51049.54158357259390.4584164274060710.458416427406071
61063.802642111459500
71082.168894226766600
810105.82206245714200
910136.28404042749600
1010175.51481462351500