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

    %% Create a Basket Stock Structure for Two Stocks  

% Copyright 2015 The MathWorks, Inc.


%% 
% Find a basket option of two stocks. The stocks are currently trading at
% $60 and $55 with volatilities of 30% per annum. The basket option contains
% 50% of each stock. The first stock provides a cash dividend of $0.25 on
% May 1, 2009 and September 1, 2009. The second stock provides a continuous
% dividend of 3%. The correlation between the assets is 40%. Use this data
% to create the structure |BasketStockSpec|: 
AssetPrice = [60;55];
Sigma = [0.30;0.30];

% Create the Correlation matrix. Correlation matrices are symmetric and
% have ones along the main diagonal.
Correlation = [1 0.40;0.40 1];

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

DivAmounts = cell(NumInst,1);
DivAmounts{1} = [0.25 0.25];
DivAmounts{2} = 0.03;

ExDates = cell(NumInst,1);
ExDates{1} = {'May-1-2009' 'Sept-1-2009'};

Quantity = [0.5; 0.50];

BasketStockSpec = basketstockspec(Sigma, AssetPrice, Quantity, Correlation, ...
'DividendType', DivType, 'DividendAmounts', DivAmounts, 'ExDividendDates',ExDates)  

%% 
% Examine the |BasketStockSpec| structure. 
BasketStockSpec.DividendType