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

    %% Calculate Prices and Sensitivities for Basket Options Using the Nengjiu Ju Approximation Model  

% Copyright 2015 The MathWorks, Inc.


%% 
% Find a European call basket option of five stocks. Assume that the basket
% contains: 
%  
% * 5% of the first stock trading at $110  
% * 15% of the second stock trading at $75   
% * 20% of the third stock trading at $40   
% * 25% of the fourth stock trading at $125  
% * 35% of the fifth stock trading at $92    
%
%  These stocks have annual volatilities of 20% and the correlation between
% the assets is zero. On May 1, 2009, an investor wants to buy a 1-year
% call option with a strike price of $90. The current annualized, continuously
% compounded interest is 5%. Use this data to compute price and delta of
% the call basket option with the Ju approximation model.  
Settle = 'May-1-2009';
Maturity  = 'May-1-2010';

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

% Define the Correlation matrix. Correlation matrices are symmetric, and
% have ones along the main diagonal.
NumInst  = 5;
InstIdx = ones(NumInst,1);
Corr = diag(ones(5,1), 0);

% Define BasketStockSpec
AssetPrice =  [110; 75; 40; 125; 92]; 
Volatility = 0.2;
Quantity = [0.05; 0.15; 0.2; 0.25; 0.35];
BasketStockSpec = basketstockspec(Volatility, AssetPrice, Quantity, Corr);

% Compute the price of the call basket option. Calculate also the delta 
% of the first stock.
OptSpec = {'call'};
Strike = 90;
OutSpec = {'Price','Delta'}; 
UndIdx = 1; % First element in the basket
[Price, Delta] = basketsensbyju(RateSpec, BasketStockSpec, OptSpec, Strike, Settle, ...
Maturity, 'OutSpec', OutSpec,'UndIdx', UndIdx)  

%% 
% Compute |Delta| with respect to the second asset: 
UndIdx = 2; % Second element in the basket
OutSpec = {'Delta'}; 
Delta = basketsensbyju(RateSpec, BasketStockSpec, OptSpec, Strike, Settle, Maturity, ...
'OutSpec',OutSpec,'UndIdx',UndIdx)