%% Compute Option Prices on a Forward
% This example shows how to compute option prices on forwards using the Black pricing model. Consider two European options, a call and put on the Brent Blend forward contract that expires on January 1, 2015. The options expire on October 1, 2014 with an exercise price of $200 and $90 respectively. Assume that on January 1, 2014 the forward price is at $107, the annualized continuously compounded risk-free rate is 3% per annum and volatility is 28% per annum. Using this data, compute the price of the options.
% Define the RateSpec.

ValuationDate = 'Jan-1-2014';
EndDates = 'Jan-1-2015';
Rates = 0.03;
Compounding = -1;
Basis = 1;
RateSpec  = intenvset('ValuationDate', ValuationDate, ...
'StartDates', ValuationDate, 'EndDates', EndDates, 'Rates', Rates,....
'Compounding', Compounding, 'Basis', Basis')

%
% Define the StockSpec.

AssetPrice = 107;
Sigma = 0.28;
StockSpec  = stockspec(Sigma, AssetPrice);

%
% Define the options.

Settle = 'Jan-1-2014';
Maturity = 'Oct-1-2014';  %Options maturity
Strike = [200;90];
OptSpec = {'call'; 'put'};

%
% Price the forward call and put options.

ForwardMaturity = 'Jan-1-2015';  % Forward contract maturity
Price = optstockbyblk(RateSpec, StockSpec, Settle, Maturity, OptSpec, Strike,...
'ForwardMaturity', ForwardMaturity)

% Copyright 2015 The MathWorks, Inc.