Class BacktestWorkflow

java.lang.Object
com.qtsurfer.api.sdk.workflows.BacktestWorkflow

public final class BacktestWorkflow extends Object
  • Constructor Details

    • BacktestWorkflow

      public BacktestWorkflow(StrategyCompileClient strategyClient, com.qtsurfer.api.client.api.BacktestingApi backtestingApi, Executor executor)
  • Method Details

    • compile

      public CompletableFuture<Strategy> compile(String source, BacktestOptions opts)
      Compile a strategy (synchronous on the wire) and return its handle.
    • submitExecution

      public CompletableFuture<Backtest> submitExecution(Strategy strategy, BacktestRequest req, BacktestOptions opts)
      Prepare + submit execute for the given strategy. Returns a Backtest once the execute request has been accepted; polling of the execution continues in the background to feed progress events and resolve Backtest.await().
    • runFull

      public CompletableFuture<com.qtsurfer.api.client.model.ResultMap> runFull(BacktestRequest req, BacktestOptions opts)
      v0.1-compat shortcut: compile + prepare + execute + await, as a single future.
    • readResult

      public BacktestOutcome readResult(String exchangeId, String jobId)
      Read an execute job's result as the platform holds it right now, without running or re-running anything.

      Classified through BacktestOutcomes, which applies the same StatusNormalizer rule this class's own poll stops on: the read and the poll agree on what a status means because they ask the same question of the same helper.

      Nothing here raises for a run that ended badly. The poll converts FAILED and ABORTED into exceptions because a backtest(...) caller asked for a result and is not getting one; a caller who asked what happened to a job is getting an answer, so it travels in the return value.

      Parameters:
      exchangeId - the exchange the run was submitted against
      jobId - the execute job id
      Returns:
      what the platform has to say about the run
      Throws:
      QTSError - on HTTP 4xx/5xx or transport failure — a plain QTSError, not the QTSExecutionError the poll raises, because nothing this read can raise is about an execution any more
    • getSweepRunEquityCurve

      public com.qtsurfer.api.client.model.EquityCurveResult getSweepRunEquityCurve(String exchangeId, String requestId, String sweepId, int runIx, com.qtsurfer.api.client.model.EquityCurveOutMode outMode, Integer resample, Boolean differential)
      Read a retained sweep trial curve without starting or polling a sweep.