%% Compute the American Option Prices With Continuous Dividend Yield Using the Bjerksund-Stensland 2002 Option Pricing Model
% This example shows how to compute the American option prices with continuous dividend yield using the Bjerksund-Stensland 2002 option pricing model. Consider two American stock options (a call and a put) with an exercise price of $100. The options expire on April 1, 2008. Assume the underlying stock pays a continuous dividend yield of 4% as of January 1, 2008. The stock has a volatility of 20% per annum and the annualized continuously compounded risk-free rate is 8% per annum. Using this data, calculate the price of the American call and put, assuming the following current prices of the stock: $90 (for the call) and $120 (for the put).

Settle = 'Jan-1-2008';
Maturity = 'April-1-2008';
Strike = 100;
AssetPrice = [90;120];
DivYield = 0.04;
Rate = 0.08;
Sigma = 0.20;

% define the RateSpec and StockSpec
StockSpec = stockspec(Sigma, AssetPrice, {'continuous'}, DivYield);

RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle,...
'EndDates', Maturity, 'Rates', Rate, 'Compounding', -1);

% define the option type
OptSpec = {'call'; 'put'};

Price = optstockbybjs(RateSpec, StockSpec, Settle, Maturity, OptSpec, Strike)

% The first element of the Price vector represents the price of the call ($0.84); the second element represents the price of the put option ($0.11).
% Copyright 2015 The MathWorks, Inc.