%% Compute Price and Sensitivities for Asian Option with Averaging Period Before the Settle Date
% Define the Asian option parameters.

AssetPrice = 100;
Strike = 95;
Rates = 0.1;
Sigma = 0.15;
Settle = 'Apr-1-2013';
Maturity = 'Oct-1-2013';

%
% Create a RateSpec using the intenvset function.

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

% Create a StockSpec for the underlying asset using the stockspec function.

DividendType = 'Continuous';
DividendAmounts = 0.05;

StockSpec = stockspec(Sigma, AssetPrice, DividendType, DividendAmounts);

% Calculate the price and sensitivities of the Asian option using the Turnbull-Wakeman approximation. Assume that the averaging period has started before the Settle date.

OptSpec = 'Call';
ExerciseDates = 'Oct-1-2013';
AvgDate = 'Jan-1-2013';
AvgPrice = 100;
OutSpec = {'Price','Delta','Gamma'};

[Price,Delta,Gamma] = asiansensbytw(RateSpec,StockSpec,OptSpec,Strike,Settle,ExerciseDates, ...
'AvgDate',AvgDate,'AvgPrice',AvgPrice,'OutSpec',OutSpec)

% Copyright 2012 The MathWorks, Inc.