%% Compute American Call Option Prices and Sensitivities Using the Roll-Geske-Whaley Option Pricing Model
% This example shows how to compute American call option prices and sensitivities using the Roll-Geske-Whaley option pricing model. Consider an American stock option with an exercise price of $82 on January 1, 2008 that expires on May 1, 2008. Assume the underlying stock pays dividends of $4 on April 1, 2008. The stock is trading at $80 and has a volatility of 30% per annum. The risk-free rate is 6% per annum. Using this data, calculate the price and the value of delta and gamma of the American call using the Roll-Geske-Whaley option pricing model.

AssetPrice = 80;
Settle = 'Jan-01-2008';
Maturity = 'May-01-2008';
Strike = 82;
Rate = 0.06;
Sigma  = 0.3;
DivAmount = 4;
DivDate = 'Apr-01-2008';

% define the RateSpec and StockSpec
StockSpec = stockspec(Sigma, AssetPrice, {'cash'}, DivAmount, DivDate);

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

% define the OutSpec
OutSpec = {'Price', 'Delta', 'Gamma'};

[Price, Delta, Gamma]  = optstocksensbyrgw(RateSpec, StockSpec, Settle,...
Maturity, Strike,'OutSpec', OutSpec)

% Copyright 2015 The MathWorks, Inc.