How time-weighted average price can reduce the market impact of large trades

Published at: Jan. 4, 2023

Time-weighted average price is an algorithmic trade execution strategy commonly used in traditional finance tools. The goal of the strategy is to produce an average execution price that is relatively close to the time-weighted average price (TWAP) for the period that the user specifies.

TWAP is mainly used to reduce a large order’s impact on the market by breaking it down into smaller orders and executing each one 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 the order books or liquidity in the liquidity pools. For example, order books have multiple buy and sell orders at different prices. When a large buy order is placed, the price of an asset rises because all of the cheapest buy orders are being executed.

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

50 buy orders at $1050 buy orders at $1150 buy orders at $13100 buy orders at $15500 buy orders at $17

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

However, since the total buy order isn’t enough to fill all the bids at $17, the price for Coin A will stop at that level. That’s a price increase of 70%, mostly seen with low liquidity coins. In most cases, the price increase would be less dramatic.

Even though most decentralized exchanges (DEXs) don’t have order books, they have automated market makers (AMMs) that adjust the price of a token based on order size and the size of the liquidity pool. Liquidity is sourced from liquidity providers (LPs) who contribute a certain amount of a token pair to the pool in return for a cut of the fees.

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

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

For example, the cheaper token in the pair can end up with less liquidity, leading to higher slippage (the difference between the expected price of a trade and the actual price it executes at). 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 reach demand, increasing an asset’s price. Ran Hammer, vice president 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 discrepancies. Both of these problems arise on DEXes when a trade is too large relative to the overall liquidity in the pool and has a disproportionate effect.” He continued to say:

“TWAP strategies can mitigate this problem by creating smaller orders and giving arbitrageurs a short window to close any price discrepancies and bring the reserves back to equilibrium.”

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

Deg3ntrades told Cointelegraph, “By design, dTWAP orders fragment trades into batches of smaller trades allowing the user to specify when these trades are executed at regular intervals over a pre-defined period of time. This results in the market being able to absorb and minimize the price impact of large orders across trading pairs suffering low liquidity.”

“Due to recent events in the market that are out of the control of the DeFi community, liquidity crunches are a prominent 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 exchanged and allowing the liquidity pools to be re-stocked between trading intervals.

How TWAP can automate the dollar-cost average process

The phrase dollar-cost averaging (DCA) refers to an investing strategy in which an investor makes fixed dollar-amount purchases of an asset or portfolio of assets (i.e., $100 every week). The DCA strategy is used when market volatility is high or a trader has a partial amount they want to invest at the time.

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

TWAP can be implemented by a trader to automatically dollar-cost average their orders. The strategy works by placing longer intervals between orders and a larger overall time period for the trades. For example, trades can be placed 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 enables decentralized trading platforms to spread out 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 who places the order on a DEX, and they’ll be able to configure the limit price, order intervals and order expiration.

The phrase “taker” refers to an independent party that oversees the orders submitted by users (makers) on the DEX. The taker aims to find the best way to execute the batch of orders and bid on those same orders when found. Takers receive a fee for bidding on orders and compete with other takers who may be bidding on the same orders.

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

dTWAP user experience

The decentralized time-weighted average price protocol has a portable user interface that can be integrated into DEXs. Trades using the protocol can be split 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 the user’s intervals. Regarding limit orders, once a user sets the limit price, trades will only execute if that price is available at the chosen intervals. The trade will not be placed if the limit price is unavailable. Due to this, an order might only have part of its trades executed if the desired limit prices aren’t reached.

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

Who benefits

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

Recent: Users need to go under the engine in Web3 — HashEx CEO

“TWAP has two basic uses that benefit traders. One is the ability to make large trades or trades in pairs that are long-tail and low-liquidity without disrupting the price. Second, it can be used to automate dollar-cost averaging strategies (where the trader purchases an asset or sets of assets on a specific schedule),” 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 making sure enough funds are available to complete all trades.”

Deg3ntrades stated, “The ability to utilize TWAP orders not only reduces traders' exposure to high slippage/price impact on large orders or when trading in low liquid pairs but also opens up and makes available a plethora of new trading strategies to more well-versed and advanced DeFi users, such as automated dollar cost averaging.”

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

Tags
Related Posts
What is opportunity cost? A definition and examples
Opportunity cost, explained Opportunity cost is a concept in economics that refers to the value of the next best alternative that is forgone when making a choice — i.e., the cost of the best alternative that is not chosen. Consider the scenario when you have a limited budget and are debating between buying a new laptop or going on vacation. The value of the vacation you could have taken with the same amount of money would be the opportunity cost if you decide to buy the laptop. Similarly, if you decide to take the vacation, the opportunity cost would be …
Decentralization / March 1, 2023
DeFi picks up the pace as alternate blockchains and NFTs boom
As September ended, the cryptocurrency markets recovered from the so-called “September curse” handsomely to hit a market capitalization of $2.32 trillion. The decentralized finance (DeFi) market has been an integral part of this growth. The total value locked (TVL) in DeFi protocols grew more than 20%, from $113.5 billion on Sept. 28 to hit $137 billion on Oct. 6, as per data from Dappradar. Even the Bank of America (BoA) — a global banking giant — has revealed its bullish outlook on DeFi and nonfungible tokens (NFTs). In an Oct. 4 report by BofA Securities — a subsidiary of BoA …
Decentralization / Oct. 9, 2021
First steps: Basic tips for getting started investing in DeFi
Decentralized finance (DeFi) protocols have diversified investment opportunities in the crypto industry by facilitating novel and innovative passive income generation schemes. Delving a bit into how they work, DeFi systems are based on blockchain technology and run on programmable chains such as the BNB Chain and the Ethereum Network. The chains use decentralized peer-to-peer (P2P) finance architectures to cut out the middleman and enable lending, borrowing and liquidity provision. This leads to higher interest rates compared to those provided by regulated financial institutions such as banks. For perspective, many regulated banks provide interest rates of less than one percent per …
Decentralization / April 14, 2022
Terra 2.0: A crypto project built on the ruins of $40 billion in investors' money
Terra remained the focus of the majority of headlines throughout May for its spiral collapse leading to a loss of over $40 billion in investors’ money. Despite some early resistance from the community and heavy backlash from the likes of Binance CEO Changpeng “CZ” Zhao, Terra co-founder Do Kwon managed to relaunch the collapsed network with a new chain called Terra 2.0 (Phoenix-1). The amended proposal for the relaunch of the network by increasing the genesis liquidity, which introduces a new liquidity profile for pre-attack Luna Classic (LUNC) holders and decreases the distribution to post-attack TerraUSD Classic (USTC) holders, was …
Decentralization / June 3, 2022
Blurring the line between crypto and TradFi could redefine global finance
Despite the current struggle in the global economy, the gap between traditional finance (TradFi) and crypto seems to be closing with each passing day. For example, earlier this month, Vienna-based fintech unicorn Bitpanda announced that it was adding commodities to its list of investment options, thus allowing investors to rake in profits from short-term price fluctuations related to traditional instruments such as oil, natural gas and wheat. In a recent interview with Cointelegraph, the company’s CEO, Eric Demuth, noted that the bear market had had no major impact on investor demand. He claims that more people are now looking for …
Decentralization / Sept. 21, 2022