Logo

SQL Server BinomialDiscreteDividendsTree Function

Updated 2024-02-13 20:46:28.303000

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.

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,>)

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.

@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
PVDividendsfloatthe 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:

Tamt
0.0712330.11
0.3205480.11
0.5698630.12
0.8191780.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.

nodestepnounderlyingintrinsicpricePVdividends
005006.012745681427580.439663671284362
0144.00544108399735.994558916002748.538523152162190.333765472057695
1156.576785750031503.685860644034950.333765472057695
0238.81981373521511.18018626478511.78110745796860.337119870818801
1249.89745619953440.1025438004655615.567485439747020.337119870818801
2264.163912913701101.936708335707540.337119870818801
0334.250764602639515.749235397360515.74923539736050.340507981847923
1344.01218359378755.987816406212518.171636844813880.340507981847923
2356.583528259821703.15589895552410.340507981847923
3372.773664842990900.794420440772380.340507981847923
0430.114159978665619.885840021334419.88584002133440.233052690804438
1438.715746555200611.284253444799411.60108400128710.233052690804438
2449.79338901952010.2066109804799235.0123931162790.233052690804438
3464.059845733686701.420598016986720.233052690804438
4482.433049945030100.2037783001973910.233052690804438
0526.566088384522923.433911615477123.43391161547710.235394909286438
1534.14565153007815.85434846992215.8543484699220.235394909286438
2543.9070705212266.092929478773997.711940855348070.235394909286438
3556.478415187260202.497448863022630.235394909286438
4572.668551770429500.4059346889452690.235394909286438
5593.519187048124300.01205183745053790.235394909286438
0623.319531257311126.680468742688926.68046874268890.117398477964423
1629.998505765825620.001494234174420.00149423417440.117398477964423
2638.600092342360611.399907657639411.39990765763940.117398477964423
3649.67773480668010.3222651933199434.29326644459350.117398477964423
4663.944191520846700.807878337293180.117398477964423
5682.317395732190100.02474381892208530.117398477964423
66105.979517291534000.117398477964423
0720.563879803106729.436120196893329.43612019689330.118578352283393
1726.449271827519823.550728172480223.55072817248020.118578352283393
2734.02883497307515.97116502692515.9711650269250.118578352283393
3743.7902539642236.209746035777047.155866082618940.118578352283393
4756.361598630257201.606205355629630.118578352283393
5772.551735213426400.05080192770286830.118578352283393
6793.4023704911212000.118578352283393
77120.255077338289000.118578352283393
0818.135801429168931.864198570831131.86419857083110.119770084536406
1823.321902863883126.678097136116926.67809713611690.119770084536406
2830.000877372397619.999122627602419.99912262760240.119770084536406
3838.602463948932611.397536051067411.39753605106740.119770084536406
4849.6801064132520.3198935867479593.190014154826570.119770084536406
5863.946563127418700.1043022447930990.119770084536406
6882.319767338762000.119770084536406
78105.981888898106000.119770084536406
88136.45539750601000.119770084536406
0915.875402286998934.124597713001134.12459771300110
1920.445301450823329.554698549176729.55469854917670
2926.330693475236523.669306524763523.66930652476350
3933.910256620791616.089743379208416.08974337920840
4943.67167561193966.328324388060436.328324388060430
5956.243020277973800.2141445957033110
6972.433156861143000
7993.2837921388379000
89120.136498986006000
99154.71903594071000
01013.989118521884536.010881478115536.01088147811550
11018.016031344632531.983968655367531.98396865536750
21023.202132779346726.797867220653326.79786722065330
31029.881107287861220.118892712138820.11889271213880
41038.482693864396211.517306135603811.51730613560380
51049.56033632871560.4396636712843640.4396636712843640
61063.8267930428823000
71082.1999972542256000
810105.862118813569000
910136.335627421474000
1010175.581251468626000