A market-making bot for Kuru DEX using the refactored kuru-sdk-py client.
This repo now tracks SDK v0.1.9+ behavior:
- Decimal-native order/position math in bot state and fill handling
- Full
ConfigManager.load_all_configs(...)bootstrap path - Typed SDK error handling (
Kuru*Error) for retries and recovery - Cancel-all flow aligned with SDK semantics (no tx-hash return assumptions)
Core modules:
mm_bot/main.py: process startup, logging, signal handlingmm_bot/config/config.py: loads operational config (bot_config.toml) and SDK config bundlemm_bot/bot/bot.py: quoting loop, order lifecycle callbacks, cancellation/reconciliation, typed recoverymm_bot/quoter/quoter.py: skewed bid/ask generationmm_bot/position/position_tracker.py: Decimal-native position persistence (tracking/position_state.json)mm_bot/pricing/oracle.py: oracle sources (kuruwebsocket orcoinbaseREST)mm_bot/pnl/tracker.py: Decimal-native PnL display
git clone https://github.com/kuru-labs/mm-example.git
cd mm-example
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtThe bot uses:
bot_config.tomlfor strategy/operational settings.envfor secrets and SDK runtime settings
PRIVATE_KEYMARKET_ADDRESS(required unlessstrategy.market_addressis set inbot_config.toml)
RPC_URL(defaulthttps://rpc.monad.xyz)RPC_WS_URL(defaultwss://rpc.monad.xyz)KURU_WS_URL(defaultwss://ws.kuru.io/)KURU_API_URL(defaulthttps://api.kuru.io/)KURU_RPC_LOGS_SUBSCRIPTION(defaultmonadLogs)KURU_GAS_BUFFER_MULTIPLIER(default from SDK)KURU_USE_ACCESS_LIST(true/false)KURU_POST_ONLY(true/false)KURU_RPC_WS_MAX_RECONNECT_ATTEMPTSKURU_RPC_WS_RECONNECT_DELAYKURU_RPC_WS_MAX_RECONNECT_DELAYKURU_RECONCILIATION_INTERVALKURU_RECONCILIATION_THRESHOLD
See .env.example and bot_config.example.toml.
./run.shor:
source venv/bin/activate
PYTHONPATH=. python3 mm_bot/main.py- Position state is persisted as Decimal-safe values in
tracking/position_state.json. - Terminal order states now include
ORDER_TIMEOUTandORDER_FAILEDhandling. - SDK typed errors are classified for retry vs skip behavior:
- execution errors:
KuruInsufficientFundsError,KuruContractError,KuruOrderError - connectivity errors:
KuruConnectionError,KuruWebSocketError,KuruTimeoutError - API/auth errors:
KuruAuthorizationError
- execution errors:
- Orders not placing:
- Check margin balances and wallet gas balance
- Confirm market address and token decimals from on-chain market config
- Frequent retries:
- Check RPC/WebSocket health
- Tune
KURU_RPC_WS_*andKURU_RECONCILIATION_*
- No reference price:
- Verify selected oracle source in
bot_config.toml - Check connectivity to Kuru WS or Coinbase API
- Verify selected oracle source in
MIT