🧮Hedging Mechanics
Overview
In order to maintain the desired exposure level on an asset (e.g., 0 delta exposure on the market-neutral vault), a vault needs to rebalance its positions (i.e. hedge) periodically when its asset prices move. Every time a rebalance transaction occurs, a vault incurs 1) trading fees & price impact from swapping on a DEX; and 2) equity impact from realizing the impermanent loss (IL). These two expenses from rebalancing are the biggest costs when running AV.
The ultimate goal of rebalancing is to eliminate the delta exposure of Automated Vaults due to changes in asset prices (aka hedging). We have Intelligence Factors in the system to determine when and how to do the rebalance, which work to increase the aggregate long-term profitability.
How does Hedging operate?
Depending on the market condition, there is a specific optimal hedging strategy that will provide the highest potential returns for AVs. For example, if the market is volatile but the price is range bound, the optimal strategy would be to hold off any rebalancing tx, as one would otherwise be cementing the IL and paying for the tx costs unnecessarily as price oscillates in the range. On the other hand, if the market is trending in one direction, the best course of action would be to execute rebalance gradually over the price range as it moves. Waiting too late to execute would result in higher IL and loss in this case.
The current rebalancing system leverages many data points including historical prices and various economic factors to develop signals which can determine, with a high probability, which market regime we are currently in (trending or range bound; will there be a reversion). As the model gathers real-life operation data points, it also utilizes machine learning to improve its performance over time. Based on this information, the hedging algorithm would adjust its behavior (i.e., “operating mode”) based on what’s optimal at the time. We would also like to highlight that there is no separate code base for each mode, but rather the same code base with slightly different “formulas” for parameters, which would in turn change how each mode operates.
We also use probabilistic execution to help prevent a potential manipulator from reverse engineering the exact rules of execution. So to the outside observers, the transactions timing could look less deterministic. We know that many alpacas love the details, so let’s dive in a little more on how this works.
First, let’s us introduce the concept of Repurchasing Intensity Curve which defines the probability of a rebalance transaction being executed as a function of the vault’s delta exposure. The curves would look something like the figure below:
![](https://docs.alpacafinance.org/~gitbook/image?url=https%3A%2F%2Fmiro.medium.com%2Fmax%2F1400%2F1*jci6Kta4jRu63e4qXEtfvA.png&width=768&dpr=4&quality=100&sign=ba592b5f&sv=1)
You will notice that the shape of the curve is quite similar to our borrowing interest curve (if you replace the x-axis with utilization, and the y-axis with borrowing interest rate) and you would be right! At a conceptual level, they are trying to achieve similar outcomes.
At a low delta exposure (the vault is quite balanced), we are less interested in rebalancing happening, so we assign a low probability to it. In fact, below a certain delta exposure, we even assign a zero probability for rebalance to allow for the small price fluctuations, and make sure rebalancing does not happen.
As the delta exposure grows, the probability of a rebalancing happens also increase (this is analogous to the slope1 region of borrowing interest curve.)
Beyond a certain threshold, it becomes more critical that the rebalancing happens so the probability slope become more steep and approaches 1 to guaranteed the rebalancing happens (this is analogous to the slope3 region of our borrowing interest curve.)
Similar to how we can adjust the borrowing interest rate curves to achieve an optimal state for the lending vaults, here we can also adjust the coefficient / parameters of the Repurchasing Intensity Curve to make rebalancing more “relaxed” or “tight” to best suit the market conditions.
Using the method above, the model evaluates whether to execute a rebalancing transaction on a per block basis (every 3 seconds) using parameters like Probability.
In the following section, we delve into the various operating modes for rebalancing. You can stay updated on the current AV operating mode via the Telegram channel here.
Operating Mode 1: Normal Operations
In normal mode, the algorithm does not expect a price momentum in either direction.
In this state, price is allowed to move within the bound. Rebalancing is only triggered if it moves beyond the range.
Operating Mode 2: Hedging Closely
In this mode, the AVs will hedge very closely (i.e., execute rebalancing with slight price movement.)
This mode is activated for when price momentum is expected, but the direction of the movement is unknown. This means the rebalancing would happen in either direction of the price move.
By hedging closely, the vaults’ delta exposure is kept close to zero and will have no bias for upcoming price movements.
![](https://docs.alpacafinance.org/~gitbook/image?url=https%3A%2F%2Fmiro.medium.com%2Fmax%2F1400%2F1*ucHrgOY3QZ2jsM9nslDyuQ.png&width=768&dpr=4&quality=100&sign=e7e4a2b&sv=1)
Operating Mode 3: Hedging Trend
In this mode, the algorithm believes that there is a high probability of price trending in a particular direction.
It will hedge the price movement closely, similar to Mode2. However, the hedge will only be one way in expectation of price moving in that direction.
A move in the other direction would not be hedged, due to anticipation of reversion.
![](https://docs.alpacafinance.org/~gitbook/image?url=https%3A%2F%2Fmiro.medium.com%2Fmax%2F1400%2F1*dC73Mf-ER0LmI3ogBRpq9A.png&width=768&dpr=4&quality=100&sign=eab4aa79&sv=1)
Operating Mode 4: Guarded (Analogue to Alpaca Guard).
In this mode, a big price movement is happening/has happened, but a mean reversion is expected based on the hedging algorithm’s signals, and so rebalancing is held off.
In recent months, this mode has been activated several times, including when BNB price spiked to 400, and afterwards when BNB price sharply declined. All this can be simplified into: our algorithm had a high degree of confidence that price would mean revert and thus held off on rebalancing. Through this approach, the result was that the vault became very profitable after the price mean-reverted.
So, in this operating mode, it could appear that the AVs are not active in executing rebalancing, while in fact, the system held off the transaction by design.
With the goal of minimizing volatility, going forward, we will tweak the parameters so that rebalancing happens more gradually, so you can expect the Vault’s performance to be smoother in the future compared to the post-FTX timeframe.
![](https://docs.alpacafinance.org/~gitbook/image?url=https%3A%2F%2Fmiro.medium.com%2Fmax%2F1400%2F1*SQYzm0Zn2iamgKFxEnhGEQ.png&width=768&dpr=4&quality=100&sign=ca7828be&sv=1)
Safety Guardrails
AVv3 is modular in design and provides the vault manager with more freedom to operate. The role of the smart contract is to act as a container to facilitate the execution of strategies, and check that the managers’ actions fall within the acceptable risk parameters and guardrails. We list these guardrails below:
Net Exposure Tolerance:
Description: The smart contract would check the vault’s net exposure before vs. immediately after the manager’s action and not allow any hedging transaction that would make the net exposure of the vault worse off. For example, a market-neutral vault would want a 0 exposure on BNB. If the current exposure is slightly long BNB, then a manager would not be allowed to make a hedging transaction that would increase the BNB exposure.
Value: 0%
Note: this check does not apply to the “borrow more” transaction where the vault manager increases the leverage of the vault.
Swap Price Impact Tolerance:
Description: We will set a price impact tolerance on a swap (e.g., hedging, etc.) If a swap transaction has a price impact greater than the set percentage value, the transaction will be reverted.
Value: 1.0%
Max Leverage:
Description: We expect normal operation to run between 2–3x leverage. We will set a leverage limit for the vault, beyond which would not allow for the manager to borrow more assets. If the max leverage value is hit, we will execute a deleverage transaction where we will close 10% of the positions and use 10% of the asset value to repay debt. Please note that the 10% value was chosen to have a “gentle” effect on the vault, but can be performed multiple times if the market continues to move in an adverse direction.
Value: 6x
Equity Change Tolerance:
Description: The equity tolerance acts as a final safety check that the transaction performed by a manager is safe. It will check the % change in equity before vs. immediately after the transaction and will revert the transaction if the % loss is too high.
Value: 0.25%
Max Exposure:
Description: This guardrail monitors and adjusts each vault’s current exposure against the vault’s target exposure. For example, the target exposure for a BNB Savings Vault is 1xLong BNB. A target exposure for a BTCB Savings Vault is 1xLong BTCB, and a target exposure for a Market-Neutral Vault is 1xLong Stablecoin. So in a case where the 1xLong BNB vault goes beyond 4xLong BNB (+3x from target) or 2xShort BNB (-3x from target), it would hit the guardrail, and we will reduce 10% of the exposure.
Value: + / - 3x
Last updated