Skip to main content

GET /api/v1/lmsr/preview

Preview the result of an LMSR AMM trade without executing it. Use this endpoint to show estimated costs or payouts in the UI before the user confirms a trade.

Authentication​

None. This endpoint is publicly accessible.

Request​

Query Parameters​

ParameterTypeRequiredDescription
market_idint64YesID of the market to preview the trade in.
sidestringYesTrade direction: "buy_yes", "sell_yes", "buy_no", or "sell_no".
amount_typestringYes"spend" (how much to pay in cents) or "shares" (how many tokens to buy/sell).
amountintYesThe amount in cents (if "spend") or number of shares (if "shares").

Example​

curl "https://intotes.com/api/v1/lmsr/preview?market_id=42&side=buy_yes&amount_type=spend&amount=1000"

Response​

200 OK​

{
"cost_or_payout_cents": 1000,
"shares_delta": 1538
}

Response Fields​

FieldTypeDescription
cost_or_payout_centsintFor buys: the estimated cost in cents. For sells: the estimated payout in cents.
shares_deltaintEstimated number of shares that would be bought or sold.

Notes​

  • The preview reflects the current state of the AMM. Actual execution prices may differ slightly if other trades occur between the preview and the trade.
  • No authentication is required, so this can be called for anonymous users browsing the market.

Errors​

StatusCodeDescription
400INVALID_AMOUNTAmount must be a positive integer.
400INVALID_SIDESide must be one of buy_yes, sell_yes, buy_no, sell_no.
404MARKET_NOT_FOUNDNo market found with the given ID.