@qtsurfer/api-client 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,11 @@ export type ResponseError = {
14
14
  message: string;
15
15
  };
16
16
 
17
+ /**
18
+ * A scalar strategy property value for one execution.
19
+ */
20
+ export type ScalarStrategyParamValue = number | string | boolean;
21
+
17
22
  /**
18
23
  * Exchange instrument identifier (e.g. a currency pair)
19
24
  */
@@ -223,29 +228,22 @@ export type PrepareRequest = {
223
228
  */
224
229
  to: string;
225
230
  /**
226
- * Output bar cadence for the prepared range. Defaults to the publisher's
227
- * native cadence (`1s`); coarser cadences are produced on demand via
228
- * resampling and stored alongside the native blob in cache. Coarser-than-
229
- * source values must be exact multiples of the source cadence — invalid
230
- * labels return `400`.
231
- *
232
- */
233
- cadence?:
234
- | "1s"
235
- | "5s"
236
- | "1m"
237
- | "3m"
238
- | "5m"
239
- | "15m"
240
- | "30m"
241
- | "1h"
242
- | "2h"
243
- | "4h"
244
- | "8h"
245
- | "12h"
246
- | "1d"
247
- | "1w"
248
- | "1q";
231
+ * Output bar cadence for the prepared range. Coarser cadences are produced on demand by
232
+ * resampling the source and stored alongside the native blob in cache. A target finer
233
+ * than the source, or not an exact multiple of it, returns `400`. What's accepted, and
234
+ * what omitting it means, depends on the source:
235
+ *
236
+ * * Managed exchange — one of `1s`, `5s`, `1m`, `3m`, `5m`, `15m`, `30m`, `1h`, `2h`,
237
+ * `4h`, `8h`, `12h`, `1d`, `1w`, `1q`; any other label returns `400`. Omitted = `1s`,
238
+ * the publisher's native cadence.
239
+ * * Dataset (`exchangeId: user`) — omitted = the dataset version's own discovered
240
+ * `cadence` (see `DatasetVersion.cadence`), served as-is. Any cadence equal to or
241
+ * coarser than it and an exact multiple of it is accepted, including ones outside the
242
+ * managed-exchange list (e.g. `15s`); an `rt` dataset can be resampled to any fixed
243
+ * cadence.
244
+ *
245
+ */
246
+ cadence?: string;
249
247
  };
250
248
 
251
249
  /**
@@ -260,7 +258,8 @@ export type JobState = {
260
258
  * Current status of the job. Treat `Completed | Aborted | Failed` as
261
259
  * terminal; `New | Started` mean keep polling. A single-instrument prepare
262
260
  * is always terminal (`Completed`) — decide from
263
- * `PrepareJobState.coverageRatio`, not by polling.
261
+ * `PrepareJobState.coverageRatio` (or `dataFrom`/`dataTo` against an `rt` dataset,
262
+ * which has no ratio), not by polling.
264
263
  *
265
264
  */
266
265
  status: "New" | "Started" | "Completed" | "Aborted" | "Failed";
@@ -298,8 +297,10 @@ export type JobState = {
298
297
  * dataset-backed prepare (`exchangeId: user`), coverage is reported on the dataset's own
299
298
  * cadence grid instead — hour-walking a daily dataset would report `1/24` and read as
300
299
  * broken — via `cadence`/`gaps`/`largestGapSteps`; `totalHours`/`hoursWithData`/
301
- * `hoursWithoutData` are absent in that case. `dataFrom`/`dataTo`/`coverageRatio` are present
302
- * either way, computed accordingly.
300
+ * `hoursWithoutData` are absent in that case. `dataFrom`/`dataTo` are present either way, and
301
+ * `coverageRatio` too, computed accordingly — except against a dataset whose `cadence` is `rt`:
302
+ * with no fixed step there is no expected row count to measure against, so `coverageRatio`
303
+ * is absent and `gaps`/`largestGapSteps` are `0`.
303
304
  *
304
305
  */
305
306
  export type PrepareJobState = JobState & {
@@ -316,7 +317,8 @@ export type PrepareJobState = JobState & {
316
317
  * `totalHours` is 0), the fraction of hours in the requested range that have served
317
318
  * data. Against a dataset (`exchangeId: user`): `rows / expectedStepsAtCadence`
318
319
  * over the dataset version's own range — echoing what ingest computed once, not
319
- * recomputed against a narrower prepare request.
320
+ * recomputed against a narrower prepare request. Absent for an `rt` dataset (no
321
+ * fixed step, so no expected row count).
320
322
  *
321
323
  */
322
324
  coverageRatio?: number;
@@ -333,20 +335,21 @@ export type PrepareJobState = JobState & {
333
335
  */
334
336
  hoursWithData?: number;
335
337
  /**
336
- * The dataset version's own discovered cadence (e.g. `1m`, `1h`). Only present for a
337
- * dataset-backed prepare (`exchangeId: user`).
338
+ * The dataset version's own discovered cadence — a fixed grid (e.g. `1m`, `1h`) or
339
+ * `rt` (see `DatasetVersion.cadence`). Only present for a dataset-backed prepare
340
+ * (`exchangeId: user`).
338
341
  *
339
342
  */
340
343
  cadence?: string;
341
344
  /**
342
345
  * Number of gaps in the dataset version at its own cadence, as discovered at ingest
343
- * time. Only present for a dataset-backed prepare.
346
+ * time. `0` for `rt`. Only present for a dataset-backed prepare.
344
347
  *
345
348
  */
346
349
  gaps?: number;
347
350
  /**
348
- * The largest gap in the dataset version, in units of its own cadence step. Only
349
- * present for a dataset-backed prepare.
351
+ * The largest gap in the dataset version, in units of its own cadence step. `0` for
352
+ * `rt`. Only present for a dataset-backed prepare.
350
353
  *
351
354
  */
352
355
  largestGapSteps?: number;
@@ -568,7 +571,7 @@ export type SweepRunRow = {
568
571
  */
569
572
  neighbourCount?: number;
570
573
  /**
571
- * Probability that this run's Sharpe reflects real edge rather than the best draw from however many parameter vectors were tried. Above ~0.95 the result survives the multiple-testing correction; near 0.5 or below it is indistinguishable from the best of a pile of coin flips. Absent on aborted runs, and on sweeps with too few trials to establish any dispersion to deflate against.
574
+ * Probability that this run's Sharpe reflects real edge rather than the best draw from however many parameter vectors were tried. Above ~0.95 the result survives the multiple-testing correction; near 0.5 or below it is indistinguishable from the best of a pile of coin flips. Absent on aborted runs, on sweeps with too few trials to establish any dispersion to deflate against, on runs with fewer than 3 period returns, and on a degenerate (near-constant) return series — all cases where the underlying statistic isn't meaningfully computable, rather than genuinely zero. A present value is the computed probability, however small.
572
575
  */
573
576
  deflatedSharpe?: number;
574
577
  params: {
@@ -601,7 +604,10 @@ export type SweepRunRow = {
601
604
  aborted: boolean;
602
605
  runtimeMs: number;
603
606
  /**
604
- * Present only when this trial's curve was selected (`equityCurve.mode` was `topN`/`topPct` on the request, and this row ranked among the winners) — absent, not null, otherwise; a run that was never spilled and one that was spilled but not selected look identical here. Always a pointer today (`url` present, no inline points): a sweep's curves live in a spill store, not the response, until fetched separately. `GET` the `url` to fetch the curve itself; its own `meta` there is the real, possibly size-guarded outcome, while this outer `meta` is a raw, untransformed preview from selection time and can differ.
607
+ * Present whenever this trial actually has a curve — which is any completed run of a sweep that requested curves at all (`equityCurve.mode` `topN`/`topPct`), not only the ranked winners. Absent, not null, when there is genuinely nothing: the run aborted, it made no trades, or the sweep never retained curves (`mode` `auto`/`none`).
608
+ * Selection decides how the curve travels, not whether it exists. A row may carry `url` alone, or `url` together with the points inline.
609
+ * **Read `points`/`equities` to tell whether the curve is inline — never the presence of this object, and never the absence of `url`.** Both mislead, and in opposite directions: this object is present on rows that carry only a pointer, and `url` stays present alongside an inline curve so a caller can still re-request a different transform. An inline curve is emitted on the materialisation view (`?order=natural`), where each row is read once; the ranked view keeps the pointer, being polled.
610
+ * When only a pointer is present, `GET` the `url` for the curve. Its own `meta` there is the real, possibly size-guarded outcome. This outer `meta` may be a declaration rather than a measurement — for a row whose curve was not promoted, the point count is derived from the trade count (one equity point per closed trade) instead of being read from the store, to keep a polled response from doing per-row work.
605
611
  */
606
612
  equityCurve?: EquityCurveResult;
607
613
  };
@@ -707,7 +713,8 @@ export type ExecuteSweepResult = {
707
713
  * The same `JobState` shape a single-execute `BacktestJobResult` carries — not a sweep-specific lookalike, the actual type, so field names and timestamp formatting match exactly.
708
714
  * `state.status` uses `JobState`'s own vocabulary (`New`/`Started`/`Completed`/ `Aborted`/`Failed`), mapped from the sweep's `status` field above rather than copying it: `PARTIAL` and `CANCELLED` both map to `Aborted`, because a sweep's `PARTIAL` is already terminal (some shards finished, some failed, nothing more is coming) unlike a single job's non-terminal `Partial`, which has no equivalent here at all.
709
715
  * `state.completed` is real ticks processed on a plain sweep. On a `walkForward` sweep it is currently always `0` — the walk-forward fold runner was not wired to count ticks when this shipped, unlike the plain shard path.
710
- * `state.size` is always `0` on every path (single execute, plain sweep, walk-forward alike) — nothing populates it anywhere yet. That is a known gap across the whole API, not a sweep-specific omission.
716
+ * `state.size` is an upfront estimate — range x the prepare's target cadence, set before any data is even loaded, not a query against loaded data — on a single execute and a plain sweep alike. A plain sweep's value is the sum of every shard's own `size` (each shard's per-run estimate x its own vector slice), the same additive shape `state.completed` already used above. `0` means the prepare context behind the job predates this field (a job whose prepare ran before the estimate existed) — never a guessed cadence standing in for a real one.
717
+ * On a `walkForward` sweep, `state.size` is still always `0`: fold runs were out of scope for the estimate the same way they are for `state.completed` above — a fold's `size` is simply never set, so the sum stays honest at `0` rather than needing a special case.
711
718
  */
712
719
  state: JobState;
713
720
  };
@@ -882,7 +889,7 @@ export type ResultMap = {
882
889
  * The strategy properties this run was given, echoed back as sent. Absent when the request carried none, so its presence is what distinguishes a parameterised run from one at the declared defaults — a stored result cannot otherwise say which vector produced it, and this endpoint is meant to be called repeatedly over one prepare.
883
890
  */
884
891
  params?: {
885
- [key: string]: number | string | boolean;
892
+ [key: string]: ScalarStrategyParamValue;
886
893
  };
887
894
  /**
888
895
  * Number of signals emitted during strategy execution
@@ -1173,9 +1180,12 @@ export type Dataset = {
1173
1180
  */
1174
1181
  name: string;
1175
1182
  /**
1176
- * Always `ticker` in v1.
1183
+ * `ticker` for an upload or a `dex` import with no `cadence` requested (native per-trade
1184
+ * data). `klines` for a `dex` import that requested a candle `cadence` — pre-aggregated
1185
+ * bars rather than raw ticks. Purely informational; both shapes are read the same way.
1186
+ *
1177
1187
  */
1178
- type: "ticker";
1188
+ type: "ticker" | "klines";
1179
1189
  instrument: Instrument;
1180
1190
  /**
1181
1191
  * When the dataset was created.
@@ -1204,8 +1214,8 @@ export type Dataset = {
1204
1214
  */
1205
1215
  to?: string;
1206
1216
  /**
1207
- * `currentVersionId`'s own discovered bar cadence (e.g. `1s`, `1m`, `1h`). Absent until a
1208
- * version exists.
1217
+ * `currentVersionId`'s own discovered cadence — a fixed grid (e.g. `1s`, `1m`, `1h`) or
1218
+ * `rt` (see `DatasetVersion.cadence`). Absent until a version exists.
1209
1219
  *
1210
1220
  */
1211
1221
  cadence?: string;
@@ -1215,6 +1225,23 @@ export type Dataset = {
1215
1225
  * A `Dataset` plus a self link. Returned by `GET /datasets/{datasetId}`.
1216
1226
  */
1217
1227
  export type DatasetWithLinks = Dataset & {
1228
+ /**
1229
+ * Presigned GET URL to the current version's stored file — see `dataFormat` for
1230
+ * which format it's actually in. Present only once the current version's status is
1231
+ * `ready`. Long-lived (day-scale, not permanent): a DuckDB-WASM/`lastra-ts`-style
1232
+ * reader issues HTTP range requests against it lazily over an extended viewing
1233
+ * session, not in one shot like a browser upload.
1234
+ *
1235
+ */
1236
+ dataUrl?: string;
1237
+ /**
1238
+ * Which format `dataUrl` is actually in — check this rather than assuming it
1239
+ * matches how you uploaded it. `lastra` — our native columnar format — for a CSV (or
1240
+ * gzip/zip of one) upload, always converted on ingest. `parquet` for a parquet
1241
+ * upload, stored as-is today.
1242
+ *
1243
+ */
1244
+ dataFormat?: "lastra" | "parquet";
1218
1245
  _links?: {
1219
1246
  self?: {
1220
1247
  href?: string;
@@ -1227,8 +1254,9 @@ export type DatasetWithLinks = Dataset & {
1227
1254
  */
1228
1255
  export type DatasetUploadTarget = {
1229
1256
  /**
1230
- * Presigned URL. `PUT` the raw CSV file here directly — no `Authorization` header,
1231
- * no other API credentials.
1257
+ * Presigned URL. `PUT` the file here directly — the CSV or parquet itself, or a `.gz`/`.zip` of it
1258
+ * (see `createDataset`'s own description) — no `Authorization` header, no other API
1259
+ * credentials.
1232
1260
  *
1233
1261
  */
1234
1262
  url: string;
@@ -1289,7 +1317,7 @@ export type DatasetVersion = {
1289
1317
  */
1290
1318
  id?: string;
1291
1319
  /**
1292
- * Size of the uploaded file.
1320
+ * Size of the stored file `dataUrl` points at — a converted `lastra` for a CSV/gzip/zip upload, or the parquet file itself, unconverted, for a parquet upload. Not the size of the bytes originally PUT to storage; see `dataFormat`.
1293
1321
  */
1294
1322
  bytes?: number;
1295
1323
  /**
@@ -1297,7 +1325,13 @@ export type DatasetVersion = {
1297
1325
  */
1298
1326
  rows?: number;
1299
1327
  /**
1300
- * The discovered bar cadence (e.g. `1s`, `1m`, `1h`).
1328
+ * The cadence discovered from the data's own timestamps. Either a fixed grid — `1s`,
1329
+ * `5s`, `15s`, `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1d` — when at least half the
1330
+ * intervals between consecutive rows fall on that step (small clock jitter tolerated), or
1331
+ * `rt`: native data at the rate it was captured, each row at its own timestamp with no
1332
+ * fixed step — per-trade on-chain swaps, block-spaced or sub-second ticks, irregular
1333
+ * intervals. An `rt` dataset can be resampled to any fixed cadence at prepare time.
1334
+ *
1301
1335
  */
1302
1336
  cadence?: string;
1303
1337
  /**
@@ -1307,17 +1341,33 @@ export type DatasetVersion = {
1307
1341
  */
1308
1342
  timestampUnit?: "iso" | "s" | "ms" | "us";
1309
1343
  /**
1310
- * Number of gaps at the discovered cadence.
1344
+ * Number of gaps at the discovered cadence. Always `0` for `rt`.
1311
1345
  */
1312
1346
  gaps?: number;
1313
1347
  /**
1314
- * The largest gap, in units of the discovered cadence step.
1348
+ * The largest gap, in units of the discovered cadence step. Always `0` for `rt`.
1315
1349
  */
1316
1350
  largestGapSteps?: number;
1351
+ /**
1352
+ * Presigned GET URL to the stored file — see `dataFormat` for which format it's in.
1353
+ * Present once the version is `ready`. Long-lived (day-scale, not permanent): a
1354
+ * DuckDB-WASM/`lastra-ts`-style reader issues HTTP range requests against it lazily over
1355
+ * an extended viewing session, not in one shot like a browser upload.
1356
+ *
1357
+ */
1358
+ dataUrl?: string;
1359
+ /**
1360
+ * Which format `dataUrl` is actually in — check this rather than assuming it matches
1361
+ * how you uploaded it. `lastra` — our native columnar format — for a CSV (or gzip/zip
1362
+ * of one) upload, always converted on ingest. `parquet` for a parquet upload, stored
1363
+ * as-is today.
1364
+ *
1365
+ */
1366
+ dataFormat?: "lastra" | "parquet";
1317
1367
  };
1318
1368
 
1319
1369
  /**
1320
- * Progress of one upload, from staged through ingest. Postgres-backed once a version exists,
1370
+ * Progress of one upload, from staged through ingest. Durably recorded once a version exists,
1321
1371
  * so `ready`/`failed` are permanent answers; `uploading`/`ingesting` reflect in-flight state
1322
1372
  * that can itself age out — see the `404` case on `GET .../uploads/{uploadId}`.
1323
1373
  *
@@ -1329,7 +1379,8 @@ export type DatasetUploadState = {
1329
1379
  * called yet.
1330
1380
  * * `ingesting` — `finalize` was called; the worker is parsing and validating the file.
1331
1381
  * * `ready` — ingested successfully. `version` carries the result.
1332
- * * `failed` — ingest rejected the file (e.g. bad CSV contract, mixed timestamp units).
1382
+ * * `failed` — ingest rejected the file (e.g. bad CSV contract, mixed timestamp units, a
1383
+ * `.zip` with no file inside or more than one).
1333
1384
  *
1334
1385
  */
1335
1386
  status: "uploading" | "ingesting" | "ready" | "failed";
@@ -1337,6 +1388,154 @@ export type DatasetUploadState = {
1337
1388
  * The ingest job id, while `status` is `ingesting`.
1338
1389
  */
1339
1390
  jobId?: string;
1391
+ /**
1392
+ * A human-readable reason, present when `status` is `failed` (e.g. bad CSV contract,
1393
+ * mixed timestamp units, a `.zip` with no file inside or more than one). Durably
1394
+ * recorded alongside the failure itself, so it stays available however long after the
1395
+ * fact you poll — not tied to how recently the failure happened.
1396
+ *
1397
+ */
1398
+ error?: string;
1399
+ /**
1400
+ * Present when `status` is `ready` or `failed`.
1401
+ */
1402
+ version?: DatasetVersion;
1403
+ };
1404
+
1405
+ /**
1406
+ * `POST /datasets/imports`'s request body. A common block plus one type-specific block,
1407
+ * selected by `type` — `dex` is the only value today.
1408
+ *
1409
+ */
1410
+ export type DatasetImportRequest = {
1411
+ /**
1412
+ * A name unique among your datasets. `409` if already taken.
1413
+ */
1414
+ name: string;
1415
+ instrument: Instrument;
1416
+ /**
1417
+ * Start of the range to fetch, inclusive. Must be before `to`.
1418
+ */
1419
+ from: string;
1420
+ /**
1421
+ * End of the range to fetch, exclusive. The total span is capped by your tier — a
1422
+ * request wider than that ceiling is `400`, regardless of source type.
1423
+ *
1424
+ */
1425
+ to: string;
1426
+ /**
1427
+ * Optional. Omitted/blank keeps native per-trade event cadence — each swap at its own
1428
+ * timestamp, so the resulting version's `cadence` is `rt` unless the swaps happen to sit
1429
+ * on a fixed grid (see `DatasetVersion.cadence`). Set to `1s`, `1m` or
1430
+ * `5m` instead to get pre-aggregated candles at that width rather than raw trades (the
1431
+ * resulting dataset's `type` becomes `klines`); any other value is `400`. Not every
1432
+ * network supports every cadence — an unsupported combination fails asynchronously, not
1433
+ * at request time (see `DatasetImportState.error`).
1434
+ *
1435
+ */
1436
+ cadence?: "1s" | "1m" | "5m";
1437
+ /**
1438
+ * The source to fetch from. `dex` is the only value today.
1439
+ */
1440
+ type: "dex";
1441
+ dex?: DatasetImportDexRequest;
1442
+ };
1443
+
1444
+ /**
1445
+ * The `dex` source's own fields — required when `type` is `dex`. `id`/`version` are required
1446
+ * for a plain (native-cadence) import; both are ignored if the top-level `cadence` requested
1447
+ * pre-aggregated candles instead, since that path needs neither a protocol nor a version
1448
+ * distinction.
1449
+ *
1450
+ */
1451
+ export type DatasetImportDexRequest = {
1452
+ /**
1453
+ * Which chain the pool/pair lives on.
1454
+ */
1455
+ network: "ethereum" | "robinhood";
1456
+ /**
1457
+ * Which on-chain DEX protocol `contract` implements. Required unless the top-level
1458
+ * `cadence` requested pre-aggregated candles, in which case it's ignored.
1459
+ *
1460
+ */
1461
+ id?: "uniswap";
1462
+ /**
1463
+ * Uniswap version the pool/pair contract implements. Required unless the top-level
1464
+ * `cadence` requested pre-aggregated candles, in which case it's ignored.
1465
+ *
1466
+ */
1467
+ version?: "v2" | "v3";
1468
+ /**
1469
+ * The pool (v3) or pair (v2) contract address.
1470
+ */
1471
+ contract: string;
1472
+ /**
1473
+ * The factory that deployed `contract`. Optional — when omitted, it is discovered
1474
+ * on-chain from `contract` itself at fetch time. Supply it explicitly only if you
1475
+ * already know it, or the pool/pair belongs to a factory other than the canonical one
1476
+ * for `network`/`version`. Either way, the pool/pair is validated against whichever
1477
+ * factory is used before anything is fetched — a wrong or unrelated factory fails the
1478
+ * import rather than silently fetching from the wrong pool. Ignored if the top-level
1479
+ * `cadence` requested pre-aggregated candles.
1480
+ *
1481
+ */
1482
+ factory?: string;
1483
+ };
1484
+
1485
+ /**
1486
+ * The response to `POST /datasets/imports` — the dataset now exists, and its fetch has started.
1487
+ */
1488
+ export type DatasetImportCreated = {
1489
+ /**
1490
+ * Opaque id of the newly created dataset — same id space as `POST /datasets`.
1491
+ */
1492
+ datasetId: string;
1493
+ /**
1494
+ * Identifies this import. Pass to `GET /datasets/{datasetId}/imports/{importId}` to poll
1495
+ * it — there is no separate "finalize" step the way an upload has.
1496
+ *
1497
+ */
1498
+ importId: string;
1499
+ /**
1500
+ * The fetch/ingest job id.
1501
+ */
1502
+ jobId: string;
1503
+ /**
1504
+ * Always `fetching` in this response — the fetch has only just started.
1505
+ */
1506
+ status: "fetching";
1507
+ };
1508
+
1509
+ /**
1510
+ * Progress of one import, from fetching through ingest. `fetching` is the one status only an
1511
+ * import ever reports — an upload's file already exists by the time you can poll it; an
1512
+ * import's doesn't, until this source finishes fetching it.
1513
+ *
1514
+ */
1515
+ export type DatasetImportState = {
1516
+ importId: string;
1517
+ /**
1518
+ * * `fetching` — reading from the source; nothing staged yet.
1519
+ * * `ingesting` — fetch complete, staged, and re-entered the same ingest chain an
1520
+ * upload uses; the worker is parsing and validating it.
1521
+ * * `ready` — ingested successfully. `version` carries the result.
1522
+ * * `failed` — the fetch or the ingest that followed it was rejected. `error` names why.
1523
+ *
1524
+ */
1525
+ status: "fetching" | "ingesting" | "ready" | "failed";
1526
+ /**
1527
+ * The fetch/ingest job id, while `status` is `fetching` or `ingesting`.
1528
+ */
1529
+ jobId?: string;
1530
+ /**
1531
+ * A human-readable reason, present when `status` is `failed` — an unresolvable
1532
+ * pool/pair, no data in the requested range, a range older than the configured source
1533
+ * retains, the fetch exceeding your tier's time ceiling, or any of
1534
+ * `DatasetUploadState.error`'s own ingest-side reasons once fetching hands off to it.
1535
+ * Durably recorded, same as on the upload path.
1536
+ *
1537
+ */
1538
+ error?: string;
1340
1539
  /**
1341
1540
  * Present when `status` is `ready` or `failed`.
1342
1541
  */
@@ -1863,8 +2062,8 @@ export type PrepareBacktestErrors = {
1863
2062
  * Invalid request or parameters. Also returned when `from` is older than the configured
1864
2063
  * lookback window or `to` is in the future. For `exchangeId: user`, also returned when
1865
2064
  * the dataset's current upload has not finished ingesting, or `cadence` asks for a finer
1866
- * granularity than the dataset's own discovered cadence, or the requested range exceeds
1867
- * your tier's range limit.
2065
+ * granularity than the dataset's own discovered cadence (or one that isn't an exact
2066
+ * multiple of it), or the requested range exceeds your tier's range limit.
1868
2067
  *
1869
2068
  */
1870
2069
  400: ResponseError;
@@ -2174,6 +2373,16 @@ export type ExecuteBacktestData = {
2174
2373
  */
2175
2374
  storeSignals?: boolean;
2176
2375
  equityCurve?: EquityCurveOptions;
2376
+ /**
2377
+ * Capital/fee/position-size overrides for this one run — the same shape
2378
+ * `executeSweep`'s `baseConfig` accepts. Omit to run at the platform defaults
2379
+ * (`initialFunding: 100`, `feeRate: 0.001`). `buyFeeRate`/`sellFeeRate`/`feeLeg`
2380
+ * are accepted for shape compatibility with a sweep's `baseConfig`, but this
2381
+ * endpoint has one fee-rate slot: a value that implies asymmetric buy/sell fees,
2382
+ * or a non-default `feeLeg`, is rejected with `400`.
2383
+ *
2384
+ */
2385
+ baseConfig?: SweepBaseConfig;
2177
2386
  /**
2178
2387
  * Strategy properties to apply to this run. Omit to run the strategy's declared
2179
2388
  * defaults, which is exactly what a request without this field has always done.
@@ -2194,7 +2403,7 @@ export type ExecuteBacktestData = {
2194
2403
  *
2195
2404
  */
2196
2405
  params?: {
2197
- [key: string]: number | string | boolean;
2406
+ [key: string]: ScalarStrategyParamValue;
2198
2407
  };
2199
2408
  };
2200
2409
  path: {
@@ -2584,6 +2793,88 @@ export type GetDatasetUploadResponses = {
2584
2793
  export type GetDatasetUploadResponse =
2585
2794
  GetDatasetUploadResponses[keyof GetDatasetUploadResponses];
2586
2795
 
2796
+ export type ImportDatasetData = {
2797
+ /**
2798
+ * What to fetch, and where from
2799
+ */
2800
+ body: DatasetImportRequest;
2801
+ path?: never;
2802
+ query?: never;
2803
+ url: "/datasets/imports";
2804
+ };
2805
+
2806
+ export type ImportDatasetErrors = {
2807
+ /**
2808
+ * Invalid request; `instrument` isn't a plain spot pair; `from >= to`; `cadence` present
2809
+ * but not one of its supported values; the requested range exceeds your tier's import
2810
+ * range ceiling; the requested range's rough size estimate exceeds your tier's row limit;
2811
+ * `dex.network`/`dex.id` not one of their supported values; `dex.contract`/`dex.factory`
2812
+ * fail basic shape validation; or, when `cadence` is omitted, `dex.id`/`dex.version`
2813
+ * missing. Whether the pool/pair actually exists and resolves — and, for a candle
2814
+ * `cadence`, whether that combination is actually servable on the requested `network` —
2815
+ * is checked later, asynchronously — see the `failed` status on the poll endpoint below.
2816
+ *
2817
+ */
2818
+ 400: ResponseError;
2819
+ /**
2820
+ * You already have a dataset with this `name`
2821
+ */
2822
+ 409: ResponseError;
2823
+ /**
2824
+ * Your tier's dataset count limit is reached. Delete one, or upgrade.
2825
+ */
2826
+ 429: ResponseError;
2827
+ };
2828
+
2829
+ export type ImportDatasetError = ImportDatasetErrors[keyof ImportDatasetErrors];
2830
+
2831
+ export type ImportDatasetResponses = {
2832
+ /**
2833
+ * Dataset created, fetch started
2834
+ */
2835
+ 202: DatasetImportCreated;
2836
+ };
2837
+
2838
+ export type ImportDatasetResponse =
2839
+ ImportDatasetResponses[keyof ImportDatasetResponses];
2840
+
2841
+ export type GetDatasetImportData = {
2842
+ body?: never;
2843
+ path: {
2844
+ /**
2845
+ * The id returned by `POST /datasets/imports`
2846
+ */
2847
+ datasetId: string;
2848
+ /**
2849
+ * The `importId` returned by `POST /datasets/imports`
2850
+ */
2851
+ importId: string;
2852
+ };
2853
+ query?: never;
2854
+ url: "/datasets/{datasetId}/imports/{importId}";
2855
+ };
2856
+
2857
+ export type GetDatasetImportErrors = {
2858
+ /**
2859
+ * No such dataset for this user, or genuinely nothing is known about this `importId`.
2860
+ *
2861
+ */
2862
+ 404: ResponseError;
2863
+ };
2864
+
2865
+ export type GetDatasetImportError =
2866
+ GetDatasetImportErrors[keyof GetDatasetImportErrors];
2867
+
2868
+ export type GetDatasetImportResponses = {
2869
+ /**
2870
+ * Current fetch/ingest state
2871
+ */
2872
+ 200: DatasetImportState;
2873
+ };
2874
+
2875
+ export type GetDatasetImportResponse =
2876
+ GetDatasetImportResponses[keyof GetDatasetImportResponses];
2877
+
2587
2878
  export type ClientOptions = {
2588
2879
  baseUrl:
2589
2880
  | "https://api.qtsurfer.net/v1"