@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / fillsWithinSlippage

Function: fillsWithinSlippage()

fillsWithinSlippage(book, side, amount, slippage, denomination?): boolean

Defined in: packages/sdk/src/unified/quotes.ts:139

Whether a market order of amount (in denomination) fills COMPLETELY within slippage of the mid price: buys spend against asks at or below mid·(1+slippage), sells deliver into bids at or above mid·(1−slippage). Levels are sorted best-first, so the first level outside the band ends the walk. False when the book is empty, the mid is unknown, or the in-band liquidity can't cover the size — the caller should refuse the order rather than fill deep.

Parameters

book

UnifiedOrderBook

side

"buy" | "sell"

amount

number

slippage

number

denomination?

QuoteDenomination = "base"

Returns

boolean