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

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

% Copyright 2015 The MathWorks, Inc.


%% 
% Define the interest-rate term structure. 
Rates = [0.03;0.034;0.038;0.04];
ValuationDate = 'Jan-1-2012';
StartDates = ValuationDate;
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 HW tree using the following: 
VolDates = ['1-Jan-2013'; '1-Jan-2014'; '1-Jan-2015';'1-Jan-2016'];
VolCurve = 0.01;
AlphaDates = '01-01-2016';
AlphaCurve = 0.1;

HWVolSpec = hwvolspec(RateSpec.ValuationDate, VolDates, VolCurve,... 
            AlphaDates, AlphaCurve);
HWTimeSpec = hwtimespec(RateSpec.ValuationDate, VolDates, Compounding);
HWT = hwtree(HWVolSpec, RateSpec, HWTimeSpec)  

%% 
% Define the floater instruments with the embedded call option. 
Spread = 10;
Settle = 'Jan-1-2012';
Maturity =  {'Jan-1-2015';'Jan-1-2016'};
Period = 1;
OptSpec = {'call'};
Strike = 101;
ExerciseDates = 'Jan-1-2015';  

%% 
% Compute the price of the floaters with the embedded call. 
Price= optemfloatbyhw(HWT, Spread, Settle, Maturity, OptSpec, Strike,...
ExerciseDates)