Rebalance & Liquidation Protection

After a delta-neutral position is initiated, Aperture's controller monitors the position and triggers an on-chain rebalance process, when appropriate, in order to:

  • Initiate or increase the long farm (two weeks after position open when short proceeds are unlocked, and later on when more UST and mAsset become available to be paired to increase the long farm staked LP);

  • Claim short & long farm rewards in the form of MIR / SPEC, and swap them for UST to reinvest;

  • If the position strays to a significant net long or net short position, move it back to the neutral state;

  • If the position's collateral ratio deviates significantly from the target (+/- 20 percentage point in the current setting), then manipulate funds to bring the position back to the target collateral ratio.

Delta neutrality

During the initial two-week period when long farm has not started, the position is truly delta-neutral in the sense that price movement of the mAsset in either direction does not affect the combined value of the short and long position at all. However, once long farm starts, the amount of mAsset (and UST) controlled by the Terraswap LP tokens will change as trades occur in the mAsset-UST pool which alter liquidity state for the pair; hence, the longed mAsset amount varies which makes the overall position a pseudo delta-neutral one.

To mitigate the risk of the position deviating significantly from the neutral state due to significant price movement of the mAsset, Aperture delta-neutral contract has a rebalance process that moves the position back to the neutral state in the most efficient way. The basic idea is to swap between the mAsset and UST such that the long amount of mAsset matches the short amount. The fact the position holds LP tokens makes calculating the amount to swap a challenge, as the swap itself will alter the state of the liquidity pool and therefore affect the amount of mAsset controlled by the LP tokens held by the position. The on-chain algorithm finds the best way to achieve the desired outcome while minimizing the amount of LP tokens that must be returned in order to maximize the subsequent long farm reward.

Collateral Ratio (Liquidation Protection & Delta-neutral Reinvest)

As the oracle price of the mAsset changes, so does the collateral ratio of a delta-neutral position.

If the price of the mAsset drops, then the collateral ratio increases; therefore we can afford to withdraw a portion of the aUST collateral, swap it for UST, and use the UST to reinvest, either:

  • Pair the UST with mAsset balance for more mAsset-UST LP tokens, and stake them in Spectrum for more reward; OR

  • Use the UST to increase the delta-neutral position overall, i.e. increase collateral to mint more mAsset while swapping the rest for mAsset, essentially repeating the position opening process, but this works to add to the existing position.

On the other hand, if the price of the mAsset increases, then the position's collateral ratio decreases and will be closer to the required threshold for the mAsset. If the collateral ratio drops below the threshold, the short position will be flagged for liquidation. To prevent this from happening, the rebalance process in this case will bring the collateral ratio back up to the target, by reducing the short position with the longed mAsset. Since most or all of the mAsset may be in the long farm, this process may require withdrawing liquidity from the long farm before being able to reduce the short position. Again, the contract's algorithm calculates the best way to achieve the goal of hitting the target collateral ratio while minimizing the reduction of the LP tokens staked in Spectrum.

Controller

The delta-neutral controller runs once every 5 minutes on an AWS EC2 instance that go through all positions and triggers the on-chain rebalance process if one of the following conditions is met:

  • The position's collateral ratio deviates from the target by more than the configured threshold (currently 20 percentage point; for example, if the target is 300%, this condition is met if the collateral ratio is below 280% or above 320%)

  • The position deviates from the neutral position by more than 3% (e.g. if short position is $100, then rebalance if long position is > $103 or long < $97)

  • The reinvestable UST amount is more than 3% of the position value, and there is currently no short proceeds pending unlock.

Last updated