Today we’d like to share more details about our novel liquidity mechanism, the Just-in-Time (JIT) Liquidity mechanism.
The JIT Liquidity mechanism is one of many innovations that will be released with Drift v2.
At its core, the JIT Liquidity Auction is a mechanism to enable deep liquidity on both spot and perpetuals trading. With this implementation, Drift overcomes the limitation of on-chain liquidity and enables the facilitation of trades of all sizes.
The novel liquidity mechanism will work alongside Drift’s oracle-based AMM and decentralised orderbook.
In this article we’ll unpack the JIT liquidity mechanism in more detail and break down its innovations in comparison with other existing on-chain liquidity models.
Existing On-Chain Liquidity Models
1.1. Automated Market Makers (AMMs)
In a regular Automated Market Maker (AMM) the available liquidity is determined by the size of the liquidity pools, where liquidity is constant across all price ranges.
This is determined by the equation: x*y = k
In more advanced systems, such as Uniswap v3 AMM, liquidity is determined by the amount of capital provided within custom price bands in each liquidity pool.
1.2. Virtual AMMs (vAMMs)
In a virtual AMM (vAMM) liquidity is determined and set by the operators of the protocol. This can be as high or as low as the operator wishes, but there are second order effects that need to be considered when setting an artificial k.
In this context, k functions as the virtual reserve. If k is configured incorrectly, it'll affect slippage and price movement.
If k is too high, there will be lower slippage but more capital will be needed to move the price of the AMM
If k is too low, there will higher slippage but less capital will be needed to move the price of the AMM
As the vAMM allows for asynchronous trading (meaning that the AMM is counterparty to the trades), K needs to be carefully considered as incorrect calibration can lead to more significant long/short imbalances i.e. ratios of buys/sells or longs/shorts.
1.3. Request-for-Quote (RFQ) Systems
In Request-for-Quote (RFQ) systems, takers request a hypothetical quote from multiple market makers. Market makers then submit quotes to the taker who then either accept or reject the quote within a pre-set period of time.
The pricing is entirely up to the market makers, who typically use their own off-chain pricing algorithms to submit a fair quote to traders.
The taker aggregates all maker bids and decides which bid they would like to be filled at. Since prices can move quickly, taker orders can only be executed within a short window of time before the quote becomes invalid.
Since takers have ultimate control over which maker quotes fill their order, Request-for-Quote (RFQ) systems are functionally off-chain OTC channels that settle on-chain.
Off-chain pricing mechanisms can vary as (1) there are differences in pricing strategies between market makers; and (2) they are not based on oracle prices. As a consequence, liquidity is not guaranteed at all times.
Drift v2’s Liquidity Innovations
Drift v2 features a novel hybrid liquidity mechanism, the Liquidity Trifecta with on-chain, oracle-based live pricing.
This liquidity trifecta takes the best of central limit orderbooks (CLOBs), Request-for-Quote (RFQ) systems and Automated Market Makers (AMMs), and combines them into a unified liquidity source for on-chain trading.
With this innovation, Drift v2 provides users with a novel way to source liquidity for derivatives on-chain with tight spread, accurate oracle pricing, and minimal slippage.
The Just-in-Time Liquidity Mechanism
Let’s take a look at how a market or limit order would work in our liquidity mechanism:
- Start: User submits a market order (i.e. taker order).
- Auction: The taker order is routed through a Just-In-Time auction where external market makers can participate in a high frequency Dutch auction to fill a user’s order.
- Auction Pricing: The JIT prices are determined by the AMM’s bid and ask curves. Market makers can decide to fill orders when prices reach their desired i.e. preferred levels.
- AMM Backstop: If no market makers step in to fill the taker order during the JIT auction, or if a remaining size on the order is unfulfilled, the order will be routed through to the AMM which will act as a source of backstop liquidity.
In the following we’ll take a deep dive into each of these steps.
Auction Process
In the JIT liquidity mechanism, takers submit market or limit orders within the UI. Exclusive of slippage and fees, the price the taker sees on the UI is the maximum they would pay for the order.
Once submitted, a Dutch auction is triggered, lasting a duration of 5 seconds.
Market makers must compete to submit quotes to the taker within that period.
To maximise on-chain computational efficiency, the available prices within the Dutch auction are pre-determined by the oracle price and the AMM’s bid-ask spreads.
Like in a regular Dutch auction, the price at which the order can be filled goes from the best to the worst (for the taker).
This is distinctively different from an RFQ system where market makers submit their own independent prices to traders.
Example
A trader wishes to go long on SOL-PERP for US$1,000.
In an RFQ system, the trader would receive quotes from market makers that they can either take or not.
However, in a JIT auction, the order prices are already predetermined by Drift’s bid / ask curves. If the order is filled during the JIT auction, it will always be at a better price than if the order was filled by the AMM.
As the 5 second Dutch auction goes on, the order price becomes worse for the trader and better for the market maker.
As a result, market makers need to be as competitive as possible, bringing about price improvements for traders.
The prices quoted in the Just-in-Time (JIT) auction are on-chain, deterministic and based on time, while market makers in a RFQ system operate off-chain and can submit their price quotes at any point.
Concluding Thoughts
The Just-in-Time auction is an innovative liquidity mechanism that significantly bolsters the health of the entire platform.
The liquidity network has been designed to be front-run resistant, enabling trades of all sizes (rather than being limited by the availability of current on-chain liquidity) and allowing any user to participate in the ecosystem — either as maker or taker.
Traders benefit from better pricing, better slippage and lower price impact, while makers are able to benefit from seeing retail flow beforehand.
The Just-in-Time mechanism allows for both retail and institutional investors to execute large on-chain trades with the best in class user experience.
This is only the first step in a series of steps that will enable us to become one of the leading DEXs on Solana and beyond.
—
Frequently Asked Questions (FAQs)
Is the JIT market order a fill or kill? (FOK)
Each market order in the JIT auction can be partially filled, so there’s no option for fill-or-kill at the moment.
Are users able to cancel orders prior to the JIT filling?
Yes, users are able to cancel outstanding open orders while the JIT auction has begun, but filled orders during the JIT period cannot be cancelled.
What are the benefits for takers?
For takers, the main benefit of the JIT auction is that liquidity is much deeper compared to an AMM. Liquidity on the JIT auction isn't constrained by how much virtual liquidity is available for a user; it's purely determined by the liquidity provided by external makers in each auction.
What are the benefits for makers?
For makers, the JIT auction provides an easy way to access on-chain taker flow for market making operations. Unlike a CLOB where the set up cost and ongoing infrastructural costs are high, market making on the JIT is a simple competitive auction fill mechanism, which reduces the barrier for entry for making on-chain.
Makers will also earn a rebate for filling taker orders. More details will be released on this.
How many auctions can there be at once?
There is no limit for how many markets a maker enters at any single point. On a per-exchange level, there is no limit to the total amount of auctions happening at once.
Can auctions be partially filled?
Yes, auctions can be partially filled up to a user's slippage tolerance. There are no Fill-or-Kill (FOK) auctions.
Can auctions be cancelled once initiated?
Yes, users can cancel the unfilled portion of their order in the auction once they've been initiated. Users will need to pay a network fee in SOL to cancel their ongoing auction, as well as a nominal fee to keepers of $0.01 USDC.
Can makers pull out of an auction once they have filled on the auction?
Once an order is partially filled, they are not able to pull out of an auction. Fills are confirmed when the maker submits a fill on a first-come-first-serve basis.
Is there a limit to how many auctions a maker can participate in at once?
No, there is no limit. Makers can enter multiple auctions at once to cancel out their exposure.
Is there a way for users to enter market orders without entering the auction?
Not at the moment. Market orders all go through the JIT auction. Users can opt to place a limit order instead if the user wishes to be matched with another order via the DLOB.
Do limit orders trigger JIT auctions?
No. Limit orders do not trigger a JIT auction. Limit orders can be filled by a JIT auction if the prices cross, but they do not trigger an auction to start. Otherwise, limit orders will sit in the decentralised orderbook and be filled against other limit orders or against the AMM when the trigger conditions are met.
Are there individual JIT pools for each taker order placed?
Yes. Each user will have a different account and each taker order placed will go through its own JIT auction.
Will I know the exact price I'll be filled at?
Exclusive of slippage and fees, the UI will display the price that the Taker will be filled at should it be filled against the AMM. This is the worst possible price the Taker can receive. Any Maker that steps in via the JIT auction can only provide the Taker with a better price.
Disclaimer: This article is strictly for educational purposes only and doesn’t constitute financial or legal advice or a solicitation to buy or sell any assets or to make any financial decisions. Please be careful and do your own research.
Join The Drift Family
We’re excited to keep creating value for Drift users and can’t wait for you to join our community! 🙇🏽🙇🏻
Drop us a message over on Discord and check us out on Twitter 👋