JIT-only MM
JIT-only market making means you do not keep a standing book. You compete in JIT auctions (see Matching Engine for liquidity sources). Instead, you:
- subscribe to on-chain auction / order feeds,
- compute the current “auction price” / acceptable fill price,
- atomically fill as maker (and optionally post liquidity) when opportunities arise.
Subscribe to auctions / orders
import { AuctionSubscriber } from "@drift-labs/sdk";Class AuctionSubscriberReference ↗| Name | Type | Default |
|---|---|---|
driftClient | any | |
opts | any | |
resubOpts | any | |
eventEmitter | StrictEventEmitter<EventEmitter, AuctionSubscriberEvents> | |
subscriber | any | |
subscribe | () => Promise<void> | |
unsubscribe | () => Promise<void> |
import { OrderSubscriber } from "@drift-labs/sdk";Class OrderSubscriberReference ↗Compute auction prices (helpers)
import { getAuctionPrice } from "@drift-labs/sdk";Function getAuctionPriceReference ↗| Name | Type | Default |
|---|---|---|
order | Order | |
slot | number | |
oraclePrice | anyUse MMOraclePriceData source for perp orders, OraclePriceData for spot |
Fill as maker (atomic place-and-make)
This pattern places your maker order and fills against the taker in one transaction.
// makerOrderParams: OptionalOrderParams
// takerInfo: TakerInfo (includes taker user account + the order to fill)
await driftClient.placeAndMakePerpOrder(makerOrderParams, takerInfo);Method DriftClient.placeAndMakePerpOrderReference ↗| Name | Type | Default |
|---|---|---|
orderParams | OptionalOrderParams | |
takerInfo | TakerInfo | |
referrerInfo | ReferrerInfo | |
txParams | TxParams | |
subAccountId | number |
Practical filters
In JIT-only workflows you’ll usually want filters like:
- risk-increasing vs reducing (skip toxic flow)
- max position size / leverage / free collateral
- oracle validity / divergence checks
- skip Swift-origin orders if you’re already handling them via the Swift websocket feed
import { isSignedMsgOrder } from "@drift-labs/sdk";Function isSignedMsgOrderReference ↗| Name | Type | Default |
|---|---|---|
order | Order |
const oracle = driftClient.getMMOracleDataForPerpMarket(0);Method DriftClient.getMMOracleDataForPerpMarketReference ↗| Name | Type | Default |
|---|---|---|
marketIndex | number |
const marketIndex = 0;
const oracle = driftClient.getMMOracleDataForPerpMarket(marketIndex);
const perpMarket = driftClient.getPerpMarketAccount(marketIndex);
if (!oracle.isValid) return;
if (!perpMarket) return;
// Example: skip if oracle is stale or market is volatile for your strategy.Last updated on