@qtsurfer/api-client
    Preparing search index...

    Function prepareBacktest

    • Prepare backtest data Enqueues a prepare task over the requested date range. Returns immediately with a jobId; poll GET /backtest/{exchangeId}/{type}/prepare/{jobId} for completion.

      The same params always return the same jobId (idempotent). Repeated calls with identical params do not enqueue duplicate work — they reuse the existing job.

      Every source in DataSourceType can be prepared, but not every one can then be run: funding data can be prepared and is rejected by execute and executeSweep. A kline prepare takes the bar width from cadence — see PrepareRequest.

      The cadence of an exchange's data is held to your plan: the "Cadences by plan" section of the Backtests guide lists the cadences each plan includes. A cadence your plan does not include is 402, and a request that names none gets the plan's default. The 202 says the cadence in effect. None of this applies to exchangeId: user: your own data is prepared at its own cadence, whatever the plan.

      exchangeId: user is reserved for your own uploaded data. Instead of a managed exchange, it prepares from a dataset you created via POST /datasets (see the Dataset endpoints) — send datasetId in place of instrument. See PrepareRequest below for the two request shapes. A ticker prepare takes any dataset; a kline prepare takes a dataset whose type is klines (its rows are the bars, at its own cadence or a coarser exact multiple of it) and is 400 over any other, naming the dataset's type. The type that counts is the one of the version the prepare reads (the current one, or the one datasetVersionId pins), and it is read from the data: a file of candles is klines.

      Type Parameters

      • ThrowOnError extends boolean = false

      Returns RequestResult<PrepareAccepted, PrepareBacktestError, ThrowOnError>