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.
In this examples, portfolio target sensitivities are treated as equality constraints during the optimization process. You can use hedgeopt
to specify what sensitivities you want, and hedgeopt
computes what what it will cost to get those sensitivities.
Compute the price and sensitivities
Delta = 8×1
-272.6462
-347.4315
-8.0781
-272.6462
-1.0445
294.9700
-47.1629
-282.0465
Gamma = 8×1
103 ×
1.0299
1.6227
0.6434
1.0299
0.0033
6.8526
8.4600
1.0597
Vega = 8×1
0.0000
-0.0397
34.0746
0.0000
0
93.6946
93.6946
0.0000
Price = 8×1
98.7159
97.5280
0.0486
98.7159
100.5529
6.2831
0.0486
3.6923
Extract the current portfolio holdings.
Holdings = 8×1
100
50
-50
80
8
30
40
10
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.
Summarize the portfolio information.
1.0e+03 *
0.0987 0.1000 -0.2726 1.0299 0.0000
0.0975 0.0500 -0.3474 1.6227 -0.0000
0.0000 -0.0500 -0.0081 0.6434 0.0341
0.0987 0.0800 -0.2726 1.0299 0.0000
0.1006 0.0080 -0.0010 0.0033 0
0.0063 0.0300 0.2950 6.8526 0.0937
0.0000 0.0400 -0.0472 8.4600 0.0937
0.0037 0.0100 -0.2820 1.0597 0.0000
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.
TargetSens = 1×3
105 ×
-0.6191 7.8895 0.0485
Maintaining Existing Allocations
To illustrate using hedgeopt
, suppose that you want to maintain your existing portfolio. 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 = 1×3
105 ×
-0.6191 7.8895 0.0485
Quantity = 1×8
100 50 -50 80 8 30 40 10
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 on this 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.
Specify the instruments to be fixed.
Use hedgeopt:
Sens = 1×3
104 ×
-2.3000 -0.3300 0.3000
Quantity = 1×8
100.0000 -141.0267 137.2638 80.0000 8.0000 -57.9606 40.0000 10.0000
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
are changed.
Fully Hedged Portfolio
The example has illustrated 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 0
s and call hedgeopt
again.
Sens = 1×3
10-10 ×
0.1091 0.5821 0.0045
Quantity = 1×8
100.0000 -182.3615 -19.5501 80.0000 8.0000 -32.9674 40.0000 10.0000
Examining the outputs reveals that you have obtained a fully hedged portfolio but at an expense of over $20,000 and Quantity
defines the positions required to acheive a fully hedged portfolio.
The resulting new portfolio value is