Hedging with Constrained Portfolios
Overview
Both hedging functions cast the optimization as a constrained linear least-squares problem.
(See the function lsqlin
for details.) In particular, lsqlin
attempts to minimize the constrained linear least squares problem
where C, A, and Aeq are matrices, and d, b, beq, lb, and ub are vectors. For Financial Instruments Toolbox™ software, x is a vector of asset holdings (contracts).
Depending on the constraint and the number of assets in the portfolio, a solution to a particular problem may or may not exist. Furthermore, if a solution is found, it may not be unique. For a unique solution to exist, the least squares problem must be sufficiently and appropriately constrained.
Example: Fully Hedged Portfolio
Recall that hedgeopt
allows
you to allocate an optimal hedge by one of two goals:
Minimize the cost of hedging a portfolio given a set of target sensitivities.
Minimize portfolio sensitivities for a given set of maximum target costs.
As an example, reproduce the results for the fully hedged portfolio example.
TargetSens = [0 0 0]; FixedInd = [1 4 5 7 8]; [Sens,Cost,Quantity] = hedgeopt(Sensitivities, Price,... Holdings, FixedInd, [], [], TargetSens);
Sens = -0.00 -0.00 -0.00 Cost = 23055.90 Quantity' = 98.72 -182.36 -19.55 80.00 8.00 -32.97 40.00 10.00
This example finds a unique solution at a cost of just over
$23,000. The matrix C
(formed internally by hedgeopt
and passed to lsqlin
) is the asset Price
vector
expressed as a row vector.
C = Price' == [98.72 97.53 0.05 98.72 100.55 6.28 0.05 3.69]
The vector d
is the current portfolio value Value0
= 23674.62
. The example maintains, as closely as possible,
a constant portfolio value subject to the specified constraints.
Additional Constraints
In the absence of any additional constraints, the least squares objective involves a single equation with eight unknowns. This is an under-determined system of equations. Because such systems generally have an infinite number of solutions, you need to specify additional constraints to achieve a solution with practical significance.
The additional constraints can come from two sources:
User-specified equality constraints
Target sensitivity equality constraints imposed by
hedgeopt
The example in Fully Hedged Portfolio specifies five equality constraints
associated with holding assets 1, 4, 5, 7, and 8 fixed. This reduces
the number of unknowns from eight to three, which is still an under-determined
system. However, when combined with the first goal of hedgeopt
, the equality constraints associated
with the target sensitivities in TargetSens
produce
an additional system of three equations with three unknowns. This
additional system guarantees that the weighted average of the delta,
gamma, and vega of assets 2, 3, and 6, together with the remaining
assets held fixed, satisfy the overall portfolio target sensitivity
needs in TargetSens
.
Combining the least-squares objective equation with the three portfolio sensitivity equations provides an overall system of four equations with three unknown asset holdings. This is no longer an under-determined system, and the solution is as shown.
If the assets held fixed are reduced, for example, FixedInd
= [1 4 5 7]
, hedgeopt
returns
a no cost, fully hedged portfolio (Sens = [0 0 0]
and Cost
= 0
).
If you further reduce FixedInd
(for example, [1
4 5]
, [1 4]
, or even []
), hedgeopt
always returns a no cost, fully
hedged portfolio. In these cases, insufficient constraints result
in an under-determined system. Although hedgeopt
identifies
no cost, fully hedged portfolios, there is nothing unique about them.
These portfolios have little practical significance.
Constraints must be sufficient and appropriately defined. Additional constraints having no effect on the optimization are called dependent constraints. As a simple example, assume that parameter Z is constrained such that . Furthermore, assume that you somehow add another constraint that effectively restricts . The constraint now has no effect on the optimization.
Example: Minimize Portfolio Sensitivities
To illustrate using hedgeopt
to
minimize portfolio sensitivities for a given maximum target cost,
specify a target cost of $20,000 and determine the new portfolio sensitivities,
holdings, and cost of the rebalanced portfolio.
MaxCost = 20000; [Sens, Cost, Quantity] = hedgeopt(Sensitivities, Price,... Holdings, [1 4 5 7 8], [], MaxCost);
Sens = -4345.36 295.81 -6586.64 Cost = 20000.00 Quantity' = 100.00 -151.86 -253.47 80.00 8.00 -18.18 40.00 10.00
This example corresponds to the $20,000 point along the cost axis in the figures Rebalancing Cost Profile, Funds Available for Rebalancing, and Rebalancing Cost.
When minimizing sensitivities, the maximum target cost is treated
as an inequality constraint; in this case, MaxCost
is
the most you are willing to spend to hedge a portfolio. The least-squares
objective matrix C
is the matrix transpose of the
input asset sensitivities
C = Sensitivities'
a 3
-by-8
matrix in this
example, and d
is a 3
-by-1
column
vector of zeros,
[0 0 0]'
.
Without any additional constraints, the least-squares objective
results in an under-determined system of three equations with eight
unknowns. By holding assets 1, 4, 5, 7, and 8 fixed, you reduce the
number of unknowns from eight to three. Now, with a system of three
equations with three unknowns, hedgeopt
finds
the solution shown.
Example: Under-Determined System
Reducing the number of assets held fixed creates an under-determined system with meaningless solutions. For example, see what happens with only four assets constrained.
FixedInd = [1 4 5 7]; [Sens, Cost, Quantity] = hedgeopt(Sensitivities, Price,... Holdings, FixedInd, [], MaxCost);
Sens = -0.00 -0.00 -0.00 Cost = 20000.00 Quantity' = 100.00 -149.31 -14.91 80.00 8.00 -34.64 40.00 -32.60
You have spent $20,000 (all the funds available for rebalancing) to achieve a fully hedged portfolio.
With an increase in available funds to $50,000, you still spend all available funds to get another fully hedged portfolio.
MaxCost = 50000; [Sens, Cost, Quantity] = hedgeopt(Sensitivities, Price,... Holdings, FixedInd, [],MaxCost);
Sens = -0.00 0.00 0.00 Cost = 50000.00 Quantity' = 100.00 -473.78 -60.51 80.00 8.00 -18.20 40.00 385.60
All solutions to an under-determined system are meaningless.
You buy and sell various assets to obtain zero sensitivities, spending
all available funds every time. If you reduce the number of fixed
assets any further, this problem is insufficiently constrained, and
you find no solution (the outputs are all NaN
).
Note also that no solution exists whenever constraints are inconsistent.
Inconsistent constraints create an infeasible solution space; the outputs are all
NaN
.
Example: Portfolio Constraints with hedgeslf
The other hedging function, hedgeslf
,
attempts to minimize portfolio sensitivities such that the rebalanced
portfolio maintains a constant value (the rebalanced portfolio is
hedged against market moves and is closest to being self-financing).
If a self-financing hedge is not found, hedgeslf
tries
to rebalance a portfolio to minimize sensitivities.
From a least-squares systems approach, hedgeslf
first
attempts to minimize cost in the same way that hedgeopt
does. If it cannot solve this
problem (a no cost, self-financing hedge is not possible), hedgeslf
proceeds to minimize sensitivities
like hedgeopt
. Thus, the discussion
of constraints for hedgeopt
is
directly applicable to hedgeslf
as
well.
To illustrate this hedging facility using equity exotic options,
consider the portfolio CRRInstSet
obtained from
the example MAT-file deriv.mat
. The portfolio consists
of eight option instruments: two stock options, one barrier, one compound,
two lookback, and two Asian.
The hedging functions require inputs that include the current portfolio holdings (allocations) and a matrix of instrument sensitivities. To create these inputs, start by loading the example portfolio into memory
load deriv.mat;
Next, compute the prices and sensitivities of the instruments in this portfolio.
[Delta, Gamma, Vega, Price] = crrsens(CRRTree, CRRInstSet);
Extract the current portfolio holdings (the quantity held or the number of contracts).
Holdings = instget(CRRInstSet, 'FieldName', 'Quantity');
For convenience place the delta, gamma, and vega sensitivity measures into a matrix of sensitivities.
Sensitivities = [Delta Gamma Vega];
Each row of the Sensitivities
matrix is associated
with a different instrument in the portfolio and each column with
a different sensitivity measure.
disp([Price Holdings Sensitivities])
8.29 10.00 0.59 0.04 53.45 2.50 5.00 -0.31 0.03 67.00 12.13 1.00 0.69 0.03 67.00 3.32 3.00 -0.12 -0.01 -98.08 7.60 7.00 -0.40 -45926.32 88.18 11.78 9.00 -0.42 -112143.15 119.19 4.18 4.00 0.60 45926.32 49.21 3.42 6.00 0.82 112143.15 41.71
The first column contains the dollar unit price of each instrument, the second contains the holdings of each instrument, and the third, fourth, and fifth columns contain the delta, gamma, and vega dollar sensitivities, respectively.
Suppose that you want to obtain a delta, gamma, and vega neutral
portfolio using hedgeslf
.
[Sens, Value1, Quantity]= hedgeslf(Sensitivities, Price, ... Holdings)
Sens = 0.00 -0.00 0.00 Value1 = 313.93 Quantity = 10.00 7.64 -1.56 26.13 9.94 3.73 -0.75 8.11
hedgeslf
returns the
portfolio dollar sensitivities (Sens
), the value
of the rebalanced portfolio (Value1
) and the new
allocation for each instrument (Quantity
).
If Value0
and Value1
represent
the portfolio value before and after rebalancing, respectively, you
can verify the cost by comparing the portfolio values.
Value0= Holdings' * Price
Value0 = 313.93
In this example, the portfolio is fully hedged (simultaneous
delta, gamma, and vega neutrality) and self-financing (the values
of the portfolio before and after balancing (Value0
and Value1
)
are the same.
Suppose now that you want to place some upper and lower bounds on the individual instruments
in your portfolio. By using function portcons
, you can specify these constraints, along with various general linear
inequality constraints.
As an example, assume that, in addition to holding instrument 1 fixed as before, you want to bound the position of all instruments to within +/- 20 contracts (for each instrument, you cannot short or long more than 20 contracts). Applying these constraints disallows the current position in the fourth instrument (long 26.13). All other instruments are currently within the upper/lower bounds.
You can generate these constraints by first specifying the lower
and upper bounds vectors and then calling portcons
.
LowerBounds = [-20 -20 -20 -20 -20 -20 -20 -20];
UpperBounds = [20 20 20 20 20 20 20 20];
ConSet = portcons('AssetLims', LowerBounds, UpperBounds);
To impose these constraints, call hedgeslf
with ConSet
as
the last input.
[Sens, Cost, Quantity1] = hedgeslf(Sensitivities, Price, ... Holdings, 1, ConSet)
Sens = -0.00 0.00 0.00 Cost = 313.93 Quantity1 = 10.00 5.28 10.98 20.00 20.00 -6.99 -20.00 9.39
Observe that hedgeslf
enforces
the upper bound on the fourth instrument, and the portfolio continues
to be fully hedged and self-financing.
See Also
Related Examples
- Portfolio Creation Using Functions
- Adding Instruments to an Existing Portfolio Using Functions
- Instrument Constructors
- Creating Instruments or Properties
- Searching or Subsetting a Portfolio
- Pricing a Portfolio Using the Black-Derman-Toy Model
- Pricing and Hedging a Portfolio Using the Black-Karasinski Model
- Specifying Constraints with ConSet
- Portfolio Rebalancing