www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/PriceaCompoundOptionUsingtheStandardTrinomialTreeModelExample.m
%% Price a Compound Option 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 compound option and compute the price. USettle = '1/1/09'; UExerciseDates = '1/1/12'; UOptSpec = 'call'; UStrike = 95; UAmericanOpt = 1; CSettle = '1/1/09'; CExerciseDates = '1/1/11'; COptSpec = 'put'; CStrike = 5; CAmericanOpt = 1; Price= compoundbystt(STTTree, UOptSpec, UStrike, USettle, UExerciseDates,... UAmericanOpt, COptSpec, CStrike, CSettle,CExerciseDates, CAmericanOpt)