Skip to main content
Who it’s for: quant teams that have a pricing model and want it trading around the clock. What you build: a bot that turns model edge into orders. Its limits are enforced by the API, not only by the bot.

Call sequence

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.

Starter

Guardrails

  • Idempotency. Replaying a client_order_id with 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_bps caps every order when set.