Skip to main content

Overview

A typical market making bot has four concurrent loops:
  1. Market data ingestion - Subscribe to the orderbook WebSocket for best bid/ask.
  2. Quote generation - Decide where to quote (spreads, levels, sizes) based on your model + inventory.
  3. Execution - Atomically cancel + place quotes using client.place_orders().
  4. Order lifecycle & fills - Listen to on-chain events to track placements, fills, and cancellations.
The SDK handles (1), (3), and (4). You supply (2).
Make sure you’ve completed the Quick Start before following this guide — you’ll need a configured KuruClient with funded margin.

Step 1 - Start the Client

client.start() performs EIP-7702 authorization and connects to the RPC WebSocket for on-chain event tracking.

Step 2 - Set Order Callback

Set an order callback to track your order lifecycle:
Alternatively, read from client.orders_manager.processed_orders_queue instead of using callbacks.

Step 3 - Subscribe to Real-time Orderbook Data

Prices and sizes in FrontendOrderbookUpdate are pre-normalized to human-readable Decimal values. No manual conversion is needed.

Step 4 - Cancel and Place Quotes

Build a grid of orders, cancel stale ones, and send them in a single batch transaction:

Tick Size and Rounding

On-chain prices must align to market_config.tick_size. When you pass float prices to place_orders(), the SDK converts them to integers using price_precision and then rounds to tick size. price_rounding options:

Step 5 - Cancel All Orders

To cancel all active orders for the market (useful for circuit breakers or graceful shutdown):
This cancels every order you have on the book for this market in a single transaction, regardless of whether you’re tracking them locally.

Step 6 - React to Fills and Inventory

The SDK delivers order status updates via the callback or queue: Typical market maker reactions:
  • Record fills and PnL
  • Adjust inventory targets
  • Skew spreads based on inventory (long base → tighten asks, widen bids)
  • Refresh quotes more aggressively after fills
Compute inventory from margin balances:

Next Steps

See the Reference for order types, configuration presets, and production guidance.