www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/ComputethePriceandSensitivitiesofanAsianOptionUsingtheLoExample.m
%% Compute the Price and Sensitivities of an Asian Option Using the Longstaff-Schwartz Model % Copyright 2015 The MathWorks, Inc. %% % Define the |RateSpec|. Rates = 0.05; StartDate = 'Jan-1-2013'; EndDate = 'Jan-1-2014'; RateSpec = intenvset('ValuationDate', StartDate, 'StartDates', StartDate, ... 'EndDates', EndDate,'Compounding', -1, 'Rates', Rates) %% % Define the |StockSpec| for the asset. AssetPrice = 100; Sigma = 0.2; StockSpec = stockspec(Sigma, AssetPrice) %% % Define the Asian |'call'| option. Settle = 'Jan-1-2013'; ExerciseDates = 'Jan-1-2014'; Strike = 110; OptSpec = 'call'; %% % Compute the price for the European arithmetic average price and sensitivities % for the Asian option using the Longstaff-Schwartz model. NumTrials = 10000; NumPeriods = 100; AvgType = 'arithmetic'; Antithetic= true; OutSpec = {'Price', 'Delta', 'Gamma'}; PriceSens = asiansensbyls(RateSpec, StockSpec, OptSpec, Strike, Settle, ExerciseDates, ... 'NumTrials', NumTrials, 'NumPeriods', NumPeriods,'Antithetic', Antithetic, 'AvgType', ... AvgType,'OutSpec',OutSpec)