%% Price European Put Options On Bonds Using the Black Model
% This example shows how to price European put options on bonds using the Black model. Consider a European put option on a bond maturing in 10 years. The underlying bond has a clean price of $122.82, a face value of $100, and pays 8% semiannual coupons. Also, assume that the annualized volatility of the forward bond yield is 20%. Furthermore, suppose the option expires in 2.25 years and has a strike price of $115, and that the annualized continuously compounded risk free zero (spot) curve is flat at 5%. For a hypothetical settlement date of March 15, 2004, the following code illustrates the use of Black's model to duplicate the put prices in Example 22.2 of the Hull reference. In particular, it illustrates how to convert a broker's yield volatility to a price volatility suitable for Black's model.

% Specify the option information.
Settle       =  '15-Mar-2004';
Expiry       =  '15-Jun-2006';  % 2.25 years from settlement
Strike       =  115;
YieldSigma   =  0.2;
Convention   =  [0; 1];

% Specify the interest-rate environment. Since the
% zero curve is flat, interpolation into the curve always returns
% 0.05. Thus, the following curve is not unique to the solution.
ZeroData     = [datenum('15-Jun-2004') 0.05   -1;
                datenum('15-Dec-2004') 0.05   -1;
                datenum(Expiry)        0.05   -1];

% Specify the bond information.
CleanPrice   =  122.82;
CouponRate   =  0.08;
Maturity     = '15-Mar-2014';  % 10 years from settlement
Face         =  100;
BondData     = [CleanPrice CouponRate datenum(Maturity) Face];
Period       =  2;  % semiannual coupons
Basis        =  1;  % 30/360 day-count basis

% Convert a broker's yield volatility quote to a price volatility 
% required by Black's model. To duplicate Example 22.2 in Hull, 
% first compute the periodic (semiannual) yield to maturity from 
% the clean bond price.
Yield  = bndyield(CleanPrice, CouponRate, Settle, Maturity,... 
Period, Basis);

% Compute the duration of the bond at option expiration. Most       
% fixed-income sensitivity analyses use the modified duration      
% statistic to examine the impact of small changes in periodic         
% yields on bond prices. However, Hull's example operates in        
% continuous time (annualized instantaneous volatilities and 
% continuously compounded zero yields for discounting coupons). 
% To duplicate Hull's results, use the second output of BNDDURY, 
% the Macaulay duration.
[Modified, Macaulay] = bnddury(Yield, CouponRate, Expiry,... 
Maturity, Period, Basis);

% Convert the yield-to-maturity from a periodic to a 
% continuous yield.
Yield  = Period .* log(1 + Yield./Period);

% Convert the yield volatility to a price volatility via 
% Hull's Equation 22.6 (page 514).
PriceSigma = Macaulay .* Yield .* YieldSigma;

% Finally, call Black's model. 
PutPrices  = bkput(Strike, ZeroData, PriceSigma, BondData,... 
Settle, Expiry, Period, Basis, [], [], Convention)

% When the strike price is the dirty price (Convention = 0), the call option value is $1.78. When the strike price is the clean price (Convention = 1), the call option value is $2.41.
% Copyright 2015 The MathWorks, Inc.