A time-weighted automated market maker is a new type of DEX that lets traders place long-term orders that execute at time-weighted average prices. It works through fancy math, arbitrage opportunities, and shadowy super coding.
Two main basics make up the TWAMM; TWAP and AMM.
Time-weighted average price (TWAP) is a strategy used by traders that aims to track the price of an asset over a set time. A TWAP can better reflect the actual market price of an asset by averaging its price over time. It is a more sophisticated strategy often used in traditional financial markets to execute large orders.
On the other hand, an automated market maker (AMM) is a type of DeFi protocol that allows users to trade assets. This works by creating a pool of two or more assets and opening users to trade against these liquidity providers.
So, what exactly is a TWAMM?
Average Market Makers
Imagine, as you may have before, that you have $100M of an asset you’d like to trade using an AMM. Executing such a trade all at once would come at a significant cost due to the price impact resulting from the size of your trade in relation to the size of the pool. This is true for even the deepest liquidity pools in DeFi. There is not enough liquidity to support orders of this size. Trading $100M USDC for ETH on Uniswap (the deepest volatile pool in DeFi) would result in a ~19% price impact.
One solution is to break up an order into smaller chunks, reducing the price impact suffered relative to the size of each trade. While this seems like a decent solution, there are some associated problems.
First, manual division takes time that may not be immediately available to the trader. It also introduces an increased risk that results from manual work done by someone susceptible to making mistakes, as we all are.
On top of this, there is a trade-off between the negative price impact and transaction costs incurred: slippage decreases as the trade size decreases. Still, more transactions result in more transaction costs that may negate any slippage avoided.
It becomes a balancing act.
Time-Weighted Average Market Makers
As such, TWAMMs are algorithms designed to execute large, whale-sized orders in DeFi in an efficient and decentralized way. They allow users to specify how much they want to buy or sell over a given time frame.
Large orders in TradFi are dealt with using time-weighted average price (TWAP) orders. A broker will perform an algorithmic trade to achieve some average target price, dividing the order into thousands of small pieces over time. TWAMMs can automate this process using smart contracts. They contain an embedded constant function market maker, made available for anyone to trade against. Participants can submit ‘long-term orders’ to the TWAMM, specifying the amount they would like to buy or sell over a specified number of blocks.
Example: Charles wants to sell 300 ETH for USDC over the subsequent 3,000 blocks, or 0.1 ETH per block. Larry wants to sell 100 ETH for USDC over the following 2,000 blocks, or 0.05 ETH per block. Until Charles’ order expires in 2,000 blocks, Larry and Charles’ orders will be pooled together.
This ETH selling pool will sell ETH at a rate of 0.15 ETH per block for the next 2,000 blocks. Charles will get 0.1/0.15 ≈ 66% of the USDC the pool earns in this way. Charlie will get 0.05/0.15 ≈ 33% of the USDC the pool earns.
Final Thoughts
As DeFi and crypto become more mainstream and more significant investors enter the market, features like the TWAMM will become essential in facilitating a better trading experience for all users, further facilitating the adoption and usage of DEXs.
コメント