Repurchasing Mechanics


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 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 AVs.
Instead of swapping assets on a DEX, incurring price impact and the 0.25% swap fees, we have allowed a “repurchaser” to trade directly with the assets in our vaults without facing these fees. In exchange, a repurchaser will benefit from lower swap fees and no price impact on large swaps.
The ultimate goal of repurchasing and rebalancing are the same: to eliminate the delta exposure of Automated Vaults due to changes in asset prices (aka hedging). However, there are several aspects where repurchasing and rebalancing differ, which we discuss below:


  • Rebalancing: The rule for rebalancing was very simple and straightforward. If the debt ratio > threshold, a rebalance was triggered. The drawback of this method was that it was relatively inflexible and only backwards looking, unable to keep up with major market changes (like major liquidity shifts, as in the FTX collapse), and cannot adjust for them in advance.
  • Repurchasing: Compared to rebalancing, we added more Intelligence Factors into the system to determine when and how to do repurchasing, which work to increase the aggregate long-term profitability. We’ll discuss how that works in more detail in the next section.
Note: While there is more flexibility around the timing and price when executing repurchasing txs, we have a safeguard in the smart contracts such that a repurchase transaction must reduce the delta exposure of the vault, otherwise, the transaction will be reverted. This check helps ensure that the txs will only improve the state of the AVs.


  • Rebalancing: Higher cost because swaps happen on DEXs, incurring high swap fees (compared to on CEXs) and price impact for large vaults. It’s also susceptible to front-running and MEV bots.
  • Repurchasing: Lower cost as assets are repurchased at a fixed discount percentage regardless of the size of the transaction. To avoid front-running or manipulation, it also uses best practices such as probabilistic execution, which prevents a potential manipulator from reverse engineering the exact rules of execution.

How does Repurchasing 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 repurchasing / 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 repurchases 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 repurchasing 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 repurchasing transaction being executed as a function of the vault’s delta exposure. The curves would look something like the figure below:
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 repurchasing happening, so we assign a low probability to it. In fact, below a certain delta exposure, we even assign a zero probability for repurchase to allow for the small price fluctuations, and make sure repurchasing does not happen.
  • As the delta exposure grows, the probability of a repurchasing happens also increase (this is analogous to the slope1 region of borrowing interest curve.)
  • Beyond a certain threshold, it becomes more critical that the repurchasing happens so the probability slope become more steep and approaches 1 to guaranteed the repurchasing 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 repurchasing more “relaxed” or “tight” to best suit the market conditions.
Using the method above, the model evaluates whether to execute a repurchasing 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 repurchasing. 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. Repurchasing is only triggered if it moves beyond the range.
  • At a gross simplification level, we could say that this mode closely resembles the old rebalancing system.

Operating Mode 2: Hedging Closely

  • In this mode, the AVs will hedge very closely (i.e., execute repurchasing 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 repurchasing 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.
Illustrative transactions pattern in the Hedging Closely mode

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.
Illustrative hedging transactions in an expected price uptrend

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 repurchasing 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 repurchasing. 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 repurchasing, 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 repurchasing happens more gradually, so you can expect the Vault’s performance to be smoother in the future compared to the post-FTX timeframe.