Skip to main content

BacktestResponse

Enum BacktestResponse 

Source
pub enum BacktestResponse {
Show 15 variants SessionCreated { session_id: SessionId, rpc_endpoint: String, task_id: Option<String>, session_name: Option<String>, }, SessionAttached { session_id: SessionId, rpc_endpoint: String, task_id: Option<String>, session_name: Option<String>, }, SessionsCreatedV2 { control_session_id: ControlSessionId, control_session_name: Option<String>, session_ids: Vec<SessionId>, task_ids: Vec<Option<String>>, start_slots: Vec<u64>, end_slots: Vec<u64>, }, ParallelSessionAttachedV2 { control_session_id: ControlSessionId, session_ids: Vec<SessionId>, task_ids: Vec<Option<String>>, }, ReadyForContinue, SlotNotification(u64), Paused(PausedEvent), DiscoveryBatch(DiscoveryBatchEvent), Error(BacktestError), Success, Completed { summary: Option<SessionSummary>, }, Status { status: BacktestStatus, }, SessionEventV2 { session_id: SessionId, seq_id: u64, event: SessionEventKind, }, SessionGranted(SessionGrant), SessionsGranted(ParallelGrant),
}
Expand description

A response the server sends 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. Once a session runs, its responses arrive wrapped in a SequencedResponse unless disconnectTimeoutSecs is 0.

Variants§

§

SessionCreated

sessionCreated: the session exists. For a parallel run, sent once per session.

Fields

§session_id: SessionId

The session’s ID; keep it to reattach.

§rpc_endpoint: String

The session’s RPC endpoint: a path on the server’s host, /backtest/<session_id>. Prefix it with https://<host>.

§task_id: Option<String>

The server’s ID for the machine running the session. Quote it when reporting a problem.

§session_name: Option<String>

The session’s name, or the parallel run’s for a session in one.

§

SessionAttached

sessionAttached: the reply to BacktestRequest::AttachBacktestSession, with the same fields as Self::SessionCreated. The missed responses follow.

Fields

§rpc_endpoint: String
§session_name: Option<String>
§

SessionsCreatedV2

sessionsCreatedV2: every session of a parallel run exists. The lists are parallel: entry i of each describes the same session.

Fields

§control_session_id: ControlSessionId

The parallel run’s ID; keep it to reattach.

§control_session_name: Option<String>

The parallel run’s name.

§session_ids: Vec<SessionId>

One per session.

§task_ids: Vec<Option<String>>

As task_id in Self::SessionCreated, per session.

§start_slots: Vec<u64>

Per-session start/end slots, parallel to session_ids. The server’s split is authoritative (a mid-bundle request anchors to the covering bundle), so the client binds each session to its range from here rather than re-deriving the split locally.

§end_slots: Vec<u64>

Each session’s last slot, parallel to session_ids.

§

ParallelSessionAttachedV2

parallelSessionAttachedV2: the reply to BacktestRequest::AttachParallelControlSessionV2. Each session’s missed events follow.

Fields

§control_session_id: ControlSessionId

The parallel run reattached to.

§session_ids: Vec<SessionId>
§

ReadyForContinue

readyForContinue: the session is waiting for your next continue or continueTo. Read and change state through the session’s RPC endpoint now.

§

SlotNotification(u64)

slotNotification: the slot that just executed, as a bare number in params.

§

Paused(PausedEvent)

paused: the session stopped where a continueTo asked.

§

DiscoveryBatch(DiscoveryBatchEvent)

discoveryBatch: an upcoming batch matches a CreateSessionParams::discoveries filter.

§

Error(BacktestError)

error: something failed. Check BacktestError::is_terminal to see whether the session is over.

§

Success

success: acknowledges a request with nothing else to return, such as a single session’s closeBacktestSession or resumeAttachedSession. A parallel run’s close requests get no success.

§

Completed

completed: the session replayed its last slot. Terminal.

Fields

§summary: Option<SessionSummary>

Session summary with transaction statistics. None unless the session was created with send_summary.

§

Status

status: a progress update, while the session starts and during each continue.

Fields

§

SessionEventV2

sessionEventV2: an event from one session of a parallel run.

Fields

§session_id: SessionId
§seq_id: u64

The session’s own sequence number for this event. Keep the last one per session to reattach.

§

SessionGranted(SessionGrant)

The reply to BacktestRequest::CreateBacktestSessionV2: connect to the endpoint with the token.

§

SessionsGranted(ParallelGrant)

sessionsGranted: the reply to a parallel BacktestRequest::CreateBacktestSessionV2.

Implementations§

Source§

impl BacktestResponse

Source

pub fn is_completed(&self) -> bool

Source

pub fn is_terminal(&self) -> bool

Whether the session is over: completed, or an error whose BacktestError::is_terminal is true.

Trait Implementations§

Source§

impl Clone for BacktestResponse

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 BacktestResponse

Source§

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

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

impl<'de> Deserialize<'de> for BacktestResponse

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<&str> for BacktestResponse

Source§

fn from(message: &str) -> Self

Converts to this type from the input type.
Source§

impl From<BacktestError> for BacktestResponse

Source§

fn from(error: BacktestError) -> Self

Converts to this type from the input type.
Source§

impl From<BacktestStatus> for BacktestResponse

Source§

fn from(status: BacktestStatus) -> Self

Converts to this type from the input type.
Source§

impl From<String> for BacktestResponse

Source§

fn from(message: String) -> Self

Converts to this type from the input type.
Source§

impl Serialize for BacktestResponse

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