%% Build a Leisen-Reimer Stock Tree
% This example shows how to build Leisen-Reimer stock tree. Consider a European put option with an exercise price of $30 that expires on June 1, 2010. The underlying stock is trading at $30 on January 1, 2010 and has a volatility of 30% per annum. The annualized continuously compounded risk-free rate is 5% per annum. Using this data, create a Leisen-Reimer tree with 101 steps using the PP1 method.

AssetPrice = 30;
Strike = 30;

ValuationDate = 'Jan-1-2010';
Maturity = 'June-1-2010'; 

% define StockSpec
Sigma = 0.3;
StockSpec = stockspec(Sigma, AssetPrice);

% define RateSpec
Rates = 0.05;
Settle = ValuationDate;
Basis = 1;
Compounding = -1;

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

% build the Leisen-Reimer (LR) tree with 101 steps
LRTimeSpec = lrtimespec(ValuationDate, Maturity, 101); 

% use the PP1 method
LRMethod  = 'PP1';

LRTree = lrtree(StockSpec, RateSpec, LRTimeSpec, Strike, ...
'method', LRMethod)

% Copyright 2015 The MathWorks, Inc.