# AMM Price Impact on Swaps

Automated market-making (AMM) algorithms are used on decentralized exchanges to calculate the price impact on an order. The algorithm provides liquidity and depth to open markets providing investors with the flexibility and ease of entering and exiting positions of almost any size.

Every trade on decentralized exchanges (DEX) has a degree of price impact, causing slippage to the market. On tokens that have significant exposure on dexes (in terms of overall market liquidity in comparison to CEXes), Midas will mirror these market conditions on our platform swap feature.

*D*oing so, will allow Midas to reduce swap fees on 95%+ of swap trades on pairs displayed below.The pairs with AMM price impact algorithms are displayed below:

- MIDAS

Should further pairings be included to AMM calculations in the future, they will be included to the above list.

At its core and in its simplified form, we utilise AMM calculations shown below:

$x * y = constant product formula (k)$

(2*sqrt(k)/k + 1) - 1

*where x and y represent the total sum of MIDAS across LPs and the total USD value of paired assets across LPs.*

The above formula allows us to consider liquidity across all available LPs to provide our users with the optimal swap conditions for their exchange and calculates for us the amount of x and y that will be held in an LP after the given trade has been made.

With the necessary information, we calculate in live time the impact a trade would make to the LP and use this data to correlate the price offered to our users based on the order value/size being processed.

$(2*sqrt(k)/k + 1) - 1,$

*where k is the percentage price difference.*

Finally, the fixed routing and spread fee are deducted from this price calculation to display live and accurate price impact calculations to users.

**Combined liquidity.**We consider liquidity across all LP's to provide advantageous conditions for investors wishing to trade. By combining this liquidity, users will experience less trade slippage in comparison to utilising dexes directly.**Easier to manage UI.**Our intuitive UI allows investors to shift assets quickly and hassle free in comparison to utilising dexes.**Lower fees.**Through utilisation of batch processing, we are able to process trades with fewer fees and pass this cost optimisation across to our investors resulting in less gas and slippage than by processing trades directly to dexes.

Resulting from these benefits, investors will optimise returns from trading and processing their investments via Midas.

Last modified 1yr ago