%% Price a Floor Using Normal Model for Negative Rates
% 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 .69394% continuously compounded and the volatility is 20%, use this data to compute the floor price. First, calculate the RateSpec, and then use floorbynormal to compute the FloorPrice.

ValuationDate = 'Jan-01-2008';
EndDates ='April-01-2010';
Rates = 0.0069394;
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.006;
FloorReset = 4;
Principal=100000;

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

% Copyright 2012 The MathWorks, Inc.