Call sequence
1
Find the market
List markets (filter by
league, sport or
starts_after), then Get a market.2
See the depth
Quote a market prices a size across venues.
Get a market orderbook shows each venue’s book.
3
Preview
Preview an order returns the plan: the legs per venue,
the executable quantity and the slippage check. Nothing is sent.
4
Place it
Place an order with the same body. Lean places the legs
on the venues the plan chose. Set
client_order_id so a retry returns the same order.If the cash is on one venue and the book on the other, the same call moves the cash and
buys, and route in the response names both venues. See
Paying from the other venue.Set best_price: true to take that route whenever it costs less than buying where the cash
is, even when the cash would cover the buy. See
Best price across venues.5
Follow and reconcile
Create a stream ticket to follow order,
position and balance updates over the WebSocket, then confirm with
Get an order and
List fills.
Starter
Guardrails
- Price protection.
limit_priceis the worst price per share you accept, andmax_slippage_bpsbounds how far each venue order may trade from that venue’s own best price, so venues quoting different prices can each fill.limit_pricecaps every venue alike. - Fill or nothing.
all_or_nonewithtime_in_force: iocplaces the order only if the books can fill the whole quantity. It is best effort: a book can move before the fill, so a partial fill is still possible. See All or none. Polymarket takesiocbuys by dollar amount only, so a buy sized withquantityfills on Hyperliquid. - Safe retries. The same
client_order_idalways returns the same order. - Spending caps. Every order is checked against the key’s per order and rolling 24 hour limits before it reaches a venue.
- Precise sizing. Quantities are in steps of 0.01 shares.