Run The Reference Market Maker#
The reference market-maker kit in packages/bot-rust is an educational starter
for two-sided quoting. 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#
From the repo root:
bash
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
If your command target differs, use the package README as the source of truth:
packages/bot-rust/README.md.
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. |
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. - 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: