AlphaDex Explained in Images: Part 2

Kitten Finance
3 min readNov 16, 2020

The special design of AlphaDex ( https://www.alphadex.org/ ) is the comparison of [TWAP of round x+2] vs [TWAP of round x+1].

In this article, we will take a closer look at it, and show it is like predicting price movements in the next 2 rounds, and TWAP helps to prevent flash loan attacks.

Let the current time be 9:30 (end of round X), and the round period be 10 minutes.

Case 1: Bullish. Price increases in the next 2 rounds (9:30 to 9:50).

Case 2: Bullish. Price still increases in the next 2 rounds (9:30 to 9:50).

Case 3: Bearish. Price decreases in the next 2 rounds (9:30 to 9:50).

Case 4: Bearish. Price decreases in the next 2 rounds (9:30 to 9:50).

Case 5: Bearish. Price still decreases in the next 2 rounds (9:30 to 9:50).

Case 6: Bullish. Price increases in the next 2 rounds (9:30 to 9:50).

Therefore, in all of the most common 6 cases, [TWAP of round x+2] vs [TWAP of round x+1] is the same as predicting price movements in the next 2 rounds.

And in this example, it is the same as predicting price movements in the next 20 minutes (if one stakes at 9:29:xx).

Conclusion

One might have the false belief that comparing [TWAP of round x+2] with [TWAP of round x+1] is like comparing [price 20 minutes later] with [price 10 minutes later], which is then difficult to understand.

Here we showed comparing [TWAP of round x+2] with [TWAP of round x+1] is like comparing [price 20 minutes later] with [price now], and hence intuitive.

There are cases in which they don’t agree with each other, such as:

In the above case, the attacker uses flash loans to produce a significant price drop at 9:30, and hence [price at 9:50] is higher than [price at 9:30], even though the price is continuously decreasing from 9:31 to 9:50.

Shall we say BULLs win because [price at 9:50] is higher than [price at 9:30]? That is apparently not a desirable result.

In AlphaDex, TWAP is the time-weighted average price, which is less affected by sudden price movements, so [TWAP of round x+2] < [TWAP of round x+1], and we have the correct result: BEARs win.

Therefore, AlphaDex ( https://www.alphadex.org/ ) is not just a different design. It is actually a better design.

--

--