Market-Maker Bot
Run a two-sided maker on DeepBook v3. Stand up one BalanceManager to hold inventory for both sides, compute a bid and ask grid around mid price, rest it with POST_ONLY orders so it never crosses, stake DEEP for fee rebates, and unwind with cancel-all-and-refresh.
Quoting both sides at once
- ›Two-sided quoting from a single BalanceManager that holds inventory for both the bid and ask side.
- ›POST_ONLY orders so the maker always makes and never accidentally crosses the book to take.
- ›Staking DEEP through governance to qualify for maker fee rebates.
Five sections, end to end
-
One BalanceManager
Create a single shared account that holds the inventory backing every leg of the grid.
src/sandbox.ts -
Compute the grid
Build a symmetric ladder of bids and asks around the current mid price, snapped to the pool tick.
src/marketMaker.ts -
Rest the grid
Place every level with POST_ONLY in one transaction, so the engine rejects any leg that would cross.
src/marketMaker.ts -
Stake DEEP
Deposit and stake DEEP through governance so the maker qualifies for fee rebates next epoch.
src/marketMaker.ts -
Unwind & re-quote
Cancel the whole grid atomically, wire the smoke UI, and pass the live gate.
src/App.tsx · src/main.tsx
Start this lesson
/acc-deepbook-course:start # then pick "Market-Maker Bot"
Already installed? Run the start command and choose this lesson from the catalog.
New here? Follow the install steps first. The course brings up a local sandbox and gates each section with pnpm vitest run.