Rust Client
The simulator-client and simulator-api crates provide a native Rust interface to the Termina simulator, for teams who want to integrate backtesting directly into their Rust code rather than using the sim CLI.
simulator-clientis the high-level async client. It wraps the WebSocket protocol with ergonomic builders for common workflows: creating sessions, advancing slots, injecting transactions, and reading account state.simulator-apidefines the raw protocol types (request/response structs, error variants, session parameters). Use it if you need direct access to the wire format or want to implement your own client.
For a complete set of end-to-end examples, see the starter code repository.
Installation
[dependencies]
simulator-client = "0.15"
simulator-api = "0.15" # If you only need the protocol types (e.g. to build a custom client):Examples
Available Slots
Before creating a session, confirm the slot range you want to backtest is available:
let ranges = client.available_ranges().await?;
for r in &ranges {
println!(
"slots {} – {}",
r.bundle_start_slot,
r.max_bundle_end_slot.unwrap_or(0)
);
}Program Overrides
Load a compiled ELF binary and patch it into the session.
Reads + Writes
Use the session's RPC client to send transactions and read accounts.
Subscriptions
Rerouted Order Flow
Enable reroute_order_flow at session creation to reroute all taker flow through Jupiter Metis and directly calculate changes to fill rate.
Last updated