Swap with Iotabee : How does the price work? AMM explained

Swap with Iotabee : How does the price work? AMM explained

Disclaimer: this article is part of our DeFi Honeypot column. It aims at providing entry-level knowledge on Decentralized Finance (DeFi) topics for information only. It is not intended, and should not be understood or constructed as financial advice. All investment activities should be carried out with caution and at your own risk.

What’s up guys? Long time no see in our DeFi honeypot! Getting pumped for Shimmer release and maybe excited to swap some SMR and/or MIOTA?

A lot of you have been asking about how the token price on Iotabee SWAP works. Well in a simple word: AMM. We have actually talked about this in one of the previous articles here. Since that article is quite rich ( long) ????, we thought it might be nice to extract this particular subject here and walk you through.

Ready? Let’s go!!

Trading in CEX: Order Book & Market Maker

To explain AMM, we have to go all the way back to the good old fashion on how trading can happen in CEX (centralized exchange), yes, where it all started…

In CEX, order book is used to record the buyer and seller orders and execute the transaction when there is a match. When there is no match, traders will have to wait or shift price (sometimes drastically) until a match is found. This can be very inefficient in some circumstances, so here comes the play of Market Makers:

Market Makers create multiple bid-ask orders (price) so buyers and sellers do not need to wait for each other but rather trade with them directly. This way, everyone’s request is satisfied and the market stays active (good liquidity).

Now you get it: no liquidity ( possibility of buying and selling), no deal; Market makers are there to ensure good liquidity.

Trading in Defi: Market Maker still, but automated?

Liquidity is equally important for cryptocurrency because high liquidity means that a token can be traded easily with fair price. In DeFi, the role of a traditional market maker is replaced by Liquidity Providers, who provide assets, and the trade price is determined by a protocol named AMM (Automated Market Maker).

AMM uses a mathematical formula to price assets ( we’ll explain how the formula works later) and liquidity providers provide assets to ensure that there will be transactions. With AMM, no order book is needed to record orders. All transactions are done through trading with the Liquidity Pool.

Liquidity providers will add assets to the liquidity pool of a trading pair (or several), such as SMR/MIOTA, MIOTA/USDT, and so on. When adding liquidity, the liquidity providers must add both assets in equal value. Then the ratio of both tokens in the liquidity pool will determine the trading price.

Now you’ve got all the basic concepts, let’s dive deeper into how exactly the price is determined by AMM. Does it make sense at all?

There are different variants of formulas. In Iotabee, we use a simply but highly powerful formula: x*y = k . x is the amount of one token in the pool, and y is that of the other. The product of x and y is a constant k. This formula will then adjust the trading price automatically based on the ratio of the token amounts in the pool. What’s behind the formula is that, the more demand one token has ( more requests for buying = potentially fewer tokens left in the pool), the higher its price will be.

This mechanism is not only efficient, but also ensures that the price in the pool is always close to the fair market price. If not, Arbitrage traders will always come and make sure the price is adjusted by their buying and selling activities.

Now let’s give a concrete example and do some basic math for fun????

Say, a SMR/MIOTA pool currently has 10 MIOTA and 200 SMR ( k = 10*200 = 2 000). The trading price is 1 MIOTA = 20 SMR ( the ratio of token amounts). You think this is a very fair price for SMR, so you’d like to buy some SMR by swapping your MIOTA.

Now you decide to swap 1 MIOTA for some SMR. After your transaction, the future amount of MIOTA in the pool will be 11, as k is a constant, which remains 2 000, the new amount for SMR in the pool should be 2 000/11 = 181.8, meaning the SMR amount in the pool has decreased by (200–181.8) = 18.2, which is what you get as swap output ( what you’re taking from the pool). Your actual swap price is then 1 MIOTA = 18.2 SMR. Now the SMR price has increased ( impacted by the demand) .

This is an extreme example as the pool is very small, and that your trading amount has a significant impact on the token price ( you’re trading 10% amount of the pool). In reality, the larger the pool is, the smaller the price shift will be. That is also why we always look for enlarging the size of the pool to ensure a good trading experience for traders. As the liquidity providers earn yields through the trading fees, a better trading experience would eventually reflect on more transactions, thus potentially a better yield.

If we increase the size of the above pool to 1 000 MIOTA and 20 000 SMR (k=20 000 000) , at this moment, if you swap 1 MIOTA , the swap price will be 1 MIOTA = 19.98 SMR (applying the same calculation), which is much closer to what you see at the beginning of your swap transaction.

So what is in there for you?

You probably know already that the initial SMR price listed on Iotabee has been voted by our community, the result turns out to be 1 SMR = 0.06 MIOTA. Then based on different people’s perceptions ( underestimated or overestimated), as well as their transactions ( “buy” or “sell”), the AMM will adjust SMR price automatically to a suitable market price based on the demand/supply. You, as individual, may also have your own judgement, this may eventually lead to your final decisions in the initial hours/days of the Shimmer launch, “buy”, “sell” or “HODL”?

Another thing to bear in mind is that all the calculations above did not take into account the trading fee. The trading fee on Iotabee for SMR/MIOTA is currently 1% ( to compensate the liquidity providers on the potential high risk), and may be adjusted in the future when SMR price is more stable.

Now you get how the AMM works. AMM is convenient for traders, but may result in impermanent loss for liquidity providers. If you’re interested, read this article to understand more. We may also create a separate content for that if you push us to, so let us know!

Alright, we’ll see you next time in our DeFi honeypot!

Have a nice Shiiiiimmer Day! ????

Get real time updates directly on you device, subscribe now.

You might also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

×
Ava
IOTA AI
Hi! :-) Do you have any questions about IOTA?
 
AI-generated responses may be inaccurate. Not financial advice.