%% Price a European Call Option On Bonds Using the Black Model
% This example shows how to price a European call option on bonds using the Black model. Consider a European call option on a bond maturing in 9.75 years. The underlying bond has a clean price of $935, a face value of $1000, and pays 10% semiannual coupons. Since the bond matures in 9.75 years, a $50 coupon will be paid in 3 months and again in 9 months. Also, assume that the annualized volatility of the forward bond price is 9%. Furthermore, suppose the option expires in 10 months and has a strike price of $1000, and that the annualized continuously compounded risk-free discount rates for maturities of 3, 9, and 10 months are 9%, 9.5%, and 10%, respectively.

% specify the option information
Settle       =  '15-Mar-2004';
Expiry       =  '15-Jan-2005'; % 10 months from settlement
Strike       =  1000;
Sigma        =  0.09;
Convention   =  [0 1]';

% specify the interest-rate environment
ZeroData     = [datenum('15-Jun-2004')  0.09   -1;  % 3 months
                datenum('15-Dec-2004')  0.095  -1;  % 9 months
                datenum(Expiry)         0.10   -1]; % 10 months
            
% specify the bond information           
CleanPrice   =  935;
CouponRate   =  0.1;
Maturity     = '15-Dec-2013';  % 9.75 years from settlement
Face         =  1000;
BondData     = [CleanPrice CouponRate datenum(Maturity) Face];
Period       =  2;
Basis        =  1;

% call Black's model
CallPrices = bkcall(Strike, ZeroData, Sigma, BondData, Settle,... 
Expiry, Period, Basis, [], [], Convention)

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