Unizen Product Documentation
Ask or search…

Price Impact Protection

  1. 1.
    What is price impact?
Price impact is the effect of making a trade on the market price. It depends on how big your trade is compared to the overall market activity. When you buy tokens, the total supply goes down, making the price of each additional token go up. To put it simply, if there's a high demand for tokens in a trade, the average price per token increases. This happens because the tokens have to be found from sources that are farther away from the current market price. The market price you see only represents the cost of the next available token.
  1. 2.
    AMM Price Impact and Pool Trading
AMM pools maintain a token ratio that determines the price curve along which trades are executed. When trading against a pool, one token is added while another token is simultaneously removed. For instance, if a trader exchanges 2 ETH for USDT in an ETH/USDT pool, they contribute 2 ETH to the pool and withdraw a corresponding amount of USDT based on the current market price.
The price movement in AMM pools is influenced by the token ratio. As the supply of the token being bought (i.e., USDT) decreases and the supply of the token being sold (i.e., ETH) increases, the price per token experiences greater fluctuations. This is because the pool's price curve design ensures that the token price scales with the available liquidity. However, pools with lower liquidity face higher price impact risks, as the prices increase exponentially with each additional token traded.
Unizen's trade aggregator automatically splits and reroutes trades to the most efficient liquidity sources, minimizing price impact. By utilizing Unizen's trade aggregator, you can benefit from auto-splitting trades across different pools, which helps in mitigating price impact risks and achieving optimal results.
Please note that the specific amounts and token names used in the above example are for illustrative purposes only.
  1. 3.
    How is price impact calculated in our system?
In our system, we determine price impact by evaluating the USD value of the input amount and the expected output amount. This calculation approach is consistently applied for both single-chain trades and cross-chain trades. The reason behind using the USD value as the basis for calculating price impact in our decentralized exchange (DEX) aggregator is to provide a standardized and easily comparable metric. Using USD as a reference point allows users to assess the impact of their trades in a familiar and stable currency, facilitating a more straightforward evaluation of the potential effects on their portfolio. This approach enhances transparency and simplifies the understanding of price dynamics, making it easier for users to make informed decisions in the diverse landscape of cryptocurrency trading.
In the context of cross-chain trades, employing USD as the benchmark for calculating price impact offers additional advantages. Cross-chain transactions involve assets from different blockchain networks, each with its native token and valuation. Using USD as the standard measurement ensures a consistent and universal metric, eliminating the complexities associated with comparing diverse native tokens directly.
Furthermore, USD is a widely accepted unit of value and is often used as a reference point in the financial world. By expressing price impact in USD, our DEX aggregator enables users to seamlessly comprehend and compare the impact of cross-chain trades across various blockchain ecosystems. This simplifies the decision-making process for traders, as they can assess the implications of their transactions in a familiar and stable currency, fostering a more intuitive understanding of the potential risks and benefits associated with cross-chain trading activities. In essence, utilizing USD as the common denominator enhances the user experience and contributes to the overall accessibility and user-friendliness of our cross-chain trading platform.
For instance, considering the data in the screenshot provided:
Let the input of the trade be represented as 100 ETH, equivalent to a USD value of $224,509.65.
The expected output of the trade is 224,183.2629 USDT, approximately equal to $224,242.41.
To calculate the price impact, we use the formula:
Price Impact=1−(ExpectedOutput/Input)
Substituting the values:
Price Impact=1−224,242.41/224,509.65
Price Impact≈0.00119032745
Expressed as a percentage, the price impact is approximately ~0.119%.
  1. 4.
    How to protect our users and our integrators?
To accommodate large trades, we have implemented a trade-splitting mechanism to ensure smooth execution.
In order to safeguard our users, we have implemented a warning system that prompts users to confirm their actions, ensuring their attention and preventing any unintended errors.
The Quote API provides integrators with price impact protection for their trades. To ensure the accuracy of the results, when we are able to calculate price impact estimates, the API filters out DEXs with invalid price impacts and only returns the list of DEXs with valid price impacts. The threshold can be easily customized by adjusting the priceImpactProtectionPercentage parameter, allowing Quote API integrators to tailor it according to their specific needs and tolerance.