Stakenet DEX: AMM UI

Hydranet Team
Stakenet
Published in
5 min readMay 18, 2021

--

1. What is an automated market maker (AMM)?

Initially proposed by Vitalik Buterin in a Reddit post, market making is simply the process of creating volume on an exchange by placing both buy and sell orders at a given price and profiting from the spread. AMMs, short for automated market makers, simply automate this process. This refers to any type of market maker feature that is automated.

The term became especially known with Uniswap’s success — Uniswap & other similar Liquidity Providers (LPs) DEXs require AMMs because they algorithmically determine the price based on the balance of pooled liquidity.

Why do AMMs exist?

Bot trading/market making is a feature of many CEXs and DEXs because all exchanges require liquidity as a key feature to ensure they can serve their customers effectively. As a result, many exchanges incentivize this liquidity provision by providing users/market makers with the opportunity to profit from market-making.

For example, the centralized exchange Kucoin uses a very similar grid trading bot that you can fund as a holder — they simply call it a “bot”, but it’s effectively the same principle as the grid trading strategy employed by the AMM bot of the dex.

What are the differences between different AMMs?

The main difference between Uniswap’s AMM and an orderbook AMM (like Stakenet’s AMM UI) is that an orderbook AMM responds more effectively to slippage because you aren’t required to supply both sides of the exchange to earn money.

This allows for better management of slippage and better profit potential through estimation of market depth — because it’s actual orders being filled peer-to-peer, not an algorithmic estimate of price/volatility based on the liquidity balance of the pooled tokens. You can interpret that market depth and algorithmically place orders at key points in that market depth to maximize profit potential.

Both approaches have the same objective — ensuring liquidity is provided to support the market for the coin pair in question. The difference is that AMM bots for traditional orderbook exchanges allow you to have more insight into the market you’re providing liquidity to, which allows for better development of algorithmic market-making — and this diversity of market-making strategies allows for more resilience and higher profit potential.

2. Impermanent Loss (IL)

One more concept that is important to understand is the concept of Impermanent Loss. This term refers to the temporary (impermanent) loss of funds that a liquidity provider (LP) can experience due to market volatility. Most commonly, this refers to the fact that the sub-balance(s) of a liquidity provider (LP) may change.

Current AMMs of Layer 1 DEX’s utilize the XYK model - a mathematical equation that helps LPs calculate their risk of impermanent losses. It is also referred to as the “x * y = k” market maker.

The idea is that the smart contract holds x number of token A and y number of token B, and always maintains that x * y = some constant “k”. This ensures that changes in the number of tokens are what changes the price. The model also implements a price curve to ensure that the pool stays profitable. When someone wishes to buy or sell coins, they are simply shifting their position on the AMM equation.

This is called an “impermanent” loss because the price of the asset may decline back to its value when the LP first deposited funds. Impermanent loss only becomes permanent when the LP decides to withdraw his funds.

For Stakenet’s orderbook-based AMM it is similar. Traders who seek to provide liquidity to Stakenet orderbook-based DEX (and profit from price spreads) may experience IL as well, but as mentioned above there are a few differences:

  • LPs can use the AMM with one single asset.
  • It is possible to manage your risk/reward with a slider, adjusting the distance from the market price.
  • Managing each side of a pair separately.
  • Editing your position without withdrawing your funds from a smart contract.
  • Canceling/closing your AMM position without paying on-chain fees.

3. How will Stakenet’s AMM UI work?

In comparison to Uniswap, the Stakenet DEX has an orderbook, therefore our AMM UI is orderbook-based. It is an easy-to-use interface where users can run trading strategies with a simple UI and or the push of a button.

Users can simply put some funds into a trading algorithm and adjust the risk/reward with a slider. After clicking “Start” various limit orders (currently 10 limit orders, see for more info the GIF at the bottom) will be posted around the current market price, while the spread is depending on the chosen risk.

Increasing the risk will result in the orders being posted very close to the current market price and therefore likely to be filled fast. Now if the market spikes fast, the trader might have a short-term loss or short-term profit, depending on their previously filled order. Lower risk means the orders are further away from the current market price and thereby won’t be filled soon. As we have already implemented “Taker pays Maker” every limit order that gets filled will be paid between 45–67.5% of the 0.25% trading fees.

The AMM UI is the first version of Vortex, which will later also include arbitrage trading. It is also planned that users will be able to deploy their own trading strategies to the UI in later versions. That being said traders and bot programmers can already use the Stakenet DEX API to deploy their own trading strategies on bots.

4. Why is Stakenet building an AMM UI?

Up till now banking, trading, and investment firms have had a monopoly on arbitrage and market-making, with a very high barrier to entry being required.

Vortex will give the everyday users the tools and ability to compete and disrupt the entire finance industry. We see this as an important target as it effectively decentralizes the current multi-trillion dollar automated trading industry.

The UI is key, so every user can commit liquidity (similar to Uniswap) without needing technical knowledge or use a command line. Our AMM will work off-chain, which enables us to execute the“taker pays maker” fee model directly.

The resulting advantages for users are:

  • everyone can participate
  • more liquidity
  • more volume
  • instant and private transactions

With v1 of the AMM UI closed beta testers can already:

  • start & stop grid strategy
  • post orders
  • react to orders that get filled due to strategy
  • start with predefined risk (bigger risk means your orders will be closer to market price)
  • change pairs safely

This first version is currently being tested and debugged by closed beta testers in collaboration with our dev teams.

Join us on Discord and follow us on Twitter to stay up-to-date with our latest news and developments.

--

--