Financial Derivatives Toolbox | ![]() ![]() |
Hedging with hedgeopt
To illustrate the hedging functions, consider the delta, gamma, and vega sensitivity measures. In the context of the Financial Derivatives Toolbox, delta is the price sensitivity measure of shifts in the forward yield curve, gamma is the delta sensitivity measure of shifts in the forward yield curve, and vega is the price sensitivity measure of shifts in the volatility process. Note that the delta, gamma, and vega sensitivities calculated by the toolbox are dollar sensitivities. (See Calculating Prices and Sensitivities (HJM) and Calculating Prices and Sensitivities (BDT) for details.)
To illustrate the hedging facility, consider the portfolio HJMInstSet
obtained from the example file deriv.mat
. The portfolio consists of eight instruments: two bonds, one bond option, one fixed rate note, one floating rate note, one cap, one floor, and one swap.
Both hedging functions require some common inputs, including the current portfolio holdings (allocations), and a matrix of instrument sensitivities. To create these inputs, load the example portfolio into memory
compute price and sensitivities
[Delta, Gamma, Vega, Price] = hjmsens(HJMTree, HJMInstSet); Warning: Not all cash flows are aligned with the tree. Result will be approximated.
and extract the current portfolio holdings.
For convenience place the delta, gamma, and vega sensitivity measures into a matrix of sensitivities.
Each row of the Sensitivities matrix is associated with a different instrument in the portfolio, and each column with a different sensitivity measure.
To summarize the portfolio information
disp([Price Holdings Sensitivities]) 98.72 100.00 -272.65 1029.90 0.00 97.53 50.00 -347.43 1622.69 -0.04 0.05 -50.00 -8.08 643.40 34.07 98.72 80.00 -272.65 1029.90 0.00 100.55 8.00 -1.04 3.31 0 6.28 30.00 294.97 6852.56 93.69 0.05 40.00 -47.16 8459.99 93.69 3.69 10.00 -282.05 1059.68 0.00
The first column above is the dollar unit price of each instrument, the second is the holdings of each instrument (the quantity held or the number of contracts), and the third, fourth, and fifth columns are the dollar delta, gamma, and vega sensitivities, respectively.
The current portfolio sensitivities are a weighted average of the instruments in the portfolio.
Maintaining Existing Allocations
To illustrate using hedgeopt
, suppose that you want to maintain your existing portfolio. The first form of hedgeopt
minimizes the cost of hedging a portfolio given a set of target sensitivities. If you want to maintain your existing portfolio composition and exposure, you should be able to do so without spending any money. To verify this, set the target sensitivities to the current sensitivities.
[Sens, Cost, Quantity] = hedgeopt(Sensitivities, Price,... Holdings, [], [], [], TargetSens) Sens = -61910.22 788946.21 4852.91 Cost = 0 Quantity' = 100.00 50.00 -50.00 80.00 8.00 30.00 40.00 10.00
Our portfolio composition and sensitivities are unchanged, and the cost associated with doing nothing is zero. The cost is defined as the change in portfolio value. This number cannot be less than zero because the rebalancing cost is defined as a nonnegative number.
If Value0
and Value1
represent the portfolio value before and after rebalancing, respectively, the zero cost can also be verified by comparing the portfolio values.
Partially Hedged Portfolio
Building upon the previous example, suppose you want to know the cost to achieve an overall portfolio dollar sensitivity of [-23000 -3300 3000]
, while allowing trading only in instruments 2, 3, and 6 (holding the positions of instruments 1, 4, 5, 7, and 8 fixed.) To find the cost, first set the target portfolio dollar sensitivity.
Then, specify the instruments to be fixed.
Finally, call hedgeopt
and again examine the results.
Sens = -23000.00 -3300.00 3000.00 Cost = 19174.02 Quantity' = 100.00 -141.03 137.26 80.00 8.00 -57.96 40.00 10.00
Recompute Value1
, the portfolio value after rebalancing.
As expected, the cost, $19174.02, is the difference between Value0
and Value1
, $23674.62 - $4500.60. Only the positions in instruments 2, 3, and 6 have been changed.
Fully Hedged Portfolio
The above example illustrates a partial hedge, but perhaps the most interesting case involves the cost associated with a fully-hedged portfolio (simultaneous delta, gamma, and vega neutrality). In this case, set the target sensitivity to a row vector of zeros and call hedgeopt
again.
TargetSens = [0 0 0]; [Sens, Cost, Quantity] = hedgeopt(Sensitivities, Price, ... Holdings, FixedInd, [], [], TargetSens);
Examining the outputs reveals that you have obtained a fully-hedged portfolio
but at an expense of over $20,000,
The positions needed to achieve a fully-hedged portfolio
result in the new portfolio value
Minimizing Portfolio Sensitivities
The above examples illustrate how to use hedgeopt
to determine the minimum cost of hedging a portfolio given a set of target sensitivities. In these examples, portfolio target sensitivities are treated as equality constraints during the optimization process. You tell hedgeopt
what sensitivities you want, and it tells you what it will cost to get those sensitivities.
A related problem involves minimizing portfolio sensitivities for a given set of maximum target costs. For this goal the target costs are treated as inequality constraints during the optimization process. You tell hedgeopt
the most you are willing spend to insulate your portfolio, and it tells you the smallest portfolio sensitivities you can get for your money.
To illustrate this use of hedgeopt
, compute the portfolio dollar sensitivities along the entire cost frontier. From the previous examples, you know that spending nothing simply replicates the existing portfolio, while spending $23,055.90 completely hedges the portfolio.
Assume, for example, you are willing to spend as much as $50,000, and want to see what portfolio sensitivities will result along the cost frontier. Assume the same instruments are held fixed, and that the cost frontier is evaluated from $0 to $50,000 at increments of $1000.
With this data, you can plot the required hedging cost versus the funds available (the amount you are willing to spend).
plot(MaxCost/1000, Cost/1000, 'red'), grid xlabel('Funds Available for Rebalancing ($1000''s)') ylabel('Actual Rebalancing Cost ($1000''s)') title ('Rebalancing Cost Profile')
Figure 3-1: Rebalancing Cost Profile
and the portfolio dollar sensitivities versus the funds available
figure plot(MaxCost/1000, Sens(:,1), '-red') hold('on') plot(MaxCost/1000, Sens(:,2), '-.black') plot(MaxCost/1000, Sens(:,3), '--blue') grid xlabel('Funds Available for Rebalancing ($1000''s)') ylabel('Delta, Gamma, and Vega Portfolio Dollar Sensitivities') title ('Portfolio Sensitivities Profile') legend('Delta', 'Gamma', 'Vega', 0)
Figure 3-2: Funds Available for Rebalancing
![]() | Hedging Portfolios | Self-Financing Hedges (hedgeslf) | ![]() |