Run The Reference Market Maker#
This page is the canonical on-ramp for the reference market maker. The kit
in packages/bot-rust is an educational starter, not a production trading
system. It is dry-run by default and should stay dry-run until you have reviewed
the config, risk limits, wallet funding, and market behavior.
What It Does#
The reference configuration:
- Reads Solana market and orderbook state.
- Reads Pyth prices through a Hermes endpoint.
- Builds simple two-sided quotes.
- Skews quotes based on inventory.
- Applies spread, inventory, max-loss, and open-order limits.
- Prints intended actions in dry-run mode.
It is not proprietary alpha and it is not a production market-making service.
Start In Dry Run#
The sample configuration does not start infrastructure. Before running it,
provide both local dependencies configured in packages/bot-rust/configs/mm.toml:
- a Solana RPC with the Seesaw program and discoverable test markets at
http://127.0.0.1:8899; and - a Hermes-compatible service with the configured feed data at
http://127.0.0.1:8787/hermes.
Then, from the repo root:
cargo test --manifest-path packages/bot-rust/Cargo.toml
cargo run --manifest-path packages/bot-rust/Cargo.toml -- packages/bot-rust/configs/mm.toml
The sample mm.toml uses safe local defaults:
dry_run = true- local Solana RPC
- local Hermes URL
- virtual dry-run balance
- no live transaction sending
- conservative quote size and inventory caps
The package README documents the framework internals and other starter strategies. Keep setup and safety guidance on this page so integrators have one market-maker entry point.
Key Config Fields#
| Field | Purpose |
|---|---|
bot.dry_run | Keeps the bot from sending transactions while testing. |
bot.dry_run_virtual_balance | Simulated settlement balance when no live account is funded. |
bot.treasury_token_accounts | Live-only ordered list of exactly eight distinct treasury SPL token accounts. |
feeds.hermes_url | Pyth Hermes endpoint. |
feeds.hermes_api_key or PYTH_API_KEY | Required for upgraded Hermes endpoints. |
strategy.market_making.base_spread_bps | Neutral spread around the mid. |
strategy.market_making.quote_size | Size per quote in settlement base units. |
strategy.market_making.max_inventory | Inventory cap for the strategy. |
strategy.market_making.exit_cutoff_secs | Time before market end when quotes should stop. |
risk.max_loss | Max cumulative buy exposure. |
risk.max_open_orders | Maximum simultaneous open orders. |
risk.min_settlement_balance | Settlement reserve to keep untouched. |
Before Live Trading#
Do all of this before setting dry_run = false:
- Use a dedicated wallet.
- Fund only the amount you are prepared to risk.
- Confirm the target RPC, program ID, settlement mint, market creators, and Pyth feed IDs.
- Provide
PYTH_API_KEYthrough the environment or a protected config file. - Configure exactly eight distinct
bot.treasury_token_accounts, in the same index order as the on-chainconfig.treasury_recipients[i]array. A single treasury account, duplicate entries, or a reordered list is invalid. - Confirm startup uses
LiveExecutor::new_verified. It fetches the Config PDA and fails closed before trading if the program owner, settlement mint, or any indexed treasury recipient differs from the configured value. - Set
strategy.market_making.kill_switch = falseonly when ready. - Run against a local or staging market first.
- Watch order placement, cancel behavior, and settlement claims end to end.
- Keep final-minute exposure limits conservative.
Risk Notes#
- Makers pay no fee on resting fills, but exiting inventory as a taker can cost fees and slippage.
- Thin books can move sharply near resolution.
- A dry-run strategy that looks stable can behave differently when live transactions compete for block space.
- Always keep enough SOL for transaction fees and enough settlement balance for the configured quote sizes.
See also: