last posts

How the Time-Weighted Average Price Can Reduce the Market Impact of Large Transactions


Time-weighted average price is an algorithmic trade execution strategy commonly used in traditional financial tools. The objective of the strategy is to produce an average execution price relatively close to the time-weighted average price (TWAP) for the time period specified by the user.

TWAP is primarily used to reduce the impact of a large order on the market by breaking it down into smaller orders and executing each at regular intervals over a period of time.

How TWAP can reduce the price impact of a large order

Bids can influence the price of an asset in order books or the liquidity in liquidity pools. For example, order books contain multiple buy and sell orders at different prices. When a large buy order is placed, the price of an asset increases because all the cheaper buy orders are filled.

For example, coin A is currently priced at $10 and has the following:

  • 50 buy orders at $10
  • 50 buy orders at $11
  • 50 buy orders at $13
  • 100 buy orders at $15
  • 500 buy orders at $17

Trader A places an order to buy 300 Coin A tokens at a price of $17. Since the order amount is greater than the cheapest orders, the protocol will execute the price levels of $10, $11, $13, and $15 to fulfill the order.

However, since the total buy order is not enough to fill all bids at $17, the price of coin A will stop at this level. This is a 70% price increase, mostly seen with low liquidity coins. In most cases, the price increase would be less dramatic.

Even though most decentralized exchanges (DEXs) do not have order books, they do have automated market makers (AMMs) that adjust the price of a token based on the size of the order and the size of the liquidity pool. Liquidity comes from liquidity providers (LPs) who contribute a certain amount of a pair of tokens to the pool in exchange for a fee reduction.

Since liquidity in decentralized finance (DeFi) is more dispersed than in more established financial markets, the problem of a single transaction having outsized market influence may be greater. TWAP strategies can potentially solve the problem of price impact, for example, by executing trades at 4-5 minute intervals over an hour.

Breaking out the largest order can give the DEX time to resolve any price differences within the respective liquidity pools, helping bring the asset back to its spot price. The strategy can benefit DEXs as larger price impacts can affect token pairs in the liquidity pool.

For example, the cheaper token in the pair may end up with less liquidity, leading to higher slippage (the difference between the expected price of a trade and the actual price at which it executes). Increased liquidity can facilitate larger trading volumes for a DEX and provide a better experience for traders.

Recent: Web3 projects aim to create engagement between fans and sports leagues

Slippage usually occurs due to low liquidity that cannot meet demand, which increases the price of an asset. Ran Hammer, VP of Business Development at Orbs, a decentralized public Layer 1 blockchain, shared his thoughts on whether TWAP could improve slippage on DEXs.

Hammer told Cointelegraph, “TWAP, used properly, can definitely improve slippage and price spreads. Both of these issues arise on DEXs when a trade is too large relative to the overall liquidity of the pool and has a disproportionate effect. He continued to say:

“TWAP strategies can alleviate this problem by creating smaller orders and giving arbitrageurs a short window to close any price gaps and bring reserves back into balance.”

Deg3ntrades, part of the undoxxed development team of SpiritSwap – a decentralized exchange and DeFi platform on Fantom – also shared their thoughts, mentioning decentralized TWAP (dTWAP), the version of TWAP implemented on SpiritSwap.

Deg3ntrades told Cointelegraph, “By design, dTWAP orders break up trades into batches of smaller trades allowing the user to specify when those trades are executed at regular intervals over a predefined period of time. This allows the market to absorb and minimize the price impact of large orders on trading pairs suffering from low liquidity.

“Due to recent market events beyond the control of the DeFi community, liquidity shortages are a major issue right now, so Orbs integrating dTWAP with SpiritSwap couldn’t have come at a better time.”

Based on the comments above, smaller orders can improve liquidity by reducing the number of tokens traded and allowing liquidity pools to be replenished between trading intervals.

How TWAP can automate the average dollar cost process

The expression dollar cost average (DCA) refers to an investment strategy in which an investor makes purchases of a fixed dollar amount of an asset or portfolio of assets (i.e. i.e. $100 per week). The DCA strategy is used when market volatility is high or a trader has a partial amount they want to invest at that time.

For example, if the price of Coin B fluctuates every other day for a month, an investor can buy $250 worth of Coin B every week instead of trying to buy at the perfect time. This is because the cost will eventually reach an average price over time, despite the fluctuation in the price of the asset.

TWAP can be implemented by a merchant to automatically average the dollar cost of their orders. The strategy works by placing longer intervals between orders and a longer overall time frame for trades. For example, trades can be made at bi-weekly, weekly, or monthly intervals over a few months, a year, or indefinitely.

Decentralized Time Weighted Average Price

Decentralized Time Weighted Average Price is a version of TWAP developed by Orbs for DEXs and AMMs. The protocol allows decentralized trading platforms to spread trades over time and has already been implemented on the SpiritSwap DEX.

The dTWAP smart contract uses a “maker” and “taker” system. The maker is the user placing the order on a DEX, and they will be able to configure the limit price, order intervals, and order expiration.

The term “taker” refers to an independent party that oversees orders submitted by users (manufacturers) on the DEX. The taker aims to find the best way to execute the batch of orders and to bid on those same orders when they are found. Takers receive fees for bidding on orders and compete with other takers who can bid on the same orders.

Takers set fees, with the minimum amount being enough to cover transaction fees for trades. Validators in the Orbs network, known as “Guardians”, operate as takers in the protocol, automatically calculating and bidding on multiple orders for the manufacturer.

dTWAP User Experience

The decentralized time-weighted average price protocol has a portable user interface that can be integrated into DEXs. Transactions using the protocol can be divided into market orders (executed at current market prices) or limit orders (executed at a specific price or better).

When setting trades to execute at the current market price, the dTWAP smart contract will do so at user intervals. With respect to limit orders, once a user has set the limit price, trades will only be executed if that price is available at the chosen intervals. The trade will not be placed if the limit price is not available. For this reason, an order may only have a portion of its trades executed if the desired limit prices are not reached.

For example, a user sets a limit price of $50 or less for Coin C, with seven intervals over four weeks (28 transactions in total). In the second week, the price did not reach $50 for three days, so four trades were executed (out of seven for that week). Thus, in total, 25 of the 28 trades in the order were executed.

who benefits

TWAP can be beneficial for traders who want to buy low liquidity tokens or automate their trading process.

Recent: Users Need to Go Under Engine in Web3 – HashEx CEO

“TWAP has two basic uses that benefit merchants. One is the ability to make large trades or trades in long-tail, low-liquidity pairs without disturbing the price. Second, it can be used to automate dollar cost averaging strategies (where the trader buys an asset or sets of assets on a specific time frame),” Hammer said, continuing:

“TWAP can be used to construct such strategies in a way that does not require any additional action from the trader other than ensuring sufficient funds are available to complete all trades.”

Deg3ntrades said, “The ability to use TWAP orders not only reduces traders’ exposure to high slippage/price impact on large orders or when trading low liquidity pairs, but also opens and puts available a plethora of new trading strategies for more connoisseurs. and advanced DeFi users, such as automated dollar cost averaging.

Decentralized time-weighted average price strategies can improve the experience of traders and decentralized exchanges. Additionally, the increased liquidity, lower price impact, and automation of dTWAP trading could also increase engagement between users and DEXs.