www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/AmericanCallOptRollGeskeWhaleyExample.m

    %% Determine American Call Option Prices Using Roll-Geske-Whaley Option Pricing Model
% This example shows how to determine American call option prices using
% Roll-Geske-Whaley option pricing model. Consider an American call option
% with an exercise price of $22 that expires on February 1, 2009. The
% underlying stock is trading at $20 on June 1, 2008 and has a volatility
% of 20% per annum. The annualized continuously compounded risk-free rate
% is 6.77% per annum. The stock pays a single dividend of $2 on September
% 1, 2008. Using this data, compute price of the American call option using
% the Roll-Geske-Whaley option pricing model.
%%

% Copyright 2015 The MathWorks, Inc.

Settle = 'Jun-01-2008';
Maturity = 'Feb-01-2009';
AssetPrice = 20;
Strike = 22;
Sigma  = 0.2;
Rate = 0.0677; 
DivAmount = 2;
DivDate = 'Sep-01-2008';

% define the RateSpec and StockSpec
RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, 'EndDates',...
Maturity, 'Rates', Rate, 'Compounding', -1, 'Basis', 0);

StockSpec = stockspec(Sigma, AssetPrice, {'cash'}, DivAmount, DivDate);

Price  = optstockbyrgw(RateSpec, StockSpec, Settle, Maturity,Strike)