Docs · Guides
Read a batch
Read the public record of one batch, on the page and through the API, and check its clearing price against its opened orders.
The batch record is what the chain shows of each batch: its clearing prices, the actions it opened without owners, and the change in each pool's totals. Anyone can read it, with no wallet and no key.
Find a batch
- Batches lists every batch, newest first, with its close time, each market's clearing price, its volume, the count of opened actions and the change in pool totals.
- An order, a share or a position in your own account links to the batch it went into.
GET /v1/batchespages through them, andGET /v1/batches/{batch}returns one.
curl "https://api.mesa.markets/v1/batches?limit=5"
curl "https://api.mesa.markets/v1/batches/1071"A batch that is still open
While a batch is taking actions, its record holds three things: the count of sealed actions, the time it closes, and the timelock round it is sealed to. The page shows the count and a countdown.
The actions are on chain only as commitments, and their terms are encrypted to a round that has not been published.
{
"batchNumber": 1072,
"state": "open",
"openedAt": "2026-11-22T14:26:44.472Z",
"closesAt": "2026-11-22T14:27:14.472Z",
"batchLengthSeconds": 30,
"drandRound": 34184755,
"sealedActionCount": 7,
"serverTime": "2026-11-22T14:26:49.627Z"
}That is the whole response for an open batch, here from a local network with 30-second batches.
A batch that has closed
The head
| On the page | API field | Meaning |
|---|---|---|
| Closed | closesAt | When the batch stopped taking actions, in UTC |
| Timelock round | drandRound | The drand quicknet round whose signature opened it |
| Actions opened | openedActionCount, sealedActionCount | How many of the batch's actions were opened. An action left unopened is reclaimed by its owner. |
| Volume | totalVolumeQuote | Matched volume across the batch's markets |
| Cleared, Settled | clearedAt, settledAt | When every target had its result, and when every action was paid out |
Each market
For each spot market the batch touched, markets[] holds:
| Field | Meaning |
|---|---|
clearingPrice | The one price every fill in this market got |
matchedVolumeBase, matchedVolumeQuote | What traded at that price |
vaultNetBaseDelta, vaultNetQuoteDelta | What the liquidity vault traded: the imbalance the orders left |
orders[] | Every order the batch opened |
And for each order:
| Field | Meaning |
|---|---|
side, orderType | Buy or sell, limit or market |
amountBase | The order's size |
limitPrice | Its limit, or null for a market order |
filledBase, filledQuote | What it filled |
status | filled, partially_filled or unfilled |
An order has no owner field. The record cannot say who placed it, because the chain never held that.
Pools, vaults and perps
| Section | Fields | Meaning |
|---|---|---|
| Pool totals | suppliedDelta, borrowedDelta, totalSuppliedAfter, totalBorrowedAfter, sharePriceAfter | The batch's supplies, redeems and borrows, netted into one change per pool |
| Vaults and perps | depositedDelta, withdrawnDelta, sharePriceAfter | Deposits into and withdrawals from each vault |
oraclePrice, openInterestLongDelta, openInterestShortDelta | The oracle price the perp market cleared at, and the change in open interest per side |
Each is a total. Ten supplies in a batch appear as one number.
Settlement transactions
settlementSignatures lists the Solana transactions that settled the batch's actions. Each can be opened in an explorer: it shows the Mesa authority spending notes and creating notes, and the amounts moving through Mesa's public vault accounts.
Find your own order in it
Open the batch from batch N on your order. Your order is one of the rows, recognisable to you by its side, amount and limit. Your page marks it nowhere, since the record is the same for every reader. What links the row to you exists only in your account: the order note your keys decrypt.
Check the price yourself
A clearing price follows from two public things: the batch's opened orders and the vault's reserves before the batch. With them, anyone can recompute it.
Take the reserves before the batch
The vault's reserves after the batch are in its account and in
GET /v1/vaults/{vault}. SubtractvaultNetBaseDeltaandvaultNetQuoteDeltato get the reserves the batch cleared against,xandy, andk = x · y.Sum the demand
For a candidate price, add the base amount of every buy with a limit at or above it and every market buy, and subtract every sell with a limit at or below it and every market sell. Call the result
N.Solve for the price
Between two neighbouring limits
Nis constant, and the price isk / (x − N)². The clearing price is the candidate that lands inside the interval it was computed for, or the limit at which demand jumps across the vault's line.
The rule is set out with a worked example in Clearing at one price. The program runs the same computation in clear and accepts no price from its caller.
The opened orders can also be read from the chain without Mesa's API: each settlement emits the order's opened terms with its result, and the batch's totals are in its Batch account, laid out in Program: accounts.
Follow batches as they happen
const apiUrl = 'https://api.mesa.markets'
const events = new EventSource(`${apiUrl}/v1/events`)
events.addEventListener('batch.settled', async (e) => {
const { data } = JSON.parse(e.data)
const batch = await fetch(`${apiUrl}/v1/batches/${data.batchNumber}`).then((r) => r.json())
console.log(batch.markets?.map((m) => [m.pair, m.clearingPrice]))
})