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
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: ControlSessionIdThe parallel run to reattach to, from sessionsCreatedV2.