@somnia-chain/markets-sdk / index / estimateMarketOrder
Function: estimateMarketOrder()
estimateMarketOrder(
book,side,amount,denomination?):MarketOrderEstimate|null
Defined in: packages/sdk/src/unified/quotes.ts:98
Estimate a market order's execution by walking one side of the book:
buys walk the asks, sells walk the bids, consuming amount in either the
base or the quote denomination. The four combinations:
- buy + quote — spend a quote budget, learn the base received.
- buy + base — target a base size, learn the quote cost.
- sell + base — deliver a base size, learn the quote received.
- sell + quote — target quote proceeds, learn the base sold.
Returns null when the relevant side is empty or amount is
non-positive. A partial walk (book thinner than the order) returns what
WOULD fill — compare baseFilled/quoteFilled against the request to
detect it.
Parameters
book
side
"buy" | "sell"
amount
number
denomination?
QuoteDenomination = "base"
Returns
MarketOrderEstimate | null