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

    %% Compute the Price and Sensitivities of a Spread Option Using the Kirk Model  

% Copyright 2015 The MathWorks, Inc.


%% 
% Define the spread option dates. 
 Settle = '01-Jun-2012';
 Maturity = '01-Sep-2012';  

%% 
% Define asset 1. 
% Price and volatility of RBOB gasoline
  Price1gallon = 2.85;          % $/gallon
  Price1 = Price1gallon * 42;   % $/barrel
  Vol1 = 0.29;  

%% 
% Define asset 2. 
 % Price and volatility of WTI crude oil
   Price2 = 93.20;         % $/barrel
   Vol2 = 0.36;  

%% 
% Define the correlation between the underlying asset prices of asset 1
% and asset 2. 
Corr = 0.42;  

%% 
% Define the spread option. 
OptSpec = 'call';
Strike = 20;  

%% 
% Define the |RateSpec|. 
rates = 0.05;
Compounding = -1;
Basis = 1;
RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, ...
'EndDates', Maturity, 'Rates', rates, ...
'Compounding', Compounding, 'Basis', Basis)  

%% 
% Define the |StockSpec| for the two assets. 
StockSpec1 = stockspec(Vol1, Price1)
StockSpec2 = stockspec(Vol2, Price2)  

%% 
% Compute the spread option price and sensitivities based on the Kirk model. 
OutSpec = {'Price', 'Delta', 'Gamma'};
[Price, Delta, Gamma] = spreadsensbykirk(RateSpec, StockSpec1, StockSpec2, Settle, ...
Maturity, OptSpec, Strike, Corr, 'OutSpec', OutSpec)