%% Compute the Price of a Vanilla Option
% Define the RateSpec.

StartDates = 'Jan-1-2013';
EndDates = 'Jan-1-2015';
Rates = 0.05;
RateSpec = intenvset('ValuationDate', StartDates, 'StartDates', StartDates, ...
'EndDates', EndDates, 'Rates', Rates)

%
% Define the StockSpec for the asset.

AssetPrice = 100;
Sigma = 0.1;
StockSpec = stockspec(Sigma, AssetPrice)

%
% Define the vanilla option.

OptSpec = 'put';
Settle = 'Jan-1-2013';
ExerciseDates = 'Jan-1-2015';
Strike = 105;

%
% Compute the vanilla option price using the Longstaff-Schwartz model.

Antithetic = true;
Price = optstockbyls(RateSpec, StockSpec, OptSpec, Strike, Settle, ...
ExerciseDates, 'Antithetic', Antithetic)

% Copyright 2015 The MathWorks, Inc.