Skip to main content

BacktestRequest

Enum BacktestRequest 

Source
pub enum BacktestRequest {
    CreateBacktestSession(CreateBacktestSessionRequest),
    Continue(ContinueParams),
    ContinueTo(ContinueToParams),
    ContinueSessionV1(ContinueSessionRequestV1),
    ContinueToSessionV1(ContinueToSessionRequestV1),
    CloseBacktestSession,
    CloseSessionV1(CloseSessionRequestV1),
    AttachBacktestSession {
        session_id: SessionId,
        last_sequence: Option<u64>,
    },
    ResumeAttachedSession,
    AttachParallelControlSessionV2 {
        control_session_id: ControlSessionId,
        last_sequences: BTreeMap<SessionId, u64>,
    },
}
Expand description

A request you send on the session control channel.

Serialized as {"method": "<variantName>", "params": …}; a variant without data has no params. Fields declared on a variant itself are snake_case on the wire.

use simulator_api::{BacktestRequest, ContinueParams};

let next = BacktestRequest::Continue(ContinueParams {
    advance_count: 10,
    ..ContinueParams::default()
});
assert_eq!(
    serde_json::to_string(&next)?,
    r#"{"method":"continue","params":{"advanceCount":10,"transactions":[],"modifyAccountStates":{}}}"#,
);

Variants§

§

CreateBacktestSession(CreateBacktestSessionRequest)

createBacktestSession: start a session, or a parallel run.

§

Continue(ContinueParams)

continue: execute the next blocks of a single session.

§

ContinueTo(ContinueToParams)

continueTo: run a single session up to a slot, or to just before a batch in it.

§

ContinueSessionV1(ContinueSessionRequestV1)

continueSessionV1: Self::Continue for one session of a parallel run.

§

ContinueToSessionV1(ContinueToSessionRequestV1)

continueToSessionV1: Self::ContinueTo for one session of a parallel run.

§

CloseBacktestSession

closeBacktestSession: end the session; the server replies success and closes the connection. On a parallel run it ends every session and closes the connection without a reply.

§

CloseSessionV1(CloseSessionRequestV1)

closeSessionV1: end one session of a parallel run.

§

AttachBacktestSession

attachBacktestSession: reattach to a single session after the connection dropped. The server replies sessionAttached, replays what you missed, then waits for Self::ResumeAttachedSession.

Fields

§session_id: SessionId

The session to reattach to, from sessionCreated.

§last_sequence: Option<u64>

The last sequence number (seqId) you received. The server replays every response after it; None replays everything it still holds.

§

ResumeAttachedSession

resumeAttachedSession: sent after reattaching and rebuilding your subscriptions. The session stays paused until you send it.

§

AttachParallelControlSessionV2

attachParallelControlSessionV2: reattach to a parallel run. The server replies parallelSessionAttachedV2 and replays each session’s missed events. No resume is needed.

Fields

§control_session_id: ControlSessionId

The parallel run to reattach to, from sessionsCreatedV2.

§last_sequences: BTreeMap<SessionId, u64>

The last per-session seq_id you received, by session. The server replays each session’s events after it; a session left out replays everything the server still holds for it.

Trait Implementations§

Source§

impl Debug for BacktestRequest

Source§

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

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

impl<'de> Deserialize<'de> for BacktestRequest

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 Serialize for BacktestRequest

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> 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, 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