%% Hedging Strategies Using Spread Options
% This example shows different hedging strategies to minimize exposure in the Energy market using Crack Spread Options.
%% Understanding Crack Spread Options
% In the petroleum industry, refiners are concerned about the difference between their input costs (crude oil) and output prices (refined products - gasoline, heating oil, diesel fuel, and so on). The differential between these two underlying commodities is referred to as a Crack Spread. It represents the profit margin between crude oil and the refined products.
% A Spread option is an option on the spread where the holder has the right, but not the obligation, to enter into a spot or forward spread contract. Crack Spread Options are often used to protect against declines in the crack spread or to monetize volatility or price expectations on the spread.
%% Example 1: Protecting Margins using a 1:1 Crack Spread Option
% A marketer is interested in protecting his gasoline margin since current prices are strong. A crack spread option strategy is used to maintain profits for the following season. In March the June WTI crude oil futures are at $91.10 per barrel and RBOB gasoline futures contract are at $2.72 per gallon. The marketer's strategy is a long crack call involving purchasing RBOB gasoline futures and selling crude oil futures.

OldFormat = get(0, 'format');  
format bank

% Price and volatility of RBOB gasoline
Price1gallon = 2.72;          % $/gallon
Price1 = Price1gallon * 42;   % $/barrel
Vol1 = 0.39;

% Price and volatility of WTI crude oil
Price2 = 91.10;         % $/barrel
Vol2 = 0.34;

% Assume the following data
% Spread Option
Strike = 20; 
OptSpec = 'call'; 
Settle =   '01-March-2013';
Maturity = '01-June-2013';
Corr = 0.45;     % Correlation of underlying commodities

%
% Define the RateSpec and StockSpec.

% Define RateSpec
Rate = 0.035;  
Compounding = -1;
Basis = 1;
RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, ...
    'EndDates', Maturity, 'Rates', Rate, 'Compounding', ...
    Compounding, 'Basis', Basis);

% Define StockSpec for the two assets
StockSpec1 = stockspec(Vol1, Price1);
StockSpec2 = stockspec(Vol2, Price2);

%
% Price the Crack Spread Option
% Use the function spreadbybjs in the Financial Instruments Toolbox™ to price the spread option using the Bjerksund and Stensland model.


Price = spreadbybjs(RateSpec, StockSpec1, StockSpec2, Settle, ...
                       Maturity, OptSpec, Strike, Corr)

%
% The 1:1 implied current crack spread between these two underlyings is $23.14 per barrel.

CrackSpread = Price1 - Price2    % $/barrel

%
% Suppose that by expiration day, June crude oil prices decrease to $90.34 per barrel and gasoline prices rise to $2.89 per gallon. The price changes cause the marketer's profit margin (the new implied crack spread) to increase from $23.14/barrel to $31.04/barrel:

NewCrackSpread = (2.89 * 42) - 90.34

%
% Since the marketer purchased a long crack call on the $20 call, the option is now in the money by $11.04.

(NewCrackSpread - Strike)

%
% The marketer paid $9.91 from the long crack call, this protects the margin by $1.13.

(NewCrackSpread - Strike - Price)

% This strategy provides the marketer protection during spread increase scenarios.
%
%% Example 2: Creating a Floor with Crack Spread Options
% A refiner is interested in covering its fixed and operating costs, but still profit from a favorable move in the market. In March the May WTI crude oil futures are at $99.43 per barrel and RBOB gasoline futures contract are at $3.04 per gallon. The refiner believes that the spread between those commodities of $28.25 per barrel is favorable. Of this, $11 corresponds to operating and fixed costs, and $17.25 is the net refining margin. The refiner's strategy is to sell the crack spread by selling 10 RBOB gasoline futures and buying 10 crude oil futures.

% Price and volatility of RBOB gasoline 
Price1gallon = 3.04;          % $/gallon
Price1 = Price1gallon * 42;   % $/barrel
Vol1 = 0.35;
Div1 = 0.0783;

% Price and volatility of WTI crude oil
Price2 = 99.43;         % $/barrel
Vol2 = 0.38;
Div2 = 0.0571;

% The refiner purchases 10 May RBOB gasoline crack spread puts with a strike price of $25.


% Spread Option
Strike = 25; 
OptSpec = 'put'; 
Settle =   '01-March-2013';
Maturity = '01-May-2013';
Corr = 0.30;      % Correlation of underlying commodities

%
% Define the RateSpec and StockSpec.

% Define RateSpec
Rate = 0.035;  
Compounding = -1;
Basis = 1;
RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, ...
    'EndDates', Maturity, 'Rates', Rate, 'Compounding', ...
    Compounding, 'Basis', Basis);

% Define StockSpec for the two assets
StockSpec1 = stockspec(Vol1, Price1, 'Continuous', Div1);
StockSpec2 = stockspec(Vol2, Price2, 'Continuous', Div2);

%
% Price the Crack Spread Option
% Use the function spreadbyfd in the Financial Instruments Toolbox™ to price the American spread option using the finite difference method.

                   
Price = spreadbyfd(RateSpec, StockSpec1, StockSpec2, Settle, ...
                   Maturity, OptSpec, Strike, Corr, 'AmericanOpt', 1)

%
% By expiration, if the option is exercised, the refiner would have hedged the cost of purchasing 10000 barrels of crude oil with the revenue of selling 10000 barrels of RBOB gasoline. The futures contract represents 1000 barrels of crude oil and 42000 gallons of gasoline.

CostOfHedge = Price * 10000   % Option premium

% The hedge cost is $66386 to implement and guarantee that neither a fall in RBOB gasoline prices or an increase in WTI crude oil prices will diminish the refining margin below $25.


ProfitMargin = 14 * 10000   %$     
CrackingMargin = ProfitMargin - CostOfHedge 

% This strategy allows a cracking margin of $73613.
%
% Another strategy for the refiner could be to buy the $22 puts at a price of $5.38.

StrikeNew = 22;

PriceNew = spreadbyfd(RateSpec, StockSpec1, StockSpec2, Settle, ...
                       Maturity, OptSpec, StrikeNew, Corr, 'AmericanOpt', 1)

% This time the hedge would have cost $53823, but it also guarantees a $11 per barrel or a $56176 cracking margin.


NewCostOfHedge = PriceNew * 10000   % Option premium

NewProfitMargin = 11 * 10000       
CrackingMargin = NewProfitMargin - NewCostOfHedge

%
%% Example 3: Using Collars to Reduce the Cost of Hedging
% A refiner is concerned about its cost of hedging and decides to use a collar strategy. In April the crack spread is trading at $4.23 per barrel. The refiner is not convinced to lock in this margin, but also wants to protect against price changes causing the refinery margin to decrease less than $4 per barrel.

% Price and volatility of heating oil
Price1gallon = 2.52;          % $/gallon
Price1 = Price1gallon * 42;   % $/barrel
Vol1 = 0.38;
Div1 = 0.0762;

% Price and volatility of WTI crude oil
Price2 = 101.61;         % $/barrel
Vol2 = 0.34;
Div2 = 0.1169;

% To accomplish the collar strategy the refiner sells a call spread option with a strike of $4.50 and uses the premium income to offset the cost of purchasing a put spread option with a strike of $4. This allows the refiner to benefit if market prices move up, and protects it if market prices move down.

% Assume the following data 
Strike = [4.50;4];
OptSpec = {'call';'put'}; 
Settle =   '01-April-2013';
Maturity = '01-June-2013';
Corr = 0.35;       % Correlation of underlying commodities

%
% Define the RateSpec and StockSpec.

% Define RateSpec
Rate = 0.035;  
Compounding = -1;
Basis = 1;
RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, ...
    'EndDates', Maturity, 'Rates', Rate, 'Compounding', ...
    Compounding, 'Basis', Basis);

% Define StockSpec for the two assets
StockSpec1 = stockspec(Vol1, Price1, 'Continuous', Div1);
StockSpec2 = stockspec(Vol2, Price2, 'Continuous', Div2);

%
% Price the Crack Spread Options
% Use the function spreadbybjs in the Financial Instruments Toolbox™ to price the spread options using the Bjerksund and Stensland model.


Price = spreadbybjs(RateSpec, StockSpec1, StockSpec2, Settle, ...
                       Maturity, OptSpec, Strike, Corr)

% The collar strategy allows the refiner to reduce the cost of the hedge to $0.63.

% CostOfHedge = Premium of Call - Premium of Put   
CostOfHedge = Price(1) - Price(2)

%
% The refiner is protected if the crack spread narrows to less than $4. If the crack spread widens to more than $4.50, the refiner will not benefit over this amount if he has hedged 100% of all its market exposure.

set(0, 'format', OldFormat);

% Copyright 2013 The MathWorks, Inc.