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

    %% Price European Callable Embedded Option for a Floating-Rate Note  

% Copyright 2015 The MathWorks, Inc.


%% 
% Define the interest-rate term structure. 
Rates = [0.03;0.035;0.040;0.045];
ValuationDate = 'Jan-1-2012';
StartDates = {'Jan-1-2012'; 'Jan-1-2013'; 'Jan-1-2014'; 'Jan-1-2015'};
EndDates = {'Jan-1-2013'; 'Jan-1-2014'; 'Jan-1-2015'; 'Jan-1-2016'};
Compounding = 1;  

%% 
% Create the |RateSpec|. 
RateSpec = intenvset('ValuationDate', ValuationDate, 'StartDates',...
StartDates, 'EndDates', EndDates,'Rates', Rates, 'Compounding', Compounding)  

%% 
% Build the HJM tree. 
VolSpec = hjmvolspec('Constant', 0.01);
TimeSpec = hjmtimespec(RateSpec.ValuationDate, EndDates, Compounding);
HJMTree = hjmtree(VolSpec, RateSpec, TimeSpec)  

%% 
% The floater instrument has a spread of 15, a period of one year, and matures
% and is callable on Jan-1-2016. 
Spread = 15;
Settle = 'Jan-1-2012';
Maturity =  'Jan-1-2016';
Period = 1;
OptSpec = {'call'};
Strike = 95;
ExerciseDates = 'Jan-1-2016';  

%% 
% Compute the price of the floater with the embedded call. 
Price = optemfloatbyhjm(HJMTree, Spread, Settle, Maturity,...
OptSpec, Strike, ExerciseDates)