%% Compute American Option Prices Using the Barone-Adesi and Whaley Option Pricing Model
% Consider an American call option with an exercise price of $120. The option expires on Jan 1, 2018. The stock has a volatility of 14% per annum, and the annualized continuously compounded risk-free rate is 4% per annum as of Jan 1, 2016. Using this data, calculate the price of the American call, assuming the price of the stock is $125 and pays a dividend of 2%.

StartDate  = 'Jan-1-2016';
EndDate = 'jan-1-2018';
Basis = 1;
Compounding = -1;
Rates = 0.04;

%
% Define the RateSpec.

RateSpec = intenvset('ValuationDate',StartDate,'StartDate',StartDate,'EndDate',EndDate, ...
'Rates',Rates,'Basis',Basis,'Compounding',Compounding)

%
% Define the StockSpec.

Dividend = 0.02;
AssetPrice = 125;
Volatility = 0.14;

StockSpec = stockspec(Volatility,AssetPrice,'Continuous',Dividend)

%
% Define the American option.

OptSpec = 'call';
Strike = 120;
Settle = 'Jan-1-2016';
Maturity = 'jan-1-2018';

%
% Compute the price for the American option.

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

%
% Copyright 2012 The MathWorks, Inc.