pub enum BacktestResponse {
Show 13 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,
},
}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
rpc_endpoint: StringThe session’s RPC endpoint: a path on the server’s host, /backtest/<session_id>.
Prefix it with https://<host>.
SessionAttached
sessionAttached: the reply to BacktestRequest::AttachBacktestSession, with the
same fields as Self::SessionCreated. The missed responses follow.
Fields
session_id: SessionIdAs in Self::SessionCreated.
rpc_endpoint: StringAs in Self::SessionCreated.
task_id: Option<String>As in Self::SessionCreated.
session_name: Option<String>As in Self::SessionCreated.
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: ControlSessionIdThe parallel run’s ID; keep it to reattach.
task_ids: Vec<Option<String>>As task_id in Self::SessionCreated, per session.
ParallelSessionAttachedV2
parallelSessionAttachedV2: the reply to
BacktestRequest::AttachParallelControlSessionV2. Each session’s missed events follow.
Fields
control_session_id: ControlSessionIdThe parallel run reattached to.
task_ids: Vec<Option<String>>As in Self::SessionsCreatedV2.
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
status: BacktestStatusSessionEventV2
sessionEventV2: an event from one session of a parallel run.
Implementations§
Source§impl BacktestResponse
impl BacktestResponse
pub fn is_completed(&self) -> bool
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Whether the session is over: completed, or an error whose
BacktestError::is_terminal is true.