www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/OptionPricesSensitLeisenReimExample.m
%% Compute Option Prices and Sensitivities Using a Leisen-Reimer Binomial Tree Model % This example shows how to compute option prices and sensitivities using a % Leisen-Reimer binomial tree model. Consider European call and put options % with an exercise price of $100 that expire on December 1, 2010. The % underlying stock is trading at $100 on June 1, 2010 and has a volatility % of 30% per annum. The annualized continuously compounded risk-free rate % is 7% per annum. Using this data, compute the price, delta and gamma of % the options using the Leisen-Reimer model with a tree of 25 time steps % and the |PP2| method. %% % Copyright 2015 The MathWorks, Inc. AssetPrice = 100; Strike = 100; ValuationDate = 'June-1-2010'; Maturity = 'December-1-2010'; % define StockSpec Sigma = 0.3; StockSpec = stockspec(Sigma, AssetPrice); % define RateSpec Rates = 0.07; 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 25 time steps LRTimeSpec = lrtimespec(ValuationDate, Maturity, 25); % use the PP2 method LRMethod = 'PP2'; TreeLR = lrtree(StockSpec, RateSpec, LRTimeSpec, Strike, 'method', LRMethod); % compute prices and sensitivities using the LR model: OptSpec = {'call'; 'put'}; OutSpec = {'Price', 'Delta', 'Gamma'}; [Price, Delta, Gamma] = optstocksensbylr(TreeLR, OptSpec, Strike, Settle, ... Maturity, 'OutSpec', OutSpec)