%% Compute Option Prices on Futures Using the Black Option Pricing Model
% This example shows how to compute option prices on futures using the Black option pricing model. Consider two European call options on a futures contract with exercise prices of $20 and $25 that expire on September 1, 2008. Assume that on May 1, 2008 the contract is trading at $20, and has a volatility of 35% per annum. The risk-free rate is 4% per annum. Using this data, calculate the price of the call futures options using the Black model.

Strike = [20; 25];
AssetPrice = 20;
Sigma = .35;
Rates = 0.04;
Settle = 'May-01-08';
Maturity = 'Sep-01-08';

% define the RateSpec and StockSpec
RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle,...
 'EndDates', Maturity, 'Rates', Rates, 'Compounding', -1);

StockSpec = stockspec(Sigma, AssetPrice);

% define the call options
OptSpec = {'call'};

Price = optstockbyblk(RateSpec, StockSpec, Settle, Maturity,...
OptSpec, Strike)

% Copyright 2015 The MathWorks, Inc.