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

    %% Price a Floor Using the Black Option Pricing Model
% This example shows how to price a floor using the Black option pricing
% model. Consider an investor who gets into a contract that floors the
% interest rate on a $100,000 loan at 6% quarterly compounded for 3
% months, starting on January 1, 2009.  Assuming that on January 1,
% 2008 the zero rate is 6.9394% continuously compounded and the volatility
% is 20%, use this data to compute the floor price.
%%

% Copyright 2015 The MathWorks, Inc.

ValuationDate = 'Jan-01-2008';  
EndDates ='April-01-2010';
Rates = 0.069394;
Compounding = -1; 
Basis = 1;

% calculate the RateSpec
RateSpec = intenvset('ValuationDate', ValuationDate, ...
'StartDates', ValuationDate,'EndDates', EndDates, ...
'Rates', Rates,'Compounding', Compounding,'Basis', Basis);

Settle = 'Jan-01-2009'; % floor starts in a year
Maturity = 'April-01-2009';
Volatility = 0.20;
FloorRate = 0.06;
FloorReset = 4;
Principal=100000;

FloorPrice = floorbyblk(RateSpec, FloorRate, Settle, Maturity, Volatility,...
'Reset',FloorReset,'ValuationDate',ValuationDate,'Principal', Principal,...
'Basis', Basis)