Skip to main content

LMSR AMM

The Logarithmic Market Scoring Rule (LMSR) is the automated market maker that provides continuous liquidity on Intotes. Unlike orderbook trading where you need a counterparty, AMM trades execute directly against a shared liquidity pool, guaranteeing that traders can always buy or sell.

How LMSR Works​

LMSR is a cost-function-based market maker originally designed for prediction markets. It calculates a running cost based on the total quantity of each outcome's shares that have been purchased. The price of any outcome adjusts smoothly as traders buy and sell, reflecting the market's evolving consensus on probabilities.

The Cost Function​

The core formula is:

C(q) = b * ln( sum( e^(q_i / b) ) )

Where:

  • q_i is the current cumulative quantity of shares for outcome i (e.g., q_yes and q_no for a binary market).
  • b is the liquidity depth parameter, expressed in cents.
  • ln is the natural logarithm and e is Euler's number.

The cost to execute a trade is the difference in the cost function before and after the trade:

trade_cost = C(q_after) - C(q_before)

The Liquidity Parameter (b)​

The parameter b controls how sensitive prices are to trading activity:

  • A larger b means lower price impact per trade. Markets with high b can absorb large orders without dramatic price swings.
  • A smaller b means higher price impact. Even modest trades will move the price significantly.

The appropriate value of b is configured per market based on expected trading volume and desired price sensitivity.

Fees​

Fees are applied symmetrically around the raw AMM price:

  • Buy: cost = amm_price * (1 + fee%)
  • Sell: payout = amm_price * (1 - fee%)

The fee percentage is configured globally via the lmsr.FeePercent setting. This ensures the platform captures a small spread on every AMM transaction.

Trade Sides​

Every AMM trade specifies a side, which determines what the trader is buying or selling:

SideDescription
buy_yesBuy YES shares (betting the outcome will happen)
sell_yesSell YES shares back to the pool
buy_noBuy NO shares (betting the outcome will not happen)
sell_noSell NO shares back to the pool

Buying YES is equivalent to going long on that outcome. Buying NO is equivalent to going short (or long on the opposite outcome).

Amount Types​

When placing an AMM trade, you specify how much you want to trade using one of two modes:

Amount TypeDescription
spendThe total amount you want to pay, in cents. The system calculates how many shares you receive.
sharesThe number of shares (tokens) you want to acquire. The system calculates the cost.

For example, a buy_yes trade with amount_type: "spend" and amount: 5000 means "I want to spend $50.00 on YES shares, give me as many as that buys." Conversely, amount_type: "shares" and amount: 100 means "I want exactly 100 YES shares, tell me the cost."

Preview Endpoint​

Before committing to a trade, you can call the preview endpoint to see exactly what the trade would cost (or pay out) without executing it. The preview returns:

  • The number of shares you would receive (or sell).
  • The total cost (or payout) including fees.
  • The resulting price after the trade.

This allows traders to evaluate price impact and make informed decisions before risking capital.

Market State​

AMM trading is only available when the market is in the appropriate state:

  • Active: Trading is open. Both buy and sell operations are available.
  • Paused: Trading is temporarily halted. No AMM trades can execute. This may happen during event transitions or administrative actions.
  • Resolved: The event outcome has been determined. No further trading is possible. Positions are settled based on the result.

Bonus Restrictions​

Trades funded by bonus balances have additional restrictions to prevent abuse:

  • Sport events: Bonus-funded AMM trades are blocked within 2 hours of the match start time. This prevents last-minute low-risk bets when outcomes become more predictable.

Regular balance trades are unaffected by this restriction.

Relationship to the Orderbook​

Intotes uses a hybrid execution model. When a limit order is placed on the orderbook, any residual quantity that is not filled by resting counterparty orders is automatically routed to the LMSR AMM. This means:

  1. The orderbook is checked first for matching opportunities.
  2. Any unfilled remainder is executed against the AMM at the current cost-function price.

This hybrid approach gives traders the benefit of peer-to-peer price discovery on the orderbook while ensuring that every order can always be filled through the AMM backstop.