Skip to main content

Crate simulator_api

Crate simulator_api 

Source

Re-exports§

pub use direct_fill::AMOUNT_WIDTH;
pub use direct_fill::DirectFillTemplate;
pub use direct_fill::ParseDirectFillTemplateError;
pub use direct_fill::TakerSlots;
pub use direct_fill::TemplateAccount;
pub use direct_fill::TemplateInstruction;
pub use reroute_report::SwapMode;

Modules§

client_identity
User-Agent contract between our clients and the manager. Rendered by simulator-client / sim-cli, parsed by the manager on the control-WS upgrade. Both sides reference these consts so the two cannot drift.
direct_fill
Caller-supplied direct-fill templates: one instruction the server rewrites per probe.
geyser_route
How a gRPC caller names the session it wants.
mints
The major-mint universe shared by the reroute reports: tables of stables and priced majors, plus the helpers that classify, price, and label mints against them.
replacement
The parts of a replacementSubscribe payload that every kind carries.
replay_support
What account state replay cannot serve, worded once. Client, manager and session all reject through here, so a user meets the same explanation wherever the request is stopped.
reroute_report
The source-agnostic reroute-report core: one row in (LegRecord), the pricing derived from a stream of them (Samples / Prices), and the three reports built over both — the venue-flow one (Report), the benchmark (RangeReport), and the per-template direct-fill probe breakdown (probes::ProbeReport). Adapters map their own source onto LegRecord; nothing here does I/O.
route_plan
One route, hop by hop: what the router quotes, what a decoded transaction reports, and what both are recorded and streamed as. Only the router names a pool; only a transaction’s route events name the program that ran a hop.
subscribe_config
Cross-cutting subscribe options shared by the client and server.
usage
ws_compression
Streaming zstd compression for the subscription WebSocket firehose.

Structs§

AccountData
Account snapshot used to seed or modify state in a session.
AccountModifications
Account state modifications to apply.
AvailableRange
One contiguous block range available on the history clerk.
BundleBuildListResponse
Response of GET /build-bundle.
BundleBuildRequest
Request body of POST /build-bundle.
BundleBuildStatusResponse
Response of the management bundle-build endpoints.
BundleDeleteRequest
Query of DELETE /bundles: the bundle to delete, by kind and exact range.
BundleDeleteResponse
What DELETE /bundles removed.
CloseSessionRequestV1
CompletedBundle
A bundle the caller owns and can use now. Ordered by slot range, then kind.
ContinueParams
Arguments used to continue an existing session.
ContinueSessionRequestV1
ContinueToParams
Arguments used to step an existing session to a precise point.
ContinueToSessionRequestV1
ControlSessionId
Identifies the control session grouping a parallel batch of sub-sessions.
CreateBacktestSessionRequestOptions
CreateBacktestSessionRequestV1
CreateSessionParams
Parameters required to start a new backtest session.
CreateSessionParamsBuilder
Use builder syntax to set the inputs and finish with build().
DepthCoverageResponse
What a depth request will actually sample, per source.
DepthRequest
Request body of POST /generate-depth.
DepthSourceCoverage
DepthStatusResponse
Response body of POST /generate-depth and GET /generate-depth/{request_id}.
DiagnosticProbeParams
DirectFillTemplateReport
One template’s share of the direct-fill census; the flat direct_fill_* counters on RerouteStatsReport are the sums of these.
DiscoveryBatchEvent
Payload emitted when the session has discovered an upcoming batch that matches one or more registered DiscoveryFilters from session creation (for example, a batch containing a transaction that invokes a program of interest). The (slot, batch_index) pair can be fed directly to BacktestRequest::ContinueTo to pause immediately before the batch executes. After each Continue / ContinueTo, the session emits the next DiscoveryBatchEvent ahead of the next matching batch, enabling a reactive “pause on every discovery” driver loop.
EncodedBinary
A blob paired with the encoding needed to decode it.
InvertedSlotRange
Why a pair of bounds isn’t a valid range.
MintPair
The two mints a swap trades, without a direction: a maker quotes a pair both ways, so (a, b) and (b, a) are the same pair. Normalized on construction and on deserialization, which is what makes the set lookup direction-agnostic.
OverrideSchedule
Slot-keyed account overrides, carried forward per account. Clones share the same runtime resolutions so the session, reroute engine, and geyser pump observe one schedule.
ParseMintPairError
PausedEvent
Payload emitted when a session halts at a caller-specified point. batch_index is None for block-boundary pauses and Some(n) when the session stopped before batch n within slot (no transaction from batch n has been applied). While paused, RPC reads against the session observe partial state up through batch n - 1.
RerouteAggregators
The aggregators a session re-quotes. Jupiter alone by default: the router builds Jupiter replacements, so other aggregators’ order flow is a cross-router counterfactual a run asks for deliberately. Parsed from one comma-separated string so a flag or an env var carries the set.
RerouteFilter
Restricts which detected swaps are re-quoted. A transaction is rerouted when at least one of its swaps trades a listed pair; the rest replay unchanged, counted as swaps_filtered.
RerouteParams
Re-quoting historical swaps through the metis router: each admitted swap is re-quoted and the routed transaction is simulated just before the original executes — never committed, so the replay is unaffected. Each simulation reads the state of the batch its original belonged to; reroutes never observe one another.
RerouteStatsReport
High-level funnel for a reroute-order-flow session: how many detected swaps made it from re-quoting through simulation to a non-reverting execution, and — for a run carrying a DirectFillTemplate list — how many hops each template priced. Per-swap economics and latency are session-internal and land in the analysis DB.
ScheduledAction
A sequence of transactions the server runs automatically during a backtest, with results streamed over the actionSubscribe subscription. Under feeds_reroute the state it ends with also reaches the session’s override schedule, which every simulation surface reads — reroute candidates and later scheduled actions alike. An action carrying only account_overrides is purely declarative: it contributes to that schedule with or without the flag, and emits no result.
SequencedResponse
Wire format wrapper for responses sent over the control websocket. Sessions with disconnect_timeout_secs > 0 use this to track client position.
SessionId
Identifies one backtest session.
SessionSummary
Summary of transaction execution statistics for a completed backtest session.
SlotRange
An inclusive [start, end] slot range. Construct via SlotRange::new, which rejects an inverted range, or SlotRange::new_unchecked where the ordering is already guaranteed by the caller.
SnapshotSlotResponse
Response of the management /snapshot-slot endpoint. The chosen source and import state are internal, so only the resolved slot is exposed.
TxMatchContext
Per-transaction facts a DiscoveryFilter can inspect when deciding whether to match. Callers build this once per transaction and feed it to every registered filter; new variants add fields here rather than growing the DiscoveryFilter::matches signature.

Enums§

ActionAnchor
Where a ScheduledAction fires.
ActionKind
How an action’s transactions run. Only meaningful for an action that carries transactions: one that carries none is a schedule entry for account_overrides.
BacktestError
Error variants surfaced to backtest RPC clients.
BacktestRequest
Backtest RPC methods exposed to the client.
BacktestResponse
Responses returned over the backtest RPC channel.
BacktestStatus
High-level progress states during a Continue call.
BinaryEncoding
Supported binary encodings for account/transaction payloads.
BundleBuildStatus
BundleKind
What a bundle build produces.
CreateBacktestSessionRequest
Versioned payload for CreateBacktestSession.
DepthSource
Which side of a venue a depth run measures.
DiagnosticProbeError
DiscoveryFilter
A filter registered at session creation describing which upcoming batches the session should announce ahead of execution via BacktestResponse::DiscoveryBatch (and its session-event twins). Each filter describes an event of interest (e.g. a specific program executing); the session “discovers” the batch in which that event will occur and emits a DiscoveryBatch so the client can pause immediately before it.
FailFastDivergenceKind
What counts as a “non-benign” divergence for the backtest session fail-fast behaviour (see BacktestSessionOptions::fail_fast).
JobKind
Which user-triggered job a stored request belongs to.
ParseAggregatorError
RangeScope
Who a listed range is available to.
SessionEventKind
SessionType
How a session is being used, derived from its creation params.
SwapAggregator
A router whose historical swaps a session can re-quote. The wire spelling; the session maps each onto its own aggregator type.

Constants§

MAX_DIAGNOSTIC_MARKETS
MAX_DIAGNOSTIC_USD_VALUES
MAX_DISCONNECT_TIMEOUT_SECS
Server-side ceiling on CreateSessionParams::disconnect_timeout_secs: 900 seconds (15 minutes). A larger request is silently clamped to this, so clients must keep their reconnect budget under it to survive a detach.
REPLAY_RANGE_ADVICE
Why a replayed range has to begin where a recording does. Shared so the splitter’s refusal and the service’s single-session refusal cannot drift apart.

Functions§

decode_account_modifications
Decode account modifications into engine override form, rejecting executable/program accounts (cached bytecode makes program-code overrides stale).
split_range
Split a user-requested [start_slot, end_slot] range across the available bundle ranges, returning a list of contiguous, non-overlapping (start, end) pairs — one per bundle that the server can serve as its own session.