Proactive Market Making Algorithm: A Universal Liquidity Framework

Diane Dai
Diane Dai
Jan 8 · 10 min read
Image for post
Image for post

Markets contain huge amounts of data and information that represent buyers and sellers’ sentiment and valuation of assets. In essence, a market reacts dynamically to changes in available information and thus requires sophisticated mechanisms to do so. In a blockchain context, building such a complex platform, given the limited computing and storage resources, presents us with various unique challenges, the most daunting of which is the compression aspect.

Compression is the act of extracting the most important features of a thing while removing the less important bits. So what is a market’s “most important feature”? The answer is liquidity. Liquidity can be graphically represented by a market depth chart, pictured below.

Image for post
Image for post

The depth chart consists of two roughly triangular (though not necessarily symmetrical) shapes, representing bids (buy orders) and asks (sell orders) respectively, along the price x-axis and the depth y-axis. The two triangles can be mathematically described by two parameters, mid price and slope, or how “steep” the triangle is.

Let us closely examine the depth triangle on the right hand side first. This is the ask side, where ask (sell) prices are quoted. We can see that the more base tokens are sold, the higher the price. Thus, this linear relationship can be captured by the following formula:

Image for post
Image for post

where i is Parameter 1, the mid price, and k is Parameter 2, the slope. B is the number of base tokens currently in the inventory and B_0 is the initial number of base tokens in the inventory. (B_0-B)/B_0 is the portion of base tokens that have been removed from the ask side due to transactions, relative to the initial base token balance. This formula stipulates that as the number of base tokens that have been traded increases, the base token price rises linearly.

But is this an accurate representation of market reality? Not exactly, because this linear model has two limitations:

  1. In practice, most liquidity is concentrated near (immediately above or below) the mid price, because that is the most capital-efficient strategy for market makers. The linear model does not reflect this uneven distribution and is thus an oversimplification
  2. The linear model returns a liquidity of zero after the price exceeds or goes below a certain threshold. However, in reality, no matter how favourable the quoted price is (e.g. for ETH/USDC, a bid order at $100 and an ask order at $1,500), there is liquidity present at that price. This model fails to take such scenarios into account

Therefore, we need to make this pricing curve/depth chart nonlinear to align it with market patterns, but we also don’t want to introduce additional parameters. How should we go about doing that?

Image for post
Image for post

We want to make the depth chart nonlinear to depict the fact that depth is more concentrated in the vicinity of the mid price.

Mathematically, the most obvious and straightforward solution is to change the addition in the aforementioned linear formula to multiplication, like this:

Image for post
Image for post

In this formula, P increases as B decreases, and it also doesn’t have an upper or lower bound (technically it has a lower limit of 0, but a subzero price doesn’t make sense anyway). But what about the slope? The solution is to refactor the B_0/B term and add a new parameter k that we can use to control the magnitude of the change in price due to B.

Image for post
Image for post

When B_0/B >= 1, P is directly proportional to B_0/B in the previous formula, but in this new formula, k dictates the extent of which P is affected by B_0/B. More specifically, k is in the range [0, 1] and governs the slope of the pricing curve.

  • When k = 0, the formula becomes P = i, so the price does not change regardless of other parameters
  • When k = 1, the formula reverts back to (2)
  • When k is in (0, 1), as k increases, so does the price elasticity, meaning that the price becomes more sensitive to change in base token quantity (i.e. B). Conversely, as k decreases, the price elasticity also decreases

This model seems sufficiently complete to cover all scenarios, but there is another issue. In a transaction, the total amount of tokens that needs to be paid is the area under the pricing curve, so we will have to take the integral of the curve, but the curve formula above makes this calculation cumbersome as B_0/B introduces a logarithmic term during derivation. To make computation easier, we square the B_0/B term to eliminate all instances of log:

Image for post
Image for post

Incredibly, when k = 1, this curve is identical to the AMM bonding curve. This reaffirms our belief that this algorithm has captured the essence of market activities and patterns. If traditional AMM pricing method is Newtonian classical mechanics, then PMM is akin to Einstein’s theory of general relativity.

Similarly, without the loss of generality, we apply the same derivation procedure for the bid side depth chart, substituting base tokens with quote tokens (denoted by Q) and using division instead of multiplication. We get:

Image for post
Image for post

Combining both formulae, we get the proactive market maker (PMM) pricing formula, described in mathematical terms below.

Image for post
Image for post

The PMM algorithm is a “high-fidelity” abstraction of the orderbook-based market, defined and regulated by a handful of simple parameters, but it is also highly flexible and optimized for on-chain operations.

We will then enumerate several promising use cases for PMM that can be achieved by fine-tuning parameters and instituting different withdrawal/deposit rules.

Use Case 1 — Proactive market making with external price guidance

“Capital-efficient, low-IL market making”

For mainstream assets, such as BTC and ETH, external markets have much higher volumes and are thus a price source for other platforms to retrieve market prices from. PMM is capable of proactively adjusting these fetched mid prices to minimize impermanent loss (IL) and achieve higher capital efficiency than AMM platforms. This mechanic also means unlocking single-token liquidity provision — market makers are not forced to deposit tokens Uniswap-style.

The configurations required for this use case are

  • Mid price i is set to the price retrieved from external sources
  • Parameter k is set to below 1
  • Giving everyone the single-token liquidity provision option

We call this use case DODO Classic Pool, as this was first pioneered in DODO v1.0 in August 2020.

Use Case 2 — Low barrier-to-entry automated market making

“You can issue assets even if you don’t have a lot of money!”

This use case mainly applies to long-tail asset markets (i.e. predominantly newly issued assets with little sell-side liquidity on AMM platforms). PMM can help these assets with the initial liquidity they desperately require for their long-term growth and sustainability. In other words, asset issuers do not need large amounts of capital on standby to pair up with their assets when initializing liquidity pools. For instance, if a team wants to issue their token X on PMM, they have the option to initialize liquidity with 100% X and 0% stables or ETH. This drastically reduces the barrier-to-entry for smaller projects.

In this use case, PMM gives the pricing power to takers entirely — makers have no control over the price discovery mechanic whatsoever.

The configurations required for this use case are

  • Mid price i is set to the initial offering price designated by the asset issuers
  • Parameter k can be set to any arbitrary number in [0, 1]
  • The first liquidity deposit can be made in arbitrary proportion, and it does not change the price
  • All subsequent liquidity deposits and withdrawals must be made in proportion to the current pool ratio (i.e. similar to Uniswap liquidity pools)

We call this use case the DODO Vending Machine.

Use Case 3 — Fully customizable and free market making

“Anyone can be a market maker!”

This use case is intended for the experienced and ambitious market makers (both institutions and individuals), who want the highest degree of freedom and customizability possible to execute their own market making strategies. In this use case, all liquidity in the liquidity pools belongs to the market makers themselves and they also have full control over all the pool parameters. Market makers can dynamically adjust the asset price by changing these parameters based on their assessment of market sentiment, valuation, and other factors. Moreover, market makers can deposit to and withdraw from these liquidity pools in arbitrary ratios, without affecting the asset price.

For a more concrete example, a ETH/USDT market maker in this use case can choose to market-make near ETH=700USDT with a very small k in order to provide highly competitive liquidity and earn considerable transaction/swap fees from trading activity. When the market maker foresees or predicts an increase in ETH price, they can then react accordingly by removing some ETH from their pool to reduce their market risk exposure. This maneuver does not affect the liquidity on the USDT side, however, so trading activity can resume as usual.

This use case also applies to issuers of new assets, who can choose to deposit the tokens they are issuing only without any capital (e.g. ETH, USDT, or other stablecoins). They can set the initial offering price and a small k to ensure low price elasticity, so that the token price does not fluctuate too dramatically due to the influx of trading activity. This design also means that when token issuers need capital for development and operations, they can simply withdraw capital from the liquidity pool without affecting the sell-side liquidity.

The only configuration required for this use case is that

  • Deposits/Withdrawals are set so that only market makers (owners/creators of the pools) are allowed to perform such operations
  • Single-token liquidity provision/removal is allowed

We call this use case the DODO Private Pool.

Use Case 4 — Crowdpooling

“No more bots on IDO. Everyone gets a fair launch!”

Crowdpooling is a portmanteau of “crowdsourcing” and “liquidity pools”, and this use case is an innovation on current asset issuance mechanics. For a newly issued token,

  1. The platform does not allow token trading immediately upon launch; all sale participants will receive tokens (regardless of the amount they purchased or the timing of the purchase) at the same unit price
  2. After the conclusion of the sale, token trading is enabled, and the remaining unsold tokens and liquidity collected from the last phase are used to construct a DODO Vending Machine

Use Case 5AMM

“For the Uniswap loyalists”

This use case ties into our aforementioned claim that PMM is essentially a generalization of AMMs. When

  • k is set to 1
  • Deposits/Withdrawals must be made in proportion to the currently pool ratio

PMM behaves exactly the same as AMMs. The derivation is as follows:

The AMM pricing formula is xy = k, where k is a constant, x is the number of base tokens, and y is the number of quote tokens. For the sake of this explanation, let’s use Const instead of k.

Image for post
Image for post

Differentiating y with respect to x (note the absolute value due to asset price being positive) gives

Image for post
Image for post

Going back to the PMM formula with k set to 1, we can rewrite it as

Image for post
Image for post

But the numerator (iB_0²) is a constant, since B_0 is the original number of base tokens. So letting iB_0² = Const,

Image for post
Image for post

We get the AMM formula back from the generalized PMM formula!

This use case can be adopted in scenarios where the AMM paradigm makes the most sense for whatever reasons.

Use Case 6Stablecoin trading

“Flexible stablecoin swapping”

PMM is capable of supporting stablecoin trading scenarios.

With the following configurations:

  • i = 1
  • k = 0.001 (when k = 0, the exchange rate becomes exactly 1 to 1)

PMM is virtually identical to Curve in terms of performance and capital efficiency, with the added benefits of flexibility, since k can be tweaked to ensure 1-to-1 ratio or make it closer to AMMs where price fluctuation is more pronounced.

In DODO’s v2 offering, all of the above use cases will be available.

RoadMap of Product

Since 2020 summer

V1: DODO Classic Pool for PMM algorithm cold start

  • Validated the PMM design — achieved liquidity 10x better than AMM
  • DEX with the lowest slippage
  • Reached $100M in TVL and $20M in 24H volume in late September and November

V1.5: DODO SmartTrade to enable trading any ERC-20 tokens

  • One of the only two trading platforms (and the only one in Asia) that are both aggregators and liquidity pools; the other is 1inch
  • Daily metrics: $10M+ trading volume, 500+ transactions, and 100+ addresses
  • Cumulative trading volume near $1B


V2: Long tail market growth

  • CrowdPooling
  • DODO Vending Machine
  • DODO Private Pool
  • Binance Smart Chain as L2 solution

V2.1: Token utility, Distribution and Governance

  • vDODO Membership System
  • DODO Trading Incentive System

V2.5: Trading Experience Improvements

V3: Derivatives Market

  • Permissionless, decentralized derivatives
  • and more based on PMM

Hope you are as excited as I am about the exciting possibilities we will bring to DeFi!

The DODO bird loves you! 💗 🐤


DODO Exchange, the on-chain liquidity provider for everyone.

Diane Dai

Written by

Diane Dai

Co-founder of DODOEX. Founder of DeFi labs.



Trade and issue your crypto assets on DODO. Join the on-chain liquidity revolution.

Diane Dai

Written by

Diane Dai

Co-founder of DODOEX. Founder of DeFi labs.



Trade and issue your crypto assets on DODO. Join the on-chain liquidity revolution.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store