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>,
    },
    CreateBacktestSessionV2(CreateBacktestSessionRequestV1),
}
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.

§

CreateBacktestSessionV2(CreateBacktestSessionRequestV1)

As createBacktestSession, but the client then uses the session’s own endpoint. The reply is sessionGranted, or sessionsGranted when parallel is set.

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§

§

impl Forget for BacktestRequest

§

impl Freeze for BacktestRequest
where *const LeafNode<SwapAggregator, SetValZST> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(SwapAggregator, SetValZST)>>: Freeze, *const LeafNode<SwapScope, SetValZST> is !null: Freeze, PhantomData<Box<(SwapScope, SetValZST)>>: Freeze, *const LeafNode<MintPair, SetValZST> is !null: Freeze, PhantomData<Box<(MintPair, SetValZST)>>: Freeze, *const u8 is !null: Freeze, PhantomData<VenueTemplate>: Freeze, *const LeafNode<Address, SetValZST> is !null: Freeze, PhantomData<Box<(Address, SetValZST)>>: Freeze, PhantomData<DiscoveryFilter>: Freeze, PhantomData<ScheduledAction>: Freeze, PhantomData<DiagnosticProbeParams>: Freeze, PhantomData<u8>: Freeze, PhantomData<String>: Freeze, *const LeafNode<Address, AccountData> is !null: Freeze, PhantomData<Box<(Address, AccountData)>>: Freeze, *const LeafNode<SessionId, u64> is !null: Freeze, PhantomData<Box<(SessionId, u64)>>: Freeze,

§

impl Move for BacktestRequest

§

impl RefUnwindSafe for BacktestRequest

§

impl Send for BacktestRequest
where NodeRef<Owned, SwapAggregator, SetValZST, LeafOrInternal>: Send, BoxRaw<(SwapAggregator, SetValZST)>: Send, NodeRef<Owned, SwapScope, SetValZST, LeafOrInternal>: Send, BoxRaw<(SwapScope, SetValZST)>: Send, NodeRef<Owned, MintPair, SetValZST, LeafOrInternal>: Send, BoxRaw<(MintPair, SetValZST)>: Send, RawVecInner: Send, NodeRef<Owned, Address, SetValZST, LeafOrInternal>: Send, BoxRaw<(Address, SetValZST)>: Send, NonZero<u64>: Send, NodeRef<Owned, Address, AccountData, LeafOrInternal>: Send, BoxRaw<(Address, AccountData)>: Send, NodeRef<Owned, SessionId, u64, LeafOrInternal>: Send, BoxRaw<(SessionId, u64)>: Send,

§

impl Sync for BacktestRequest
where NodeRef<Owned, SwapAggregator, SetValZST, LeafOrInternal>: Sync, BoxRaw<(SwapAggregator, SetValZST)>: Sync, NodeRef<Owned, SwapScope, SetValZST, LeafOrInternal>: Sync, BoxRaw<(SwapScope, SetValZST)>: Sync, NodeRef<Owned, MintPair, SetValZST, LeafOrInternal>: Sync, BoxRaw<(MintPair, SetValZST)>: Sync, RawVecInner: Sync, NodeRef<Owned, Address, SetValZST, LeafOrInternal>: Sync, BoxRaw<(Address, SetValZST)>: Sync, NonZero<u64>: Sync, NodeRef<Owned, Address, AccountData, LeafOrInternal>: Sync, BoxRaw<(Address, AccountData)>: Sync, NodeRef<Owned, SessionId, u64, LeafOrInternal>: Sync, BoxRaw<(SessionId, u64)>: Sync,

§

impl Unpin for BacktestRequest
where *const LeafNode<SwapAggregator, SetValZST> is !null: Unpin, Box<(SwapAggregator, SetValZST)>: Unpin, *const LeafNode<SwapScope, SetValZST> is !null: Unpin, Box<(SwapScope, SetValZST)>: Unpin, *const LeafNode<MintPair, SetValZST> is !null: Unpin, Box<(MintPair, SetValZST)>: Unpin, *const u8 is !null: Unpin, *const LeafNode<Address, SetValZST> is !null: Unpin, Box<(Address, SetValZST)>: Unpin, NonZero<u64>: Unpin, *const LeafNode<Address, AccountData> is !null: Unpin, Box<(Address, AccountData)>: Unpin, *const LeafNode<SessionId, u64> is !null: Unpin, Box<(SessionId, u64)>: Unpin,

§

impl UnsafeUnpin for BacktestRequest

§

impl UnwindSafe for BacktestRequest

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