Skip to Content
Symmio Trading-SDK — the SDK surface for builders on Arbitrum
CoreOrderbookwalkOrderbook

walkOrderbook

Fill a hypothetical market order against resting depth. A buy consumes asks from the best price outward; a sell consumes bids.

import { walkOrderbook } from "@symmio/trading-core"; const walk = walkOrderbook(book, "buy", 5); if (walk.partial) console.warn("not enough resting depth"); console.log(walk.averagePrice, `${walk.slippageBps.toFixed(2)} bps`);

Parameters

orderbookOrderbookrequired

The book to walk.

side"buy" | "sell"required

buy consumes asks, sell consumes bids.

sizenumberrequired

Base-asset quantity to fill.

Returns

OrderbookWalk

The fill, or a zero-filled result when size is not positive or the side is empty.

filledSizenumber

Base-asset size actually fillable — less than requested when depth ran out.

filledQuotenumber

Quote-asset cost (buy) or proceeds (sell).

averagePricenumberoptional

Size-weighted average fill price. Absent when nothing filled.

bestPricenumberoptional

Best price on the side walked. Absent when that side is empty.

worstPricenumberoptional

Price of the deepest level touched.

slippageBpsnumber

Cost of crossing the book, in basis points of bestPrice. Always >= 0 — a buy averages above the touch and a sell below it, and both are reported as a positive cost.

partialboolean

true when the book held less depth than requested.

levelsConsumednumber

Number of price levels consumed.

Nothing but the book is considered — no fees, no funding, no solver spread. Treat the result as the cost of liquidity, not a quote. When the source’s priceBasis is reference-exchange this is a third-party venue’s depth, not what a SYMMIO trade executes against.

Interpreting partial

A partial: true result may mean the venue is genuinely thin, or merely that the subscription is tracking fewer levels than the order needs. If you price large orders, raise levels on the subscription (or limit on the snapshot) before treating it as a liquidity signal.

Last updated on