Giter Site home page Giter Site logo

awesome-amm's Introduction

Awesome AMM

List of AMM and Orderbook Resources

An overview of the prominent designs and large implementations

Automated Market Makers

History

A collection of the earliest posts regarding what came to be the automated market maker and it's many variations

A collection of popular iterations of various designs (listed below)

Designs

  • Constant Product

    Formula: (R_a - delta_a)(R_b + fees * delta_b) = k
    Simplified Formula: x * y = k

    Where R_α and R_β are reserves of each asset and γ is the transaction fee. Trading any amount of either asset must change the reserves in such a way that, when the fee is zero, the product R_αR_β remains equal to the constant k. This is often simplified in the form of xy=k, where x and y are the reserves of each asset. In practice, because Uniswap charges a 0.3% trading fee that is added to reserves, each trade actually increases k.

    Constant

  • Stableswap (Hybrid)

    Where x is the reserves for each asset, n is the number of assets, D is an invariant that represents the value in the reserve, and A is the “amplification coefficient”, which is a tunable constant that provides an effect similar to leverage and influences the range of asset prices that will be profitable for liquidity providers (i.e. the higher the asset volatility, the higher A should be).

    Function: An^n SUM(x_i) + D = ADn^n + D^(n+1) / n^n ∏ x_i

    This function acts as a constant sum when the portfolio is balanced and shifts towards a constant product as the portfolio becomes more imbalanced. In effect, the function looks like a “zoomed-in hyperbola”.

    Stableswap

  • Constant Mean

    A constant mean market maker is a generalization of a constant product market maker, allowing for more than two assets and weights outside of 50/50. First introduced by Balancer, constant mean markets satisfy the following equation in the absence of fees:

    Formula: k = ∏_n R^W_i

    where R is the reserves of each asset, W is the weights of each asset, and k is the constant. In other words, in the absence of fees, constant mean markets ensure that the weighted geometric mean of the reserves remains constant.

    Constant Mean

  • Concentrated Liquidity

    The defining idea of Uniswap v3 is concentrated liquidity: liquidity that is allocated within a custom price range. In earlier versions, liquidity was distributed uniformly along the price curve between 0 and infinity.

    The previously uniform distribution allowed trading across the entire price interval (0, ∞) without any loss of liquidity. However, in many pools, the majority of the liquidity was never used.

    Concentrated Liquidity relies on the concept of virtual liquidity which can be read and derived in their whitepaper

    Concentrated Liquidity

    Concentrated Liquidity Distribution

Source Constant Function Market Makers: DeFi’s “Zero to One” Innovation

  • Front-running Resistance

    AMMs use swap fees to earn profits for their liquidity providers. Liquidity providers are ultimately compensated via these fees. But if the pricing function significantly misprices the assets in the pool, as might happen after a sudden exogenous price crash, liquidity providers lose potential profit to arbitrageurs who purchase the mispriced assets.

    An AMM can thus maximize its profit in one of two ways: maximizing trading fees, or minimizing arbitrageur profits. Mooniswap seeks specifically to pursue the latter strategy: by introducing virtual balances, arbitrageurs are less able to profit on temporarily mispriced pools, leaving more profit for liquidity providers.

    In Mooniswap, when a swap takes place, the pool does not immediately offer a profitable trade in the opposite direction. Instead, it slowly improves the price over some period of time. The following chart shows how several trades would significantly increase the constant-product invariant from point X to point Q.

    Front-running Resistance

    After the above swap takes place, the virtual balance for the opposite swap will linearly move from point A to point X. At some point before this full transition takes place, arbitrageurs will attempt to exploit the smaller temporary arbitrage opportunities along the way. For example, when the virtual balance reaches point B, an arbitrageur may choose to arbitrage the price back to the true price at point C. Note that points A and C (and the origin) are located on the same line, which means they have the same price. The chart depicts three sequential arbitrage trades (BC, DE, ZQ) until the real balance reaches an equilibrium price at point Q.

Source Mooniswap Whitepaper

Virtual Automated Market Makers

A virtual automated market maker (vAMM) uses formulas, such as constant product, but only as a price discovery mechanism.

Generally a vAMM product is designed with a "clearing house" or "controller" contract in which all of the collateral deposited is held.

vAMMs are primmarily used for perpetual future contracts in which the collateral in the clearing house backs virtual assets that users can trade.

Following the release of Perpetual Protocol's first vAMM there have been many iterations since, particularly with the price discovery mechanism.

Resources

Products

Derivatives

Options AMMs

There have been various implementations for an AMM that can be used for buying and selling of options.

Orderbooks

AMMs and Orderbooks

Other

Assorted Reading

Awesome Lists

awesome-amm's People

Contributors

0xperp avatar k06a avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.