Installation
pip install kuru-sdk-py
# or
uv add kuru-sdk-py
Create a .env file in your project root:
# Required
PRIVATE_KEY=0x...
MARKET_ADDRESS=0x...
# Optional endpoints (defaults exist)
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/
# Optional WebSocket behavior
KURU_RPC_LOGS_SUBSCRIPTION=monadLogs # Set to "logs" for committed-state streaming
# Optional trading defaults
KURU_POST_ONLY=true
KURU_AUTO_APPROVE=true
KURU_USE_ACCESS_LIST=true
Never expose your private keys in your code, especially if the code is stored in version control or deployed to shared servers.
Core Concepts
Kuru market making interacts with three on-chain components:
| Component | Description |
|---|
Orderbook contract (MARKET_ADDRESS) | Holds the limit orderbook and emits OrderCreated, OrdersCanceled, and Trade events. |
| Margin account contract | Holds 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 environment variables with sensible defaults:
import os
from dotenv import load_dotenv
from kuru_sdk_py.client import KuruClient
from kuru_sdk_py.configs import ConfigManager
load_dotenv()
configs = ConfigManager.load_all_configs(
market_address=os.environ["MARKET_ADDRESS"],
fetch_from_chain=True,
)
client = await KuruClient.create(**configs)
Setting fetch_from_chain=True reads the market’s on-chain params and automatically sets price_precision, size_precision, tick_size, and token addresses/decimals/symbols.
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.