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

    %% Price Call and Put Stock Options Using the Standard Trinomial Tree Model  

% Copyright 2015 The MathWorks, Inc.


%% 
% Create a |RateSpec|. 
StartDates = 'Jan-1-2009'; 
EndDates = 'Jan-1-2013'; 
Rates = 0.035; 
Basis = 1; 
Compounding = -1;
RateSpec = intenvset('ValuationDate', StartDates, 'StartDates', StartDates,...
'EndDates', EndDates, 'Rates', Rates,'Compounding', Compounding, 'Basis', Basis)   
%% 
% Create a |StockSpec|. 
AssetPrice = 85; 
Sigma = 0.15; 
StockSpec = stockspec(Sigma, AssetPrice)  
%% 
% Create an |STTTree|. 
NumPeriods = 4;
TimeSpec = stttimespec(StartDates, EndDates, 4);
STTTree = stttree(StockSpec, RateSpec, TimeSpec)  
%% 
% Define the call and put options and compute the price. 
Settle = '1/1/09';
ExerciseDates = [datenum('1/1/11');datenum('1/1/12')];
OptSpec =  {'call';'put'};
Strike =[100;80];

Price = optstockbystt(STTTree, OptSpec, Strike, Settle, ExerciseDates)