Financial Derivatives Toolbox | ![]() ![]() |
Setting Constraints
For the first example of setting constraints, return to the fully-hedged portfolio example that used hedgeopt
to determine the minimum cost of obtaining simultaneous delta, gamma, and vega neutrality (target sensitivities all zero). Recall that when hedgeopt
computes the cost of rebalancing a portfolio, the input target sensitivities you specify are treated as equality constraints during the optimization process. The situation is reproduced below for convenience.
TargetSens = [0 0 0]; [Sens, Cost, Quantity] = hedgeopt(Sensitivities, Price,... Holdings, FixedInd, [], [], TargetSens);
The outputs provide a fully-hedged portfolio
at an expense of over $23,000.
The positions needed to achieve this fully-hedged portfolio are
Suppose now that you want to place some upper and lower bounds on the individual instruments in your portfolio. You can specify these constraints, along with a variety of general linear inequality constraints, with the Financial Toolbox function portcons
.
As an example, assume that, in addition to holding instruments 1, 4, 5, 7, and 8 fixed as before, you want to bound the position of all instruments to within +/- 180 contracts (for each instrument, you cannot short or long more than 180 contracts). Applying these constraints disallows the current position in the second instrument (short 182.36). 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 = [-180 -180 -180 -180 -180 -180 -180 -180]; UpperBounds = [ 180 180 180 180 180 180 180 180]; ConSet = portcons('AssetLims', LowerBounds, UpperBounds);
To impose these constraints, call hedgeopt
with ConSet
as the last input.
[Sens, Cost, Quantity] = hedgeopt(Sensitivities, Price,...
Holdings, FixedInd, [], [], TargetSens, ConSet);
Examine the outputs and see that they are all set to NaN
, indicating that the problem, given the constraints, is not solvable. Intuitively, the results mean that you cannot obtain simultaneous delta, gamma, and vega neutrality with these constraints at any price.
To see how close you can get to portfolio neutrality with these constraints, call hedgeslf
.
[Sens, Value1, Quantity] = hedgeslf(Sensitivities, Price,... Holdings, FixedInd, ConSet); Sens = -352.43 21.99 -498.77 Value1 = 855.10 Quantity = 100.00 -180.00 -37.22 80.00 8.00 -31.86 40.00 10.00
hedgeslf
enforces the lower bound for the second instrument, but the sensitivity is far from neutral. The cost to obtain this portfolio is
![]() | Specifying Constraints with ConSet | Portfolio Rebalancing | ![]() |