Call sequence
1
Get data
Get prices,
Get recent trades and
Get a market orderbook, plus the WebSocket stream
(Create a stream ticket).
2
Trade on edge
Preview an order, then
Place an order with a deterministic
client_order_id
(for example, model run plus signal id). A retry returns the same order, never a second one.3
Set guardrails
Get account configuration shows the per order
and rolling 24 hour limits the key is held to.
Lower this key’s limits lets a bot key tighten its
own limits; raising them needs a person signed in to Lean.
Pause order placement is the kill switch: a key can
stop itself or its whole trading account, and only the Lean dashboard can resume.
4
Reconcile
Starter
Guardrails
- Idempotency. Replaying a
client_order_idwith the same body returns the original order; reusing it with a different body is refused with 409. - Spending caps. An order above the key’s per order limit is refused with 422
ORDER_NOTIONAL_LIMIT, and the rolling 24 hour limit caps total activity. - Kill switch. One call to Pause order placement stops the key or the whole trading account.
- Slippage bounds.
max_slippage_bpscaps every order when set.