Skip to main content

CreateSessionParams

Struct CreateSessionParams 

Source
pub struct CreateSessionParams {
    pub start_slot: u64,
    pub end_slot: u64,
    pub send_summary: bool,
    pub reroute: Option<RerouteParams>,
    pub capacity_wait_timeout_secs: Option<u16>,
    pub disconnect_timeout_secs: Option<u16>,
    pub extra_compute_units: Option<u32>,
    pub discoveries: Vec<DiscoveryFilter>,
    pub actions: Vec<ScheduledAction>,
    pub replay_account_state: bool,
    pub diagnostic_probes: Vec<DiagnosticProbeParams>,
}
Expand description

Parameters required to start a new session: the params of createBacktestSession, or the request of a CreateBacktestSessionRequestV1. Fields are camelCase on the wire.

Build one with CreateSessionParams::builder; only start_slot and end_slot are required. List the ranges you can replay with GET /available-ranges (AvailableRange).

Fields§

§start_slot: u64

First slot (inclusive) to replay. A single session must start exactly at an available range’s bundle_start_slot. A parallel run may start inside a range; its first session then starts at that range’s bundle_start_slot.

§end_slot: u64

Last slot (inclusive) to replay, at most the range’s max_bundle_end_slot.

§send_summary: bool

Send a SessionSummary with completed. Default false: completed carries none.

§reroute: Option<RerouteParams>

Reroute historical swaps. Absent: plain replay.

§capacity_wait_timeout_secs: Option<u16>

Seconds to keep retrying while the server has no capacity for a new session, before failing the create. Unset or 0: fail at once when the server is busy.

§disconnect_timeout_secs: Option<u16>

Seconds the session waits for you to reattach after the session control channel drops. Unset: 30 (900 for a parallel run). 0: the session ends with the connection and responses carry no sequence number; otherwise they are wrapped in a SequencedResponse. Clamped to MAX_DISCONNECT_TIMEOUT_SECS (900 seconds).

§extra_compute_units: Option<u32>

Extra compute units to add to each transaction’s SetComputeUnitLimit budget. Useful when replaying with an account override whose program uses more CU than the original, causing otherwise-healthy transactions to run out of budget. Only applied when a SetComputeUnitLimit instruction is already present.

§discoveries: Vec<DiscoveryFilter>

Events of interest the session should watch for. When an upcoming batch matches any filter, the server emits BacktestResponse::DiscoveryBatch (and its session-event twins) ahead of execution so the client can follow up with BacktestRequest::ContinueTo to pause before the batch. Empty: no discoveryBatch events.

§actions: Vec<ScheduledAction>

Transactions the server runs automatically during the backtest, with results streamed over actionSubscribe.

Compressed as a whole rather than per action: a per-slot schedule repeats near-identical account bytes thousands of times, and that redundancy is only visible across actions. Compressing each action alone leaves a 10k-slot schedule near the WebSocket message limit; compressing the vector takes the same schedule from ~28 MiB to ~1 MiB.

§replay_account_state: bool

Replay recorded account state for this range instead of executing its transactions, which is faster. Needs an account-state bundle for the range (BundleKind::AccountState). Nothing executes, so sending transactions, kind: send actions and transaction lookups are rejected; simulations still work.

§diagnostic_probes: Vec<DiagnosticProbeParams>

Markets to probe through the router as the session runs, streamed over diagnosticSubscribe.

Implementations§

Source§

impl CreateSessionParams

Source

pub fn builder() -> CreateSessionParamsBuilder

Create an instance of CreateSessionParams using the builder syntax

Source§

impl CreateSessionParams

Source

pub fn requires_diagnostic_endpoint(&self) -> bool

Whether the sidecar has to start the router with --enable-diagnostic. A rerouting session asks for the same endpoint through an operator variable the sidecar inherits; probes are a session parameter, so they have to ask through the launch spec.

Source

pub fn validate_diagnostic_probes(&self) -> Result<(), DiagnosticProbeError>

Checks every Self::diagnostic_probes entry, as the server does.

Source

pub fn validate_action_resolvers(&self) -> Result<(), ActionResolveError>

Checks every action’s resolver; see validate_resolvers.

Source

pub fn reroute_order_flow(&self) -> bool

Whether the session reroutes swaps, that is whether Self::reroute is set.

Source

pub fn reroute_filter(&self) -> Option<&RerouteFilter>

The mint pairs rerouting is restricted to, if the session named any.

Trait Implementations§

Source§

impl Clone for CreateSessionParams

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CreateSessionParams

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CreateSessionParams

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<CreateSessionParams> for CreateBacktestSessionRequest

Source§

fn from(value: CreateSessionParams) -> Self

Converts to this type from the input type.
Source§

impl Serialize for CreateSessionParams

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V