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

    Function importDataset

    • Create a dataset by importing history instead of uploading it A second way to get data into a dataset, alongside POST /datasets: instead of PUTting a file yourself, ask the API to go fetch history on your behalf. Creates the dataset and starts the fetch in the same call — there is no separate upload step, and the result lands as a dataset version indistinguishable from an uploaded one once it's ready. Poll GET /datasets/{datasetId}/imports/{importId} for progress.

      type selects the kind of venue the history comes from, with the same two values as the venueType of GET /exchanges: dex — history over a pool/pair's own on-chain market — and cex — the history of a centralized exchange's market, kept by the platform. Each has its own block (dex, cex). The exchange id of a cex import has to be a centralized exchange of GET /exchanges; a decentralized one (robinhood, say) is 400, and is imported with type: dex.

      A cex import covers one instrument over a range: the API reads that range of the exchange's history, builds the bars of the requested cadence from the finest data it has for it, and stores the result as a dataset version, exactly as for an upload. cex.dataType picks tickers or klines and is also the resulting dataset's type. The range is capped by your tier like any import (maxImportRangeHours of GET /account).

      An import is held to your plan's cadences, the same ones as the preparation of an exchange's data (the "Cadences by plan" section of the Backtests guide). A cadence your plan does not include is 402; a request that names none gets the plan's default; any other cadence your plan includes can be asked for. The 202 says the cadence the dataset is built at. An upload is not held to this: it is stored at the cadence detected in it.

      A dex import has two data shapes:

      • Candles at the cadence you ask for, or at the plan's default when you ask for none. Every cadence of the list is built, from the nearest width the source serves. The resulting dataset's type is klines, not ticker, and dex.id / dex.version are not needed. Not every network supports candles yet — an unsupported combination fails asynchronously, same as an unresolvable pool (see the failed status on the poll endpoint below).
      • On-chain swap history (per-trade data), replayed directly from the pool/pair's own chain — only on a plan that includes the native rate of a source, and when cadence is omitted. Cadence is native, not resampled: each swap keeps the timestamp it happened at rather than being bucketed into candles, so the resulting version's cadence is rt unless the swaps happen to sit on a fixed grid (see DatasetVersion.cadence). Needs dex.id and dex.version.

      Type Parameters

      • ThrowOnError extends boolean = false

      Parameters

      Returns RequestResult<DatasetImportCreated, ImportDatasetError, ThrowOnError>