Skip to main content

Installation

pip install kuru-sdk-py
# or
uv add kuru-sdk-py

Configuration

The SDK uses two files: a config.toml for all non-secret settings, and a .env for your private key. .env — secrets only:
PRIVATE_KEY=0x...
config.toml — everything else:
[market]
market_address = "0x..."

[connection]
rpc_url = "https://rpc.monad.xyz"
rpc_ws_url = "wss://rpc.monad.xyz"
kuru_ws_url = "wss://ws.kuru.io/"
kuru_api_url = "https://api.kuru.io/"

[transaction]
timeout = 120
gas_buffer_multiplier = 1.35
local_gas_estimation = false

[websocket]
max_reconnect_attempts = 5
reconnect_delay = 1.0
heartbeat_interval = 30.0
rpc_logs_subscription = "monadLogs"  # or "logs" for committed-state only

[order_execution]
post_only = true
auto_approve = true
use_access_list = true
Never commit your .env file to version control. Add it to .gitignore.

Core Concepts

Kuru market making interacts with three on-chain components:
ComponentDescription
Orderbook contract (MARKET_ADDRESS)Holds the limit orderbook and emits OrderCreated, OrdersCanceled, and Trade events.
Margin account contractHolds your trading balances. Orders consume margin balances, not wallet balances.
MM Entrypoint (EIP-7702 delegation)Your EOA is authorized to delegate to the MM Entrypoint contract, enabling batch cancel and place operations in a single transaction.

Key SDK Objects

The SDK provides three main objects:
  • KuruClient - The main facade for execution, event listeners, and orderbook streaming.
  • User - Deposits/withdrawals, approvals, and EIP-7702 authorization.
  • Order - Your local representation of a limit order or cancel.

Create a Client

Use ConfigManager to load configuration from config.toml with sensible defaults:
from dotenv import load_dotenv

from kuru_sdk_py.client import KuruClient
from kuru_sdk_py.configs import ConfigManager

load_dotenv()  # loads PRIVATE_KEY from .env

configs = ConfigManager.load_all_configs()  # reads everything else from config.toml

client = await KuruClient.create(**configs)
load_all_configs() automatically loads config.toml, fetches the market’s on-chain params, and sets price_precision, size_precision, tick_size, and token addresses/decimals/symbols. No extra flags needed.

Fund Margin

Orders are backed by margin balances. Deposit base and/or quote before quoting:
await client.user.deposit_base(10.0, auto_approve=True)
await client.user.deposit_quote(500.0, auto_approve=True)

margin_base_wei, margin_quote_wei = await client.user.get_margin_balances()
If you quote both sides, keep both base and quote margin funded; otherwise your orders will revert.

Next Steps

Now that you have a client and funded margin, follow the Market Making Guide to build your bot.