www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/PriceEuropeanCallableEmbeddedOptionforFloatingRateNoteExample.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 BK tree. VolDates = ['1-Jan-2013'; '1-Jan-2014'; '1-Jan-2015';'1-Jan-2016']; VolCurve = 0.01; AlphaDates = '01-01-2016'; AlphaCurve = 0.1; BKVolSpec = bkvolspec(RateSpec.ValuationDate, VolDates, VolCurve,... AlphaDates, AlphaCurve); BKTimeSpec = bktimespec(RateSpec.ValuationDate, VolDates, Compounding); BKT = bktree(BKVolSpec, RateSpec, BKTimeSpec) %% % The floater instrument has a spread of 15, a period of one year, and matures % and is callable on Jan-1-2015. Spread = 15; Settle = 'Jan-1-2012'; Maturity = 'Jan-1-2015'; Period = 1; OptSpec = {'call'}; Strike =101; ExerciseDates = 'Jan-1-2015'; %% % Compute the price of the floater with the embedded call. Price= optemfloatbybk(BKT, Spread, Settle, Maturity,... OptSpec, Strike, ExerciseDates)