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

    %% Create a Basket Stock Structure for Three Stocks  

% Copyright 2015 The MathWorks, Inc.


%% 
% Find a basket option of three stocks. The stocks are currently trading
% at $56, $92 and $125 with annual volatilities of 20%, 12% and 15%, respectively.
% The basket option contains 25% of the first stock, 40% of the second stock,
% and 35% of the third. The first stock provides a continuous dividend of
% 1%, while the other two provide no dividends. The correlation between
% the first and second asset is 30%, between the second and third asset
% 11%, and between the first and third asset 16%. Use this data to create
% the |BasketStockSpec| structure: 
AssetPrice = [56;92;125];
Sigma = [0.20;0.12;0.15];

% Create the Correlation matrix. Correlation matrices are symmetric and
% have ones along the main diagonal.
NumInst  = 3;
Corr = zeros(NumInst,1);
Corr(1,2) = .30;
Corr(2,3) = .11;
Corr(1,3) = .16;
Corr = triu(Corr,1) + tril(Corr',-1) + diag(ones(NumInst,1), 0);

% Define dividends
DivType = cell(NumInst,1);
DivType{1}='continuous';
DivAmounts = cell(NumInst,1);
DivAmounts{1} = 0.01;

Quantity = [0.25; 0.40; 0.35];

BasketStockSpec = basketstockspec(Sigma, AssetPrice, Quantity, Corr, ...
'DividendType', DivType, 'DividendAmounts', DivAmounts)  

%% 
% Examine the |BasketStockSpec| structure. 
BasketStockSpec.Correlation