@qtsurfer/api-client 0.9.0 → 0.11.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.
package/dist/index.d.ts CHANGED
@@ -63,6 +63,22 @@ type InstrumentLinks = {
63
63
  */
64
64
  futures?: HalLink;
65
65
  };
66
+ /**
67
+ * HAL `_links` for a strategy — present on a full `StrategyState` body (`GET
68
+ * /strategy/{strategyId}`, and `POST /strategy/{strategyId}/validate`'s already-validated
69
+ * `200`), absent from that same endpoint's `202` — a deliberately partial stub carrying only
70
+ * what is known before a check has even started. Following `code` can still `404` once
71
+ * present: it documents its own honest "nothing to return" for a strategy with no source of
72
+ * its own (a `REFERENCE` marketplace copy, or one resolved only through the platform's shared
73
+ * pool). This link says where to look, not that something is there.
74
+ *
75
+ */
76
+ type StrategyLinks = {
77
+ /**
78
+ * Link to this strategy's registered source, `GET /strategy/{strategyId}/code`.
79
+ */
80
+ code: HalLink;
81
+ };
66
82
  /**
67
83
  * A HAL link object (Hypertext Application Language)
68
84
  */
@@ -153,8 +169,32 @@ type Exchange = {
153
169
  * Managed exchange data sources available for backtesting.
154
170
  */
155
171
  type DataSourceType = "ticker";
172
+ /**
173
+ * Two shapes, chosen by the `exchangeId` path segment. Against a managed exchange,
174
+ * `instrument` is required and `datasetId`/`datasetVersionId` are ignored. Against the
175
+ * reserved `exchangeId: user`, send `datasetId` instead of `instrument` — `instrument` is
176
+ * ignored there, since it comes from the dataset itself.
177
+ *
178
+ */
156
179
  type PrepareRequest = {
157
- instrument: Instrument;
180
+ /**
181
+ * Required unless `exchangeId` is the reserved value `user`, in which case send
182
+ * `datasetId` instead.
183
+ *
184
+ */
185
+ instrument?: Instrument;
186
+ /**
187
+ * Only for `exchangeId: user`: the id of a dataset created via `POST /datasets`, in place
188
+ * of `instrument`. Ignored against a managed exchange.
189
+ *
190
+ */
191
+ datasetId?: string;
192
+ /**
193
+ * Only for `exchangeId: user`, and optional even then: pins a specific past version of
194
+ * the dataset instead of its current one. Defaults to the dataset's current version.
195
+ *
196
+ */
197
+ datasetVersionId?: string;
158
198
  /**
159
199
  * Start date for the preparation process. Supports the following formats:
160
200
  * - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
@@ -179,7 +219,7 @@ type PrepareRequest = {
179
219
  * labels return `400`.
180
220
  *
181
221
  */
182
- cadence?: "1s" | "5s" | "1m" | "5m" | "15m" | "1h" | "4h" | "1d";
222
+ cadence?: "1s" | "5s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "8h" | "12h" | "1d" | "1w" | "1q";
183
223
  };
184
224
  /**
185
225
  * Information about a single job
@@ -219,12 +259,19 @@ type JobState = {
219
259
  endTime?: string | null;
220
260
  };
221
261
  /**
222
- * State of a single-instrument prepare job — the `JobState` shape plus a per-hour
223
- * data-coverage summary. A single-instrument prepare is always terminal
224
- * (`status: Completed`): the client decides what to do from `coverageRatio` (e.g.
225
- * execute if it is at or above a chosen threshold) rather than polling for missing
226
- * hours that may never arrive a missing hour for one instrument usually means low
227
- * activity, not missing data.
262
+ * State of a single-instrument prepare job — the `JobState` shape plus a coverage summary.
263
+ * A single-instrument prepare is always terminal (`status: Completed`): the client decides
264
+ * what to do from `coverageRatio` (e.g. execute if it is at or above a chosen threshold)
265
+ * rather than polling for missing hours that may never arrive a missing hour for one
266
+ * instrument usually means low activity, not missing data.
267
+ *
268
+ * **Two coverage shapes, by exchange vs. dataset.** Against a managed exchange, coverage is
269
+ * walked hour by hour: `totalHours`/`hoursWithData`/`hoursWithoutData`. Against a
270
+ * dataset-backed prepare (`exchangeId: user`), coverage is reported on the dataset's own
271
+ * cadence grid instead — hour-walking a daily dataset would report `1/24` and read as
272
+ * broken — via `cadence`/`gaps`/`largestGapSteps`; `totalHours`/`hoursWithData`/
273
+ * `hoursWithoutData` are absent in that case. `dataFrom`/`dataTo`/`coverageRatio` are present
274
+ * either way, computed accordingly.
228
275
  *
229
276
  */
230
277
  type PrepareJobState = JobState & {
@@ -237,21 +284,48 @@ type PrepareJobState = JobState & {
237
284
  */
238
285
  dataTo?: string | null;
239
286
  /**
240
- * `hoursWithData / totalHours` in `[0,1]` (`1.0` when `totalHours` is 0) — the
241
- * fraction of hours in the requested range that have served data.
287
+ * Against a managed exchange: `hoursWithData / totalHours` in `[0,1]` (`1.0` when
288
+ * `totalHours` is 0), the fraction of hours in the requested range that have served
289
+ * data. Against a dataset (`exchangeId: user`): `rows / expectedStepsAtCadence`
290
+ * over the dataset version's own range — echoing what ingest computed once, not
291
+ * recomputed against a narrower prepare request.
242
292
  *
243
293
  */
244
294
  coverageRatio?: number;
245
295
  /**
246
- * Number of whole hours in the requested prepare range.
296
+ * Number of whole hours in the requested prepare range. Managed exchanges only —
297
+ * absent for a dataset-backed prepare.
298
+ *
247
299
  */
248
300
  totalHours?: number;
249
301
  /**
250
- * Number of hours in the range that have data.
302
+ * Number of hours in the range that have data. Managed exchanges only — absent for
303
+ * a dataset-backed prepare.
304
+ *
251
305
  */
252
306
  hoursWithData?: number;
253
307
  /**
254
- * One entry per hour in the range that has no data, with a rationale.
308
+ * The dataset version's own discovered cadence (e.g. `1m`, `1h`). Only present for a
309
+ * dataset-backed prepare (`exchangeId: user`).
310
+ *
311
+ */
312
+ cadence?: string;
313
+ /**
314
+ * Number of gaps in the dataset version at its own cadence, as discovered at ingest
315
+ * time. Only present for a dataset-backed prepare.
316
+ *
317
+ */
318
+ gaps?: number;
319
+ /**
320
+ * The largest gap in the dataset version, in units of its own cadence step. Only
321
+ * present for a dataset-backed prepare.
322
+ *
323
+ */
324
+ largestGapSteps?: number;
325
+ /**
326
+ * One entry per hour in the range that has no data, with a rationale. Managed
327
+ * exchanges only — absent for a dataset-backed prepare.
328
+ *
255
329
  */
256
330
  hoursWithoutData?: Array<{
257
331
  /**
@@ -762,6 +836,26 @@ type Notice = {
762
836
  */
763
837
  provenance?: "execute" | "compile-dry-run";
764
838
  };
839
+ /**
840
+ * One entry from `GET /strategies` — the same provenance a full `StrategyState` carries
841
+ * (`compiledAt`, `requiredSources`), without its validation state, so listing stays cheap
842
+ * regardless of how many strategies you have registered. Check a specific strategy's
843
+ * validation with `GET /strategy/{strategyId}`.
844
+ *
845
+ */
846
+ type StrategySummary = {
847
+ strategyId: StrategyId;
848
+ /**
849
+ * When the live compilation was produced.
850
+ */
851
+ compiledAt?: string;
852
+ /**
853
+ * The market data this strategy needs. Absent, not empty, when it could
854
+ * not be established without constructing the strategy.
855
+ *
856
+ */
857
+ requiredSources?: Array<string>;
858
+ };
765
859
  /**
766
860
  * What is known about a registered strategy: that it compiled, and what validating it found.
767
861
  *
@@ -833,6 +927,161 @@ type StrategyState = {
833
927
  *
834
928
  */
835
929
  validationStalled?: boolean;
930
+ _links?: StrategyLinks;
931
+ };
932
+ /**
933
+ * A dataset's own metadata — not its data. `currentVersionId` is what a prepare against
934
+ * `exchangeId: user` reads by default; see `DatasetVersion` for what a version carries.
935
+ *
936
+ * `from`/`to`/`cadence` mirror that current version's own discovered range and cadence, so
937
+ * you don't need a second call to `GET /datasets/{datasetId}/uploads/{uploadId}` just to see
938
+ * what a dataset covers. Absent until a version exists.
939
+ *
940
+ */
941
+ type Dataset = {
942
+ /**
943
+ * Opaque id, returned by `POST /datasets`.
944
+ */
945
+ datasetId: string;
946
+ /**
947
+ * Unique among your datasets.
948
+ */
949
+ name: string;
950
+ /**
951
+ * Always `ticker` in v1.
952
+ */
953
+ type: "ticker";
954
+ instrument: Instrument;
955
+ /**
956
+ * When the dataset was created.
957
+ */
958
+ createdAt: string;
959
+ /**
960
+ * The id of the most recently finalized, successfully ingested version. Absent until at
961
+ * least one upload has finished ingesting.
962
+ *
963
+ */
964
+ currentVersionId?: string;
965
+ /**
966
+ * When `currentVersionId` last changed. Absent until it has a value.
967
+ */
968
+ updatedAt?: string;
969
+ /**
970
+ * Start of `currentVersionId`'s own data range, as discovered at ingest time. Absent
971
+ * until a version exists.
972
+ *
973
+ */
974
+ from?: string;
975
+ /**
976
+ * End of `currentVersionId`'s own data range, as discovered at ingest time. Absent until
977
+ * a version exists.
978
+ *
979
+ */
980
+ to?: string;
981
+ /**
982
+ * `currentVersionId`'s own discovered bar cadence (e.g. `1s`, `1m`, `1h`). Absent until a
983
+ * version exists.
984
+ *
985
+ */
986
+ cadence?: string;
987
+ };
988
+ /**
989
+ * A `Dataset` plus a self link. Returned by `GET /datasets/{datasetId}`.
990
+ */
991
+ type DatasetWithLinks = Dataset & {
992
+ _links?: {
993
+ self?: {
994
+ href?: string;
995
+ };
996
+ };
997
+ };
998
+ /**
999
+ * A `Dataset` plus the first upload session — the presigned URL to PUT the file to.
1000
+ *
1001
+ */
1002
+ type DatasetCreated = Dataset & {
1003
+ /**
1004
+ * Identifies this upload session. Pass to
1005
+ * `POST /datasets/{datasetId}/uploads/{uploadId}/finalize` once the PUT completes.
1006
+ *
1007
+ */
1008
+ uploadId: string;
1009
+ upload: {
1010
+ /**
1011
+ * Presigned URL. `PUT` the raw CSV file here directly — no `Authorization`
1012
+ * header, no other API credentials.
1013
+ *
1014
+ */
1015
+ url: string;
1016
+ /**
1017
+ * How long `url` stays valid.
1018
+ */
1019
+ expiresInMinutes: number;
1020
+ };
1021
+ };
1022
+ /**
1023
+ * One successfully ingested upload. Cadence and timestamp unit are discovered from the file,
1024
+ * not declared by the caller (D-11).
1025
+ *
1026
+ */
1027
+ type DatasetVersion = {
1028
+ datasetId: string;
1029
+ /**
1030
+ * The version id. Pass as `datasetVersionId` on `POST .../prepare` to pin it.
1031
+ */
1032
+ id?: string;
1033
+ /**
1034
+ * Size of the uploaded file.
1035
+ */
1036
+ bytes?: number;
1037
+ /**
1038
+ * Number of data rows.
1039
+ */
1040
+ rows?: number;
1041
+ /**
1042
+ * The discovered bar cadence (e.g. `1s`, `1m`, `1h`).
1043
+ */
1044
+ cadence?: string;
1045
+ /**
1046
+ * The unit the `timestamp` column was uploaded in — ISO-8601, or the epoch band its
1047
+ * numeric values fell in (seconds, millis, or micros).
1048
+ *
1049
+ */
1050
+ timestampUnit?: "iso" | "s" | "ms" | "us";
1051
+ /**
1052
+ * Number of gaps at the discovered cadence.
1053
+ */
1054
+ gaps?: number;
1055
+ /**
1056
+ * The largest gap, in units of the discovered cadence step.
1057
+ */
1058
+ largestGapSteps?: number;
1059
+ };
1060
+ /**
1061
+ * Progress of one upload, from staged through ingest. Postgres-backed once a version exists,
1062
+ * so `ready`/`failed` are permanent answers; `uploading`/`ingesting` reflect in-flight state
1063
+ * that can itself age out — see the `404` case on `GET .../uploads/{uploadId}`.
1064
+ *
1065
+ */
1066
+ type DatasetUploadState = {
1067
+ uploadId: string;
1068
+ /**
1069
+ * * `uploading` — the file was PUT to the presigned URL, but `finalize` has not been
1070
+ * called yet.
1071
+ * * `ingesting` — `finalize` was called; the worker is parsing and validating the file.
1072
+ * * `ready` — ingested successfully. `version` carries the result.
1073
+ * * `failed` — ingest rejected the file (e.g. bad CSV contract, mixed timestamp units).
1074
+ *
1075
+ */
1076
+ status: "uploading" | "ingesting" | "ready" | "failed";
1077
+ /**
1078
+ * The ingest job id, while `status` is `ingesting`.
1079
+ */
1080
+ jobId?: string;
1081
+ /**
1082
+ * Present when `status` is `ready` or `failed`.
1083
+ */
1084
+ version?: DatasetVersion;
836
1085
  };
837
1086
  type AuthTokenResponse = {
838
1087
  /**
@@ -1076,6 +1325,22 @@ type DownloadKlinesResponses = {
1076
1325
  200: Blob | File;
1077
1326
  };
1078
1327
  type DownloadKlinesResponse = DownloadKlinesResponses[keyof DownloadKlinesResponses];
1328
+ type ListStrategiesData = {
1329
+ body?: never;
1330
+ path?: never;
1331
+ query?: never;
1332
+ url: "/strategies";
1333
+ };
1334
+ type ListStrategiesResponses = {
1335
+ /**
1336
+ * Your registered strategies. An empty array if you have none — this is never a `404`.
1337
+ *
1338
+ */
1339
+ 200: {
1340
+ strategies: Array<StrategySummary>;
1341
+ };
1342
+ };
1343
+ type ListStrategiesResponse = ListStrategiesResponses[keyof ListStrategiesResponses];
1079
1344
  type CompileStrategyData = {
1080
1345
  /**
1081
1346
  * Raw strategy Java source code
@@ -1144,6 +1409,34 @@ type ValidateStrategyResponses = {
1144
1409
  202: StrategyState;
1145
1410
  };
1146
1411
  type ValidateStrategyResponse = ValidateStrategyResponses[keyof ValidateStrategyResponses];
1412
+ type DeleteStrategyData = {
1413
+ body?: never;
1414
+ path: {
1415
+ /**
1416
+ * The id returned by `POST /strategy`
1417
+ */
1418
+ strategyId: StrategyId;
1419
+ };
1420
+ query?: never;
1421
+ url: "/strategy/{strategyId}";
1422
+ };
1423
+ type DeleteStrategyErrors = {
1424
+ /**
1425
+ * No such registered strategy for this user
1426
+ */
1427
+ 404: ResponseError;
1428
+ };
1429
+ type DeleteStrategyError = DeleteStrategyErrors[keyof DeleteStrategyErrors];
1430
+ type DeleteStrategyResponses = {
1431
+ /**
1432
+ * Deleted
1433
+ */
1434
+ 200: {
1435
+ strategyId: StrategyId;
1436
+ deleted: true;
1437
+ };
1438
+ };
1439
+ type DeleteStrategyResponse = DeleteStrategyResponses[keyof DeleteStrategyResponses];
1147
1440
  type GetStrategyData = {
1148
1441
  body?: never;
1149
1442
  path: {
@@ -1169,6 +1462,37 @@ type GetStrategyResponses = {
1169
1462
  200: StrategyState;
1170
1463
  };
1171
1464
  type GetStrategyResponse = GetStrategyResponses[keyof GetStrategyResponses];
1465
+ type GetStrategyCodeData = {
1466
+ body?: never;
1467
+ path: {
1468
+ /**
1469
+ * The id returned by `POST /strategy`
1470
+ */
1471
+ strategyId: StrategyId;
1472
+ };
1473
+ query?: never;
1474
+ url: "/strategy/{strategyId}/code";
1475
+ };
1476
+ type GetStrategyCodeErrors = {
1477
+ /**
1478
+ * No such registered strategy for this user, or nothing to read for this id
1479
+ */
1480
+ 404: ResponseError;
1481
+ };
1482
+ type GetStrategyCodeError = GetStrategyCodeErrors[keyof GetStrategyCodeErrors];
1483
+ type GetStrategyCodeResponses = {
1484
+ /**
1485
+ * The registered source
1486
+ */
1487
+ 200: {
1488
+ strategyId: StrategyId;
1489
+ /**
1490
+ * Raw strategy Java source code, exactly as registered.
1491
+ */
1492
+ code: string;
1493
+ };
1494
+ };
1495
+ type GetStrategyCodeResponse = GetStrategyCodeResponses[keyof GetStrategyCodeResponses];
1172
1496
  type PrepareBacktestData = {
1173
1497
  /**
1174
1498
  * The required data to prepare a backtesting
@@ -1176,7 +1500,9 @@ type PrepareBacktestData = {
1176
1500
  body: PrepareRequest;
1177
1501
  path: {
1178
1502
  /**
1179
- * ID of the exchange to prepare the backtesting for
1503
+ * ID of the exchange to prepare the backtesting for (e.g. `binance`), or the reserved
1504
+ * value `user` to prepare from a dataset you uploaded instead of a managed exchange.
1505
+ *
1180
1506
  */
1181
1507
  exchangeId: string;
1182
1508
  /**
@@ -1190,17 +1516,23 @@ type PrepareBacktestData = {
1190
1516
  type PrepareBacktestErrors = {
1191
1517
  /**
1192
1518
  * Invalid request or parameters. Also returned when `from` is older than the configured
1193
- * lookback window or `to` is in the future.
1519
+ * lookback window or `to` is in the future. For `exchangeId: user`, also returned when
1520
+ * the dataset's current upload has not finished ingesting, or `cadence` asks for a finer
1521
+ * granularity than the dataset's own discovered cadence, or the requested range exceeds
1522
+ * your tier's range limit.
1194
1523
  *
1195
1524
  */
1196
1525
  400: ResponseError;
1197
1526
  /**
1198
- * Exchange or data source type not found
1527
+ * Exchange or data source type not found. For `exchangeId: user`, also returned when
1528
+ * `datasetId` (or a pinned `datasetVersionId`) doesn't exist or isn't yours.
1529
+ *
1199
1530
  */
1200
1531
  404: ResponseError;
1201
1532
  /**
1202
1533
  * Rate limited. Returned when the global queue exceeds capacity or the user has too many
1203
- * active backtests.
1534
+ * active backtests. Does not apply to `exchangeId: user` — a dataset prepare reads an
1535
+ * already-ingested file rather than enqueueing worker capacity.
1204
1536
  *
1205
1537
  */
1206
1538
  429: ResponseError;
@@ -1217,7 +1549,9 @@ type GetPrepareStatusData = {
1217
1549
  body?: never;
1218
1550
  path: {
1219
1551
  /**
1220
- * ID of the exchange for the backtesting process
1552
+ * ID of the exchange for the backtesting process, or the reserved value `user` for a
1553
+ * dataset-backed prepare.
1554
+ *
1221
1555
  */
1222
1556
  exchangeId: string;
1223
1557
  /**
@@ -1397,7 +1731,9 @@ type ExecuteBacktestData = {
1397
1731
  };
1398
1732
  path: {
1399
1733
  /**
1400
- * ID of the exchange for the backtesting process
1734
+ * ID of the exchange for the backtesting process, or the reserved value `user` if
1735
+ * `prepareJobId` came from a dataset-backed prepare.
1736
+ *
1401
1737
  */
1402
1738
  exchangeId: string;
1403
1739
  /**
@@ -1512,8 +1848,181 @@ type GetBacktestResultResponses = {
1512
1848
  };
1513
1849
  };
1514
1850
  type GetBacktestResultResponse = GetBacktestResultResponses[keyof GetBacktestResultResponses];
1851
+ type ListDatasetsData = {
1852
+ body?: never;
1853
+ path?: never;
1854
+ query?: never;
1855
+ url: "/datasets";
1856
+ };
1857
+ type ListDatasetsResponses = {
1858
+ /**
1859
+ * Your datasets
1860
+ */
1861
+ 200: {
1862
+ datasets: Array<Dataset>;
1863
+ };
1864
+ };
1865
+ type ListDatasetsResponse = ListDatasetsResponses[keyof ListDatasetsResponses];
1866
+ type CreateDatasetData = {
1867
+ /**
1868
+ * The dataset to create
1869
+ */
1870
+ body: {
1871
+ /**
1872
+ * A name unique among your datasets. `409` if already taken.
1873
+ */
1874
+ name: string;
1875
+ instrument: Instrument;
1876
+ };
1877
+ path?: never;
1878
+ query?: never;
1879
+ url: "/datasets";
1880
+ };
1881
+ type CreateDatasetErrors = {
1882
+ /**
1883
+ * Invalid request, or `instrument` is not a plain spot pair
1884
+ */
1885
+ 400: ResponseError;
1886
+ /**
1887
+ * You already have a dataset with this `name`
1888
+ */
1889
+ 409: ResponseError;
1890
+ /**
1891
+ * Your tier's dataset count limit is reached. Delete one, or upgrade.
1892
+ */
1893
+ 429: ResponseError;
1894
+ };
1895
+ type CreateDatasetError = CreateDatasetErrors[keyof CreateDatasetErrors];
1896
+ type CreateDatasetResponses = {
1897
+ /**
1898
+ * Dataset created, with an upload session ready for its first version
1899
+ */
1900
+ 201: DatasetCreated;
1901
+ };
1902
+ type CreateDatasetResponse = CreateDatasetResponses[keyof CreateDatasetResponses];
1903
+ type DeleteDatasetData = {
1904
+ body?: never;
1905
+ path: {
1906
+ /**
1907
+ * The id returned by `POST /datasets`
1908
+ */
1909
+ datasetId: string;
1910
+ };
1911
+ query?: never;
1912
+ url: "/datasets/{datasetId}";
1913
+ };
1914
+ type DeleteDatasetErrors = {
1915
+ /**
1916
+ * No such dataset for this user, or already deleted
1917
+ */
1918
+ 404: ResponseError;
1919
+ };
1920
+ type DeleteDatasetError = DeleteDatasetErrors[keyof DeleteDatasetErrors];
1921
+ type DeleteDatasetResponses = {
1922
+ /**
1923
+ * Deleted
1924
+ */
1925
+ 200: {
1926
+ datasetId: string;
1927
+ deleted: true;
1928
+ };
1929
+ };
1930
+ type DeleteDatasetResponse = DeleteDatasetResponses[keyof DeleteDatasetResponses];
1931
+ type GetDatasetData = {
1932
+ body?: never;
1933
+ path: {
1934
+ /**
1935
+ * The id returned by `POST /datasets`
1936
+ */
1937
+ datasetId: string;
1938
+ };
1939
+ query?: never;
1940
+ url: "/datasets/{datasetId}";
1941
+ };
1942
+ type GetDatasetErrors = {
1943
+ /**
1944
+ * No such dataset for this user
1945
+ */
1946
+ 404: ResponseError;
1947
+ };
1948
+ type GetDatasetError = GetDatasetErrors[keyof GetDatasetErrors];
1949
+ type GetDatasetResponses = {
1950
+ /**
1951
+ * Dataset detail
1952
+ */
1953
+ 200: DatasetWithLinks;
1954
+ };
1955
+ type GetDatasetResponse = GetDatasetResponses[keyof GetDatasetResponses];
1956
+ type FinalizeDatasetUploadData = {
1957
+ body?: never;
1958
+ path: {
1959
+ /**
1960
+ * The id returned by `POST /datasets`
1961
+ */
1962
+ datasetId: string;
1963
+ /**
1964
+ * The `uploadId` returned by `POST /datasets`
1965
+ */
1966
+ uploadId: string;
1967
+ };
1968
+ query?: never;
1969
+ url: "/datasets/{datasetId}/uploads/{uploadId}/finalize";
1970
+ };
1971
+ type FinalizeDatasetUploadErrors = {
1972
+ /**
1973
+ * No such dataset for this user, or nothing was PUT to `upload.url` yet — a finalize with
1974
+ * nothing to finalize.
1975
+ *
1976
+ */
1977
+ 404: ResponseError;
1978
+ /**
1979
+ * The uploaded file exceeds your tier's size limit for a dataset.
1980
+ */
1981
+ 413: ResponseError;
1982
+ };
1983
+ type FinalizeDatasetUploadError = FinalizeDatasetUploadErrors[keyof FinalizeDatasetUploadErrors];
1984
+ type FinalizeDatasetUploadResponses = {
1985
+ /**
1986
+ * Ingest queued
1987
+ */
1988
+ 202: {
1989
+ jobId: string;
1990
+ };
1991
+ };
1992
+ type FinalizeDatasetUploadResponse = FinalizeDatasetUploadResponses[keyof FinalizeDatasetUploadResponses];
1993
+ type GetDatasetUploadData = {
1994
+ body?: never;
1995
+ path: {
1996
+ /**
1997
+ * The id returned by `POST /datasets`
1998
+ */
1999
+ datasetId: string;
2000
+ /**
2001
+ * The `uploadId` returned by `POST /datasets`
2002
+ */
2003
+ uploadId: string;
2004
+ };
2005
+ query?: never;
2006
+ url: "/datasets/{datasetId}/uploads/{uploadId}";
2007
+ };
2008
+ type GetDatasetUploadErrors = {
2009
+ /**
2010
+ * No such dataset for this user, or genuinely nothing is known about this `uploadId` — no
2011
+ * version, no in-flight job, and nothing was ever PUT to its upload URL.
2012
+ *
2013
+ */
2014
+ 404: ResponseError;
2015
+ };
2016
+ type GetDatasetUploadError = GetDatasetUploadErrors[keyof GetDatasetUploadErrors];
2017
+ type GetDatasetUploadResponses = {
2018
+ /**
2019
+ * Current upload/ingest state
2020
+ */
2021
+ 200: DatasetUploadState;
2022
+ };
2023
+ type GetDatasetUploadResponse = GetDatasetUploadResponses[keyof GetDatasetUploadResponses];
1515
2024
  type ClientOptions = {
1516
- baseUrl: "https://api.staging.qtsurfer.com/v1" | "https://api.qtsurfer.com/v1" | (string & {});
2025
+ baseUrl: "https://api.qtsurfer.net/v1" | "https://api.qtsurfer.com/v1" | (string & {});
1517
2026
  };
1518
2027
 
1519
2028
  type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options$1<TData, ThrowOnError> & {
@@ -1610,6 +2119,19 @@ declare const downloadTickers: <ThrowOnError extends boolean = false>(options: O
1610
2119
  *
1611
2120
  */
1612
2121
  declare const downloadKlines: <ThrowOnError extends boolean = false>(options: Options<DownloadKlinesData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Blob | File, ResponseError, ThrowOnError>;
2122
+ /**
2123
+ * List your registered strategies
2124
+ * Every strategy you have registered and not deleted, most recently compiled first.
2125
+ *
2126
+ * Each entry carries the same provenance `GET /strategy/{strategyId}` does — `compiledAt`,
2127
+ * `requiredSources` — but not its validation state, so listing stays cheap regardless of how
2128
+ * many strategies you have. Check a specific strategy's validation with `GET
2129
+ * /strategy/{strategyId}`.
2130
+ *
2131
+ */
2132
+ declare const listStrategies: <ThrowOnError extends boolean = false>(options?: Options<ListStrategiesData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
2133
+ strategies: Array<StrategySummary>;
2134
+ }, unknown, ThrowOnError>;
1613
2135
  /**
1614
2136
  * Compile and register a strategy
1615
2137
  * Compiles raw strategy source and registers it, returning its `strategyId`.
@@ -1653,6 +2175,24 @@ declare const compileStrategy: <ThrowOnError extends boolean = false>(options: O
1653
2175
  *
1654
2176
  */
1655
2177
  declare const validateStrategy: <ThrowOnError extends boolean = false>(options: Options<ValidateStrategyData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<StrategyState, ResponseError, ThrowOnError>;
2178
+ /**
2179
+ * Release a registered strategy
2180
+ * Removes a strategy from `GET /strategy/{strategyId}` and `GET /strategies`. This is not
2181
+ * undone by re-submitting the same source to `POST /strategy` — that registers a new
2182
+ * strategy, with a new id.
2183
+ *
2184
+ * **Backtests you already ran against this strategy are unaffected.** Deleting it stops it
2185
+ * from counting against your account and stops you from validating or re-running it under
2186
+ * this id — it does not erase what already happened.
2187
+ *
2188
+ * Only removes a strategy you registered yourself. If you copied someone else's strategy
2189
+ * (a shared/marketplace listing), deleting your copy never affects theirs, or anyone else's.
2190
+ *
2191
+ */
2192
+ declare const deleteStrategy: <ThrowOnError extends boolean = false>(options: Options<DeleteStrategyData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
2193
+ strategyId: StrategyId;
2194
+ deleted: true;
2195
+ }, ResponseError, ThrowOnError>;
1656
2196
  /**
1657
2197
  * Get a strategy by id, including its validation state
1658
2198
  * Reports that the strategy is registered — implied by a `200` at all — and what validating it
@@ -1663,6 +2203,21 @@ declare const validateStrategy: <ThrowOnError extends boolean = false>(options:
1663
2203
  *
1664
2204
  */
1665
2205
  declare const getStrategy: <ThrowOnError extends boolean = false>(options: Options<GetStrategyData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<StrategyState, ResponseError, ThrowOnError>;
2206
+ /**
2207
+ * Get a registered strategy's source, if you still have one to read
2208
+ * The exact source you last submitted for this id — the same text `POST /strategy` derives
2209
+ * `strategyId` from, whitespace and comments included.
2210
+ *
2211
+ * **"If available", not "always".** A strategy you resolve only through a shared/marketplace
2212
+ * listing you copied by reference carries no source of its own, and reads as a `404` here the
2213
+ * same as a `strategyId` you never registered — that is the honest answer either way, since
2214
+ * from this endpoint's point of view nothing is there to return.
2215
+ *
2216
+ */
2217
+ declare const getStrategyCode: <ThrowOnError extends boolean = false>(options: Options<GetStrategyCodeData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
2218
+ strategyId: StrategyId;
2219
+ code: string;
2220
+ }, ResponseError, ThrowOnError>;
1666
2221
  /**
1667
2222
  * Prepare backtest data
1668
2223
  * Enqueues a prepare task over the requested date range. Returns immediately with a `jobId`;
@@ -1671,6 +2226,11 @@ declare const getStrategy: <ThrowOnError extends boolean = false>(options: Optio
1671
2226
  * The same params always return the same `jobId` (idempotent). Repeated calls with identical
1672
2227
  * params do not enqueue duplicate work — they reuse the existing job.
1673
2228
  *
2229
+ * **`exchangeId: user` is reserved for your own uploaded data.** Instead of a managed
2230
+ * exchange, it prepares from a dataset you created via `POST /datasets` (see the **Dataset**
2231
+ * endpoints) — send `datasetId` in place of `instrument`. See `PrepareRequest` below for the
2232
+ * two request shapes.
2233
+ *
1674
2234
  */
1675
2235
  declare const prepareBacktest: <ThrowOnError extends boolean = false>(options: Options<PrepareBacktestData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AcceptedJob, ResponseError, ThrowOnError>;
1676
2236
  /**
@@ -1678,6 +2238,9 @@ declare const prepareBacktest: <ThrowOnError extends boolean = false>(options: O
1678
2238
  * Retrieves the current state of the prepare job identified by `jobId`.
1679
2239
  * Poll until `status` is `Completed`, `Failed`, or `Aborted`.
1680
2240
  *
2241
+ * For a dataset prepare (`exchangeId: user`), coverage is reported against the dataset's own
2242
+ * cadence grid instead of hours — see `cadence`/`gaps`/`largestGapSteps` on `PrepareJobState`.
2243
+ *
1681
2244
  */
1682
2245
  declare const getPrepareStatus: <ThrowOnError extends boolean = false>(options: Options<GetPrepareStatusData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<PrepareJobState, ResponseError, ThrowOnError>;
1683
2246
  /**
@@ -1778,6 +2341,9 @@ declare const getSweepSensitivity: <ThrowOnError extends boolean = false>(option
1778
2341
  * The same params (same `prepareJobId`, `strategyId`, `storeSignals`) always return the same
1779
2342
  * `jobId` (idempotent).
1780
2343
  *
2344
+ * Works unchanged for a dataset-backed prepare (`exchangeId: user`) — the request body is
2345
+ * identical either way, since the instrument and range are recovered from `prepareJobId`.
2346
+ *
1781
2347
  */
1782
2348
  declare const executeBacktest: <ThrowOnError extends boolean = false>(options: Options<ExecuteBacktestData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AcceptedJob, ResponseError, ThrowOnError>;
1783
2349
  /**
@@ -1803,7 +2369,71 @@ declare const cancelBacktest: <ThrowOnError extends boolean = false>(options: Op
1803
2369
  *
1804
2370
  */
1805
2371
  declare const getBacktestResult: <ThrowOnError extends boolean = false>(options: Options<GetBacktestResultData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<GetBacktestResultResponse, ResponseError, ThrowOnError>;
2372
+ /**
2373
+ * List your datasets
2374
+ * Every dataset you have created and not deleted, most recently created first. Never a `404`
2375
+ * — an empty array if you have none, same convention as `GET /strategies`.
2376
+ *
2377
+ */
2378
+ declare const listDatasets: <ThrowOnError extends boolean = false>(options?: Options<ListDatasetsData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
2379
+ datasets: Array<Dataset>;
2380
+ }, unknown, ThrowOnError>;
2381
+ /**
2382
+ * Create a dataset and get a URL to upload it to
2383
+ * Creates a dataset AND its first upload session in one call — a presigned URL your client
2384
+ * PUTs the file to directly, no API credentials involved in that PUT. Call
2385
+ * `POST /datasets/{datasetId}/uploads/{uploadId}/finalize` once the upload completes to kick
2386
+ * off ingest.
2387
+ *
2388
+ * v1 is ticker data only — `type` is not a request field, it is always `"ticker"` in the
2389
+ * response. `instrument` must be a plain spot pair (`BASE/QUOTE`, exactly one `/`); derivative
2390
+ * forms (e.g. `BTC/USDT:USDT`) are rejected.
2391
+ *
2392
+ * **Upload format.** A CSV with a header row. Required columns: `timestamp` (ISO-8601, or
2393
+ * numeric epoch seconds/millis/micros — detected from the first row, then enforced for every
2394
+ * later row), `close`. Optional columns: `open`, `high`, `low`, `volume`, `quoteVolume`,
2395
+ * `bid`, `bidSize`, `ask`, `askSize`. Cadence and timestamp unit are discovered from the data,
2396
+ * not declared.
2397
+ *
2398
+ */
2399
+ declare const createDataset: <ThrowOnError extends boolean = false>(options: Options<CreateDatasetData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<DatasetCreated, ResponseError, ThrowOnError>;
2400
+ /**
2401
+ * Delete a dataset
2402
+ * Soft-delete — the dataset stops appearing in `GET /datasets`/`GET /datasets/{datasetId}` and
2403
+ * can no longer be prepared from, but its object data is reclaimed later rather than purged
2404
+ * inline, so a backtest already running against one of its versions is not disrupted.
2405
+ *
2406
+ */
2407
+ declare const deleteDataset: <ThrowOnError extends boolean = false>(options: Options<DeleteDatasetData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
2408
+ datasetId: string;
2409
+ deleted: true;
2410
+ }, ResponseError, ThrowOnError>;
2411
+ /**
2412
+ * Get a dataset by id
2413
+ * Detail for one dataset, plus a self link.
2414
+ */
2415
+ declare const getDataset: <ThrowOnError extends boolean = false>(options: Options<GetDatasetData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<DatasetWithLinks, ResponseError, ThrowOnError>;
2416
+ /**
2417
+ * Finalize an uploaded file and start ingest
2418
+ * Call once the file has been PUT to the `upload.url` from `POST /datasets`. Enqueues ingest
2419
+ * and returns immediately; poll
2420
+ * `GET /datasets/{datasetId}/uploads/{uploadId}` for the result.
2421
+ *
2422
+ * Idempotent — a repeat finalize of the same upload returns the same `jobId` rather than
2423
+ * enqueueing a second ingest.
2424
+ *
2425
+ */
2426
+ declare const finalizeDatasetUpload: <ThrowOnError extends boolean = false>(options: Options<FinalizeDatasetUploadData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
2427
+ jobId: string;
2428
+ }, ResponseError, ThrowOnError>;
2429
+ /**
2430
+ * Get the state of an upload/ingest
2431
+ * Poll after `POST .../finalize` until `status` is `ready` or `failed`. Also reports
2432
+ * `uploading` (finalize not called yet, but the file was PUT) before you finalize at all.
2433
+ *
2434
+ */
2435
+ declare const getDatasetUpload: <ThrowOnError extends boolean = false>(options: Options<GetDatasetUploadData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<DatasetUploadState, ResponseError, ThrowOnError>;
1806
2436
 
1807
2437
  declare const client: _hey_api_client_fetch.Client;
1808
2438
 
1809
- export { type AcceptedJob, type AuthTokenError, type AuthTokenResponse, type AuthenticateData, type AuthenticateError, type AuthenticateErrors, type AuthenticateResponse, type AuthenticateResponses, type BacktestJobResult, type CancelBacktestData, type CancelBacktestError, type CancelBacktestErrors, type CancelBacktestResponse, type CancelBacktestResponses, type CancelSweepData, type CancelSweepError, type CancelSweepErrors, type CancelSweepResponse, type CancelSweepResponses, type ClientOptions, type CompileStrategyData, type CompileStrategyError, type CompileStrategyErrors, type CompileStrategyResponse, type CompileStrategyResponses, type CoverageWindow, type DataSourceType, type DownloadKlinesData, type DownloadKlinesError, type DownloadKlinesErrors, type DownloadKlinesResponse, type DownloadKlinesResponses, type DownloadTickersData, type DownloadTickersError, type DownloadTickersErrors, type DownloadTickersResponse, type DownloadTickersResponses, type EquityPoint, type Exchange, type ExecuteBacktestData, type ExecuteBacktestError, type ExecuteBacktestErrors, type ExecuteBacktestResponse, type ExecuteBacktestResponses, type ExecuteSweepAccepted, type ExecuteSweepData, type ExecuteSweepError, type ExecuteSweepErrors, type ExecuteSweepRequest, type ExecuteSweepResponse, type ExecuteSweepResponses, type ExecuteSweepResult, type GetBacktestResultData, type GetBacktestResultError, type GetBacktestResultErrors, type GetBacktestResultResponse, type GetBacktestResultResponses, type GetPrepareStatusData, type GetPrepareStatusError, type GetPrepareStatusErrors, type GetPrepareStatusResponse, type GetPrepareStatusResponses, type GetStrategyData, type GetStrategyError, type GetStrategyErrors, type GetStrategyResponse, type GetStrategyResponses, type GetSweepResultData, type GetSweepResultError, type GetSweepResultErrors, type GetSweepResultResponse, type GetSweepResultResponses, type GetSweepSensitivityData, type GetSweepSensitivityError, type GetSweepSensitivityErrors, type GetSweepSensitivityResponse, type GetSweepSensitivityResponses, type HalLink, type Instrument, type InstrumentCoverage, type InstrumentDetail, type InstrumentLinks, type InstrumentListMeta, type InstrumentListResponse, type JobState, type ListExchangesData, type ListExchangesResponse, type ListExchangesResponses, type ListInstrumentsData, type ListInstrumentsError, type ListInstrumentsErrors, type ListInstrumentsResponse, type ListInstrumentsResponses, type ListSegmentInstrumentsData, type ListSegmentInstrumentsError, type ListSegmentInstrumentsErrors, type ListSegmentInstrumentsResponse, type ListSegmentInstrumentsResponses, type Notice, type Options, type PrepareBacktestData, type PrepareBacktestError, type PrepareBacktestErrors, type PrepareBacktestResponse, type PrepareBacktestResponses, type PrepareJobState, type PrepareRequest, type ResponseError, type ResultMap, type StrategyId, type StrategyState, type SweepAxis, type SweepBaseConfig, type SweepHeatmap, type SweepHeatmapCell, type SweepMarginal, type SweepMarginalPoint, type SweepProgress, type SweepRunRow, type SweepSensitivity, type SweepSpecRequest, type ValidateStrategyData, type ValidateStrategyError, type ValidateStrategyErrors, type ValidateStrategyResponse, type ValidateStrategyResponses, type WalkForwardAccepted, type WalkForwardFold, type WalkForwardRequest, type WalkForwardResult, authenticate, cancelBacktest, cancelSweep, client, compileStrategy, downloadKlines, downloadTickers, executeBacktest, executeSweep, getBacktestResult, getPrepareStatus, getStrategy, getSweepResult, getSweepSensitivity, listExchanges, listInstruments, listSegmentInstruments, prepareBacktest, validateStrategy };
2439
+ export { type AcceptedJob, type AuthTokenError, type AuthTokenResponse, type AuthenticateData, type AuthenticateError, type AuthenticateErrors, type AuthenticateResponse, type AuthenticateResponses, type BacktestJobResult, type CancelBacktestData, type CancelBacktestError, type CancelBacktestErrors, type CancelBacktestResponse, type CancelBacktestResponses, type CancelSweepData, type CancelSweepError, type CancelSweepErrors, type CancelSweepResponse, type CancelSweepResponses, type ClientOptions, type CompileStrategyData, type CompileStrategyError, type CompileStrategyErrors, type CompileStrategyResponse, type CompileStrategyResponses, type CoverageWindow, type CreateDatasetData, type CreateDatasetError, type CreateDatasetErrors, type CreateDatasetResponse, type CreateDatasetResponses, type DataSourceType, type Dataset, type DatasetCreated, type DatasetUploadState, type DatasetVersion, type DatasetWithLinks, type DeleteDatasetData, type DeleteDatasetError, type DeleteDatasetErrors, type DeleteDatasetResponse, type DeleteDatasetResponses, type DeleteStrategyData, type DeleteStrategyError, type DeleteStrategyErrors, type DeleteStrategyResponse, type DeleteStrategyResponses, type DownloadKlinesData, type DownloadKlinesError, type DownloadKlinesErrors, type DownloadKlinesResponse, type DownloadKlinesResponses, type DownloadTickersData, type DownloadTickersError, type DownloadTickersErrors, type DownloadTickersResponse, type DownloadTickersResponses, type EquityPoint, type Exchange, type ExecuteBacktestData, type ExecuteBacktestError, type ExecuteBacktestErrors, type ExecuteBacktestResponse, type ExecuteBacktestResponses, type ExecuteSweepAccepted, type ExecuteSweepData, type ExecuteSweepError, type ExecuteSweepErrors, type ExecuteSweepRequest, type ExecuteSweepResponse, type ExecuteSweepResponses, type ExecuteSweepResult, type FinalizeDatasetUploadData, type FinalizeDatasetUploadError, type FinalizeDatasetUploadErrors, type FinalizeDatasetUploadResponse, type FinalizeDatasetUploadResponses, type GetBacktestResultData, type GetBacktestResultError, type GetBacktestResultErrors, type GetBacktestResultResponse, type GetBacktestResultResponses, type GetDatasetData, type GetDatasetError, type GetDatasetErrors, type GetDatasetResponse, type GetDatasetResponses, type GetDatasetUploadData, type GetDatasetUploadError, type GetDatasetUploadErrors, type GetDatasetUploadResponse, type GetDatasetUploadResponses, type GetPrepareStatusData, type GetPrepareStatusError, type GetPrepareStatusErrors, type GetPrepareStatusResponse, type GetPrepareStatusResponses, type GetStrategyCodeData, type GetStrategyCodeError, type GetStrategyCodeErrors, type GetStrategyCodeResponse, type GetStrategyCodeResponses, type GetStrategyData, type GetStrategyError, type GetStrategyErrors, type GetStrategyResponse, type GetStrategyResponses, type GetSweepResultData, type GetSweepResultError, type GetSweepResultErrors, type GetSweepResultResponse, type GetSweepResultResponses, type GetSweepSensitivityData, type GetSweepSensitivityError, type GetSweepSensitivityErrors, type GetSweepSensitivityResponse, type GetSweepSensitivityResponses, type HalLink, type Instrument, type InstrumentCoverage, type InstrumentDetail, type InstrumentLinks, type InstrumentListMeta, type InstrumentListResponse, type JobState, type ListDatasetsData, type ListDatasetsResponse, type ListDatasetsResponses, type ListExchangesData, type ListExchangesResponse, type ListExchangesResponses, type ListInstrumentsData, type ListInstrumentsError, type ListInstrumentsErrors, type ListInstrumentsResponse, type ListInstrumentsResponses, type ListSegmentInstrumentsData, type ListSegmentInstrumentsError, type ListSegmentInstrumentsErrors, type ListSegmentInstrumentsResponse, type ListSegmentInstrumentsResponses, type ListStrategiesData, type ListStrategiesResponse, type ListStrategiesResponses, type Notice, type Options, type PrepareBacktestData, type PrepareBacktestError, type PrepareBacktestErrors, type PrepareBacktestResponse, type PrepareBacktestResponses, type PrepareJobState, type PrepareRequest, type ResponseError, type ResultMap, type StrategyId, type StrategyLinks, type StrategyState, type StrategySummary, type SweepAxis, type SweepBaseConfig, type SweepHeatmap, type SweepHeatmapCell, type SweepMarginal, type SweepMarginalPoint, type SweepProgress, type SweepRunRow, type SweepSensitivity, type SweepSpecRequest, type ValidateStrategyData, type ValidateStrategyError, type ValidateStrategyErrors, type ValidateStrategyResponse, type ValidateStrategyResponses, type WalkForwardAccepted, type WalkForwardFold, type WalkForwardRequest, type WalkForwardResult, authenticate, cancelBacktest, cancelSweep, client, compileStrategy, createDataset, deleteDataset, deleteStrategy, downloadKlines, downloadTickers, executeBacktest, executeSweep, finalizeDatasetUpload, getBacktestResult, getDataset, getDatasetUpload, getPrepareStatus, getStrategy, getStrategyCode, getSweepResult, getSweepSensitivity, listDatasets, listExchanges, listInstruments, listSegmentInstruments, listStrategies, prepareBacktest, validateStrategy };