@qtsurfer/api-client 0.11.0 → 0.13.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/README.md CHANGED
@@ -68,8 +68,8 @@ pluggable token stores so callers don't reinvent that plumbing.
68
68
 
69
69
  All operations are exported as standalone functions; every operation accepts an `Options` object and returns `{ data, error, response }`.
70
70
 
71
- The table is exhaustive: `src/generated/` is produced from the OpenAPI spec, so **all 21 operations**
72
- the spec declares are exported. The rows below describe **spec version 0.109.2**, which is versioned
71
+ The table is exhaustive: `src/generated/` is produced from the OpenAPI spec, so **all 29 operations**
72
+ the spec declares are exported. The rows below describe **spec version 0.111.2**, which is versioned
73
73
  independently of this package.
74
74
 
75
75
  | Function | Method | Path | Purpose |
@@ -92,9 +92,17 @@ independently of this package.
92
92
  | `getSweepResult` | GET | `/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}` | Get sweep progress and results |
93
93
  | `cancelSweep` | DELETE | `/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}` | Cancel a running parameter sweep |
94
94
  | `getSweepSensitivity` | GET | `/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}/sensitivity` | Get sweep sensitivity surfaces |
95
+ | `getSweepRunEquityCurve` | GET | `/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}/runs/{runIx}/equityCurve` | Get one sweep trial's equity curve |
95
96
  | `executeBacktest` | POST | `/backtest/{exchangeId}/{type}/execute` | Execute a compiled strategy against a prepared dataset |
96
97
  | `cancelBacktest` | DELETE | `/backtest/{exchangeId}/{type}/execute/{jobId}` | Cancel a running backtest execution |
97
98
  | `getBacktestResult` | GET | `/backtest/{exchangeId}/{type}/execute/{jobId}` | Get the result of a backtest execution job |
99
+ | `listDatasets` | GET | `/datasets` | List your datasets |
100
+ | `createDataset` | POST | `/datasets` | Create a dataset and obtain its first upload session |
101
+ | `deleteDataset` | DELETE | `/datasets/{datasetId}` | Soft-delete a dataset |
102
+ | `getDataset` | GET | `/datasets/{datasetId}` | Get dataset metadata |
103
+ | `openDatasetUpload` | POST | `/datasets/{datasetId}/uploads` | Open an upload session for a later dataset version |
104
+ | `finalizeDatasetUpload` | POST | `/datasets/{datasetId}/uploads/{uploadId}/finalize` | Queue ingest after uploading a file |
105
+ | `getDatasetUpload` | GET | `/datasets/{datasetId}/uploads/{uploadId}` | Get an upload's ingestion state |
98
106
 
99
107
  All generated types (`Exchange`, `InstrumentDetail`, `BacktestJobResult`, `PrepareJobState`, `ResultMap`, etc.) are re-exported from the root.
100
108
 
package/dist/index.d.ts CHANGED
@@ -400,6 +400,41 @@ type ExecuteSweepRequest = {
400
400
  */
401
401
  minTradeFloor?: number;
402
402
  walkForward?: WalkForwardRequest;
403
+ equityCurve?: EquityCurveRequest;
404
+ };
405
+ /**
406
+ * Requested equity-curve transform, applied server-side in a fixed pipeline order: `resample` (point count) then `differential` (encoding) then `outMode` (JSON shape) — each stage assumes the previous one already ran. A server-side size guard can still force a smaller/deflated shape above its thresholds regardless of what is requested here — see `EquityCurveMeta` for what actually happened.
407
+ */
408
+ type EquityCurveOptions = {
409
+ /**
410
+ * Downsample to at most this many points (extrema-preserving — the global max/min and the exact first/last point are always kept). Omit for no downsampling.
411
+ */
412
+ resample?: number;
413
+ /**
414
+ * Delta-encode both fields from the second (post-resample) point onward.
415
+ */
416
+ differential?: boolean;
417
+ /**
418
+ * Requested JSON shape.
419
+ */
420
+ outMode?: EquityCurveOutMode;
421
+ };
422
+ /**
423
+ * Selection (`mode`/`n`/`maxPct`) plus the transform preference (`resample`/`differential`/`outMode`) applied by `GET .../equityCurve` whenever ITS OWN query params are absent, for a curve this sweep retained. The transform half never affects retention or `sweepId` — a caller can always override it per-request at read time regardless of what was submitted here.
424
+ */
425
+ type EquityCurveRequest = EquityCurveOptions & {
426
+ /**
427
+ * Which trials keep their per-point equity curve. `auto` retains curves only while the accumulated size stays within server limits; `topN`/`topPct` retain curves for the best-ranked trials explicitly; `none` retains no curves.
428
+ */
429
+ mode?: "auto" | "topN" | "topPct" | "none";
430
+ /**
431
+ * Trial count to retain when mode is topN.
432
+ */
433
+ n?: number;
434
+ /**
435
+ * Top percentage of trials to retain when mode is topPct.
436
+ */
437
+ maxPct?: number;
403
438
  };
404
439
  /**
405
440
  * Opt in to walk-forward validation. Present, the sweep runs as F sequential folds and the result gains a `walkForward` section; absent, nothing about the sweep changes. Two requests that differ only in this block are two different sweeps and do not deduplicate against each other.
@@ -512,6 +547,10 @@ type SweepRunRow = {
512
547
  belowTradeFloor: boolean;
513
548
  aborted: boolean;
514
549
  runtimeMs: number;
550
+ /**
551
+ * 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.
552
+ */
553
+ equityCurve?: EquityCurveResult;
515
554
  };
516
555
  /**
517
556
  * Sensitivity aggregates over a sweep's stored rows. Marginals are always complete; heatmaps may be capped, in which case `heatmapsTruncated` is true.
@@ -571,6 +610,9 @@ type SweepHeatmapCell = {
571
610
  };
572
611
  type ExecuteSweepResult = {
573
612
  sweepId: string;
613
+ /**
614
+ * The sweep's own status vocabulary — not the same set `state.status` below uses. See `state` for why.
615
+ */
574
616
  status: "RUNNING" | "COMPLETED" | "PARTIAL" | "CANCELLED";
575
617
  objective: "sharpe" | "sortino" | "pnl" | "maxdd";
576
618
  order: "ranked" | "natural";
@@ -602,6 +644,13 @@ type ExecuteSweepResult = {
602
644
  truncated: boolean;
603
645
  leaderboard: Array<SweepRunRow>;
604
646
  walkForward?: WalkForwardResult;
647
+ /**
648
+ * 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.
649
+ * `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.
650
+ * `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.
651
+ * `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.
652
+ */
653
+ state: JobState;
605
654
  };
606
655
  /**
607
656
  * Present only on a sweep submitted with `walkForward`, and present from acceptance onward — its presence, not its contents, is what identifies a walk-forward sweep. `completedFolds` is 0 while the first fold is still running.
@@ -762,9 +811,9 @@ type ResultMap = {
762
811
  */
763
812
  maxDrawdownPercent?: number;
764
813
  /**
765
- * Equity curve over the backtest. Element 0 is an anchor at the backtest `from` with `initialCapital`; the remaining points are one sample per emitted yield, in order. Use it to plot the strategy's running equity without re-deriving it from the yield history.
814
+ * Equity curve over the backtest. `points[0]` (or `timestamps[0]`/`equities[0]` in `SHORT` mode) is an anchor at the backtest `from` with `initialCapital`; the remaining points are one sample per emitted yield, in order. Use it to plot the strategy's running equity without re-deriving it from the yield history. Always inline for a plain backtest today — never a pointer (`url`); that shape exists only for a sweep row's top-N winners.
766
815
  */
767
- equityCurve?: Array<EquityPoint>;
816
+ equityCurve?: EquityCurveResult;
768
817
  /**
769
818
  * Number of signals emitted during strategy execution
770
819
  */
@@ -803,6 +852,57 @@ type EquityPoint = {
803
852
  */
804
853
  equity: number;
805
854
  };
855
+ /**
856
+ * JSON shape for an equity curve's points. `ARRAY` is `[{timestamp, equity}, ...]`; `SHORT` is `{timestamps: [...], equities: [...]}` (parallel arrays, no repeated key text). The one schema shared by every place `outMode` appears, request or response, so the two cannot drift to different value sets.
857
+ */
858
+ type EquityCurveOutMode = "ARRAY" | "SHORT";
859
+ /**
860
+ * What the transform pipeline actually did, computed from the observed outcome — never a copy of what was requested. Lets a caller detect a forced or no-op transform (e.g. a `resample` ceiling already above the curve's size is a legal no-op, reported honestly as `resampled: false`).
861
+ */
862
+ type EquityCurveMeta = {
863
+ /**
864
+ * Size of the curve the transform pipeline received.
865
+ */
866
+ inputPointCount: number;
867
+ /**
868
+ * Size after the full pipeline (resample, then differential, then outMode).
869
+ */
870
+ outputPointCount: number;
871
+ /**
872
+ * True only if the resample stage actually changed the point count.
873
+ */
874
+ resampled: boolean;
875
+ /**
876
+ * True only if delta-encoding actually ran. Requesting it on a curve of 0 or 1 points has nothing to encode, so it does not run even if asked.
877
+ */
878
+ differential: boolean;
879
+ /**
880
+ * The actual JSON shape served. Present even when the points themselves are not (a pointer curve, `EquityCurveResult.url`) — a caller resolving that URL separately still needs to know how to parse what it gets back before fetching it. May override an explicit request above a server-side size threshold; this field, not the request, is the source of truth for what shape actually came back.
881
+ */
882
+ outMode: EquityCurveOutMode;
883
+ };
884
+ /**
885
+ * An equity curve, shaped per `meta.outMode`: `points` when `ARRAY`, `timestamps` + `equities` (parallel arrays) when `SHORT`. Used identically wherever a curve is returned — a plain backtest's inline `equityCurve` and a sweep row's `equityCurve` are the same type. `url` is present *instead of* any points when the curve is served by pointer rather than inline (a sweep row's top-N winners only): `GET` it separately to fetch this exact same shape with the points populated.
886
+ */
887
+ type EquityCurveResult = {
888
+ meta: EquityCurveMeta;
889
+ /**
890
+ * Present when `meta.outMode` is `ARRAY` and the curve is inline (not a pointer).
891
+ */
892
+ points?: Array<EquityPoint>;
893
+ /**
894
+ * Present when `meta.outMode` is `SHORT` and the curve is inline (not a pointer).
895
+ */
896
+ timestamps?: Array<number>;
897
+ /**
898
+ * Present when `meta.outMode` is `SHORT` and the curve is inline (not a pointer), parallel to `timestamps` (same index, same point).
899
+ */
900
+ equities?: Array<number>;
901
+ /**
902
+ * Present only for a sweep row's pointer curve. `GET` this to fetch the curve itself, in this exact `{points|timestamps+equities, meta}` shape — `meta` there is the real, possibly size-guarded outcome; this outer `meta` is a raw, untransformed preview from the moment the sweep selected this trial's curve, and the two can legitimately differ.
903
+ */
904
+ url?: string;
905
+ };
806
906
  /**
807
907
  * Unique identifier for a compiled strategy, derived from the source itself: the same code
808
908
  * always yields the same id, for every caller, whatever its formatting. See
@@ -810,6 +910,51 @@ type EquityPoint = {
810
910
  *
811
911
  */
812
912
  type StrategyId = string;
913
+ /**
914
+ * One property name `POST /strategy` could establish without constructing the strategy —
915
+ * either declared with `@StrategyProperty` on the compiled source, or one of the small set of
916
+ * base properties every strategy carries (`amnt`, `enabled`, `multiEntry`, ...).
917
+ *
918
+ * **Best-effort, not exhaustive.** A property registered through an attached risk/backtest
919
+ * config needs a live instance to discover and is not listed here. Use this to catch a typo'd
920
+ * sweep key before submitting, not as the definitive list of what a sweep will accept — a
921
+ * name absent from this list may still be valid.
922
+ *
923
+ */
924
+ type DeclaredProperty = {
925
+ /**
926
+ * The key a sweep or execute param map uses for this property.
927
+ */
928
+ name: string;
929
+ /**
930
+ * Human-readable label, as declared.
931
+ */
932
+ description?: string;
933
+ /**
934
+ * The declared default, as a string, if one was given. Absent, not null, when none was
935
+ * declared.
936
+ *
937
+ */
938
+ defaultValue?: string;
939
+ /**
940
+ * Whether a value for this key is injected into the strategy's field (`true`) or only
941
+ * available through the property map (`false`).
942
+ *
943
+ */
944
+ reflected?: boolean;
945
+ /**
946
+ * Suggested sweep/range minimum, if declared. Advisory only, never validated.
947
+ */
948
+ min?: number;
949
+ /**
950
+ * Suggested sweep/range maximum, if declared. Advisory only, never validated.
951
+ */
952
+ max?: number;
953
+ /**
954
+ * Suggested sweep/range step, if declared. Advisory only, never validated.
955
+ */
956
+ step?: number;
957
+ };
813
958
  /**
814
959
  * A diagnostic the engine raised while the strategy ran. Advisory: it describes something worth
815
960
  * knowing about how the strategy is wired, not necessarily an error.
@@ -996,32 +1141,60 @@ type DatasetWithLinks = Dataset & {
996
1141
  };
997
1142
  };
998
1143
  /**
999
- * A `Dataset` plus the first upload session — the presigned URL to PUT the file to.
1144
+ * A presigned destination for uploading a raw dataset file directly to storage.
1145
+ */
1146
+ type DatasetUploadTarget = {
1147
+ /**
1148
+ * Presigned URL. `PUT` the raw CSV file here directly — no `Authorization` header,
1149
+ * no other API credentials.
1150
+ *
1151
+ */
1152
+ url: string;
1153
+ /**
1154
+ * How long `url` stays valid.
1155
+ */
1156
+ expiresInMinutes: number;
1157
+ };
1158
+ /**
1159
+ * An upload session — an id plus the presigned URL to PUT the raw file to. Returned both by
1160
+ * `POST /datasets` (as part of the new dataset) and by `POST /datasets/{datasetId}/uploads`
1161
+ * (on its own, for an existing one).
1000
1162
  *
1001
1163
  */
1002
- type DatasetCreated = Dataset & {
1164
+ type DatasetUploadSession = {
1003
1165
  /**
1004
1166
  * Identifies this upload session. Pass to
1005
1167
  * `POST /datasets/{datasetId}/uploads/{uploadId}/finalize` once the PUT completes.
1006
1168
  *
1007
1169
  */
1008
1170
  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
- };
1171
+ upload: DatasetUploadTarget;
1021
1172
  };
1173
+ /**
1174
+ * The metadata available immediately after creating a dataset, plus its first upload
1175
+ * session — the presigned URL to PUT the file to. Version-derived fields such as
1176
+ * `createdAt`, `currentVersionId`, range, and cadence are available from `GET /datasets/{datasetId}`
1177
+ * after the relevant lifecycle stages, not in this creation response.
1178
+ *
1179
+ */
1180
+ type DatasetCreated = {
1181
+ /**
1182
+ * Opaque id of the newly created dataset.
1183
+ */
1184
+ datasetId: string;
1185
+ /**
1186
+ * Unique name of the newly created dataset.
1187
+ */
1188
+ name: string;
1189
+ /**
1190
+ * Always `ticker` in v1.
1191
+ */
1192
+ type: "ticker";
1193
+ instrument: Instrument;
1194
+ } & DatasetUploadSession;
1022
1195
  /**
1023
1196
  * One successfully ingested upload. Cadence and timestamp unit are discovered from the file,
1024
- * not declared by the caller (D-11).
1197
+ * not declared by the caller.
1025
1198
  *
1026
1199
  */
1027
1200
  type DatasetVersion = {
@@ -1369,6 +1542,12 @@ type CompileStrategyResponses = {
1369
1542
  */
1370
1543
  200: {
1371
1544
  strategyId: StrategyId;
1545
+ /**
1546
+ * What could be established about this strategy's sweep-key vocabulary without
1547
+ * constructing it. See `DeclaredProperty` — best-effort, not exhaustive.
1548
+ *
1549
+ */
1550
+ declaredProperties?: Array<DeclaredProperty>;
1372
1551
  };
1373
1552
  };
1374
1553
  type CompileStrategyResponse = CompileStrategyResponses[keyof CompileStrategyResponses];
@@ -1712,6 +1891,48 @@ type GetSweepSensitivityResponses = {
1712
1891
  200: SweepSensitivity;
1713
1892
  };
1714
1893
  type GetSweepSensitivityResponse = GetSweepSensitivityResponses[keyof GetSweepSensitivityResponses];
1894
+ type GetSweepRunEquityCurveData = {
1895
+ body?: never;
1896
+ path: {
1897
+ exchangeId: string;
1898
+ type: DataSourceType;
1899
+ requestId: string;
1900
+ sweepId: string;
1901
+ /**
1902
+ * The trial's `runIx`, as it appears on its leaderboard row.
1903
+ */
1904
+ runIx: number;
1905
+ };
1906
+ query?: {
1907
+ /**
1908
+ * Requested JSON shape. Omit to use the sweep's submitted default; may be overridden either way by the server's size guard.
1909
+ */
1910
+ outMode?: EquityCurveOutMode;
1911
+ /**
1912
+ * Downsample to at most this many points (extrema-preserving — the global max/min and the exact first/last point are always kept). Omit to use the sweep's submitted default (itself omittable, for no downsampling).
1913
+ */
1914
+ resample?: number;
1915
+ /**
1916
+ * Delta-encode both fields from the second point onward. Omit to use the sweep's submitted default.
1917
+ */
1918
+ differential?: boolean;
1919
+ };
1920
+ url: "/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}/runs/{runIx}/equityCurve";
1921
+ };
1922
+ type GetSweepRunEquityCurveErrors = {
1923
+ /**
1924
+ * Sweep or `runIx` not found, or that trial's curve was never selected — indistinguishable from a caller's perspective.
1925
+ */
1926
+ 404: ResponseError;
1927
+ };
1928
+ type GetSweepRunEquityCurveError = GetSweepRunEquityCurveErrors[keyof GetSweepRunEquityCurveErrors];
1929
+ type GetSweepRunEquityCurveResponses = {
1930
+ /**
1931
+ * The trial's equity curve, shaped per the resolved options.
1932
+ */
1933
+ 200: EquityCurveResult;
1934
+ };
1935
+ type GetSweepRunEquityCurveResponse = GetSweepRunEquityCurveResponses[keyof GetSweepRunEquityCurveResponses];
1715
1936
  type ExecuteBacktestData = {
1716
1937
  /**
1717
1938
  * Execute task parameters
@@ -1728,6 +1949,7 @@ type ExecuteBacktestData = {
1728
1949
  *
1729
1950
  */
1730
1951
  storeSignals?: boolean;
1952
+ equityCurve?: EquityCurveOptions;
1731
1953
  };
1732
1954
  path: {
1733
1955
  /**
@@ -1953,6 +2175,31 @@ type GetDatasetResponses = {
1953
2175
  200: DatasetWithLinks;
1954
2176
  };
1955
2177
  type GetDatasetResponse = GetDatasetResponses[keyof GetDatasetResponses];
2178
+ type OpenDatasetUploadData = {
2179
+ body?: never;
2180
+ path: {
2181
+ /**
2182
+ * The id returned by `POST /datasets`
2183
+ */
2184
+ datasetId: string;
2185
+ };
2186
+ query?: never;
2187
+ url: "/datasets/{datasetId}/uploads";
2188
+ };
2189
+ type OpenDatasetUploadErrors = {
2190
+ /**
2191
+ * No such dataset for this user
2192
+ */
2193
+ 404: ResponseError;
2194
+ };
2195
+ type OpenDatasetUploadError = OpenDatasetUploadErrors[keyof OpenDatasetUploadErrors];
2196
+ type OpenDatasetUploadResponses = {
2197
+ /**
2198
+ * An upload session — new, or the one already open for this dataset
2199
+ */
2200
+ 201: DatasetUploadSession;
2201
+ };
2202
+ type OpenDatasetUploadResponse = OpenDatasetUploadResponses[keyof OpenDatasetUploadResponses];
1956
2203
  type FinalizeDatasetUploadData = {
1957
2204
  body?: never;
1958
2205
  path: {
@@ -1970,11 +2217,18 @@ type FinalizeDatasetUploadData = {
1970
2217
  };
1971
2218
  type FinalizeDatasetUploadErrors = {
1972
2219
  /**
1973
- * No such dataset for this user, or nothing was PUT to `upload.url` yet — a finalize with
1974
- * nothing to finalize.
2220
+ * No such dataset for this user; `uploadId` was not issued for this dataset (never
2221
+ * minted, or minted for a different one); or nothing was PUT to `upload.url` yet — a
2222
+ * finalize with nothing to finalize.
1975
2223
  *
1976
2224
  */
1977
2225
  404: ResponseError;
2226
+ /**
2227
+ * `uploadId` already produced a version. The error message names it. Open a new upload
2228
+ * session (`POST /datasets/{datasetId}/uploads`) for anything new.
2229
+ *
2230
+ */
2231
+ 409: ResponseError;
1978
2232
  /**
1979
2233
  * The uploaded file exceeds your tier's size limit for a dataset.
1980
2234
  */
@@ -2156,9 +2410,14 @@ declare const listStrategies: <ThrowOnError extends boolean = false>(options?: O
2156
2410
  * different means are two strategies, because deciding otherwise would mean deciding program
2157
2411
  * equivalence.
2158
2412
  *
2413
+ * The response also lists `declaredProperties` — the sweep/execute param keys this strategy
2414
+ * is known to accept, so a caller can catch a typo'd key before submitting a sweep instead of
2415
+ * only learning it from a rejected one. See `DeclaredProperty`: best-effort, not exhaustive.
2416
+ *
2159
2417
  */
2160
2418
  declare const compileStrategy: <ThrowOnError extends boolean = false>(options: Options<CompileStrategyData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
2161
2419
  strategyId: StrategyId;
2420
+ declaredProperties?: Array<DeclaredProperty>;
2162
2421
  }, ResponseError, ThrowOnError>;
2163
2422
  /**
2164
2423
  * Check that a registered strategy can actually run
@@ -2329,6 +2588,23 @@ declare const getSweepResult: <ThrowOnError extends boolean = false>(options: Op
2329
2588
  *
2330
2589
  */
2331
2590
  declare const getSweepSensitivity: <ThrowOnError extends boolean = false>(options: Options<GetSweepSensitivityData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<SweepSensitivity, ResponseError, ThrowOnError>;
2591
+ /**
2592
+ * Get one sweep trial's equity curve
2593
+ * The resource a leaderboard row's `equityCurve.url` points at — only reachable when that
2594
+ * trial's curve was actually selected (`equityCurve.mode: topN` or `topPct` on the sweep
2595
+ * submission, and this trial ranked among the winners). Returns the exact same
2596
+ * `{points|timestamps+equities, meta}` shape a plain backtest's inline `equityCurve` carries.
2597
+ *
2598
+ * Query params reshape the response the same way a plain backtest's `equityCurve` options do.
2599
+ * A param genuinely absent from the query string falls back to the `equityCurve` transform
2600
+ * preference the sweep was submitted with — a param
2601
+ * present but malformed does not fall back, it degrades the same way it always has. Above a
2602
+ * server-side size threshold, the shape is forced regardless of either — `meta.outMode` in
2603
+ * the response, not the query string or the submitted default, is the source of truth for
2604
+ * what shape actually came back.
2605
+ *
2606
+ */
2607
+ declare const getSweepRunEquityCurve: <ThrowOnError extends boolean = false>(options: Options<GetSweepRunEquityCurveData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<EquityCurveResult, ResponseError, ThrowOnError>;
2332
2608
  /**
2333
2609
  * Execute a compiled strategy against a prepared dataset
2334
2610
  * Enqueues an execute task that runs the strategy identified by `strategyId` over the data
@@ -2338,8 +2614,9 @@ declare const getSweepSensitivity: <ThrowOnError extends boolean = false>(option
2338
2614
  * Returns immediately with a `jobId`; poll `GET /backtest/{exchangeId}/{type}/execute/{jobId}`
2339
2615
  * for the result.
2340
2616
  *
2341
- * The same params (same `prepareJobId`, `strategyId`, `storeSignals`) always return the same
2342
- * `jobId` (idempotent).
2617
+ * The same params (same `prepareJobId`, `strategyId`, `storeSignals`, `equityCurve`) always
2618
+ * return the same `jobId` (idempotent) — a request that omits `equityCurve` dedupes exactly
2619
+ * as it did before that field existed.
2343
2620
  *
2344
2621
  * Works unchanged for a dataset-backed prepare (`exchangeId: user`) — the request body is
2345
2622
  * identical either way, since the instrument and range are recovered from `prepareJobId`.
@@ -2385,6 +2662,10 @@ declare const listDatasets: <ThrowOnError extends boolean = false>(options?: Opt
2385
2662
  * `POST /datasets/{datasetId}/uploads/{uploadId}/finalize` once the upload completes to kick
2386
2663
  * off ingest.
2387
2664
  *
2665
+ * Losing this response loses nothing: calling this dataset's
2666
+ * `POST /datasets/{datasetId}/uploads` returns the very same upload session again rather than
2667
+ * opening a new one, as long as nothing has been finalized against it yet.
2668
+ *
2388
2669
  * v1 is ticker data only — `type` is not a request field, it is always `"ticker"` in the
2389
2670
  * response. `instrument` must be a plain spot pair (`BASE/QUOTE`, exactly one `/`); derivative
2390
2671
  * forms (e.g. `BTC/USDT:USDT`) are rejected.
@@ -2413,14 +2694,30 @@ declare const deleteDataset: <ThrowOnError extends boolean = false>(options: Opt
2413
2694
  * Detail for one dataset, plus a self link.
2414
2695
  */
2415
2696
  declare const getDataset: <ThrowOnError extends boolean = false>(options: Options<GetDatasetData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<DatasetWithLinks, ResponseError, ThrowOnError>;
2697
+ /**
2698
+ * Open a new upload session for an existing dataset
2699
+ * Get a fresh presigned URL to upload a new version into a dataset you already have — a
2700
+ * corrected file, or the next chunk of history. Behaves the same way `POST /datasets` does
2701
+ * for a brand-new dataset's own upload: at most one upload session is open per dataset at a
2702
+ * time, so calling this again before finalizing just hands back that same session rather
2703
+ * than opening a second one — safe to call repeatedly if a response gets lost.
2704
+ *
2705
+ * Once a session has been finalized (successfully or not), the next call here opens a
2706
+ * genuinely new one for that dataset's next version.
2707
+ *
2708
+ */
2709
+ declare const openDatasetUpload: <ThrowOnError extends boolean = false>(options: Options<OpenDatasetUploadData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<DatasetUploadSession, ResponseError, ThrowOnError>;
2416
2710
  /**
2417
2711
  * 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
2712
+ * Call once the file has been PUT to the `upload.url` from `POST /datasets` (or from
2713
+ * `POST /datasets/{datasetId}/uploads`). Enqueues ingest and returns immediately; poll
2420
2714
  * `GET /datasets/{datasetId}/uploads/{uploadId}` for the result.
2421
2715
  *
2422
- * Idempotent — a repeat finalize of the same upload returns the same `jobId` rather than
2423
- * enqueueing a second ingest.
2716
+ * Idempotent while the upload is still open — a repeat finalize before it has produced a
2717
+ * version returns the same `jobId` rather than enqueueing a second ingest. Once it HAS
2718
+ * produced a version, `uploadId` is spent: finalizing it again is a `409`, even with
2719
+ * different bytes freshly PUT to the same URL — open a new upload session instead
2720
+ * (`POST /datasets/{datasetId}/uploads`) rather than reusing a spent one.
2424
2721
  *
2425
2722
  */
2426
2723
  declare const finalizeDatasetUpload: <ThrowOnError extends boolean = false>(options: Options<FinalizeDatasetUploadData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
@@ -2436,4 +2733,4 @@ declare const getDatasetUpload: <ThrowOnError extends boolean = false>(options:
2436
2733
 
2437
2734
  declare const client: _hey_api_client_fetch.Client;
2438
2735
 
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 };
2736
+ 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 DatasetUploadSession, type DatasetUploadState, type DatasetUploadTarget, type DatasetVersion, type DatasetWithLinks, type DeclaredProperty, 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 EquityCurveMeta, type EquityCurveOptions, type EquityCurveOutMode, type EquityCurveRequest, type EquityCurveResult, 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 GetSweepRunEquityCurveData, type GetSweepRunEquityCurveError, type GetSweepRunEquityCurveErrors, type GetSweepRunEquityCurveResponse, type GetSweepRunEquityCurveResponses, 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 OpenDatasetUploadData, type OpenDatasetUploadError, type OpenDatasetUploadErrors, type OpenDatasetUploadResponse, type OpenDatasetUploadResponses, 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, getSweepRunEquityCurve, getSweepSensitivity, listDatasets, listExchanges, listInstruments, listSegmentInstruments, listStrategies, openDatasetUpload, prepareBacktest, validateStrategy };
package/dist/index.js CHANGED
@@ -209,6 +209,18 @@ var getSweepSensitivity = (options) => {
209
209
  ...options
210
210
  });
211
211
  };
212
+ var getSweepRunEquityCurve = (options) => {
213
+ return (options.client ?? client).get({
214
+ security: [
215
+ {
216
+ scheme: "bearer",
217
+ type: "http"
218
+ }
219
+ ],
220
+ url: "/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}/runs/{runIx}/equityCurve",
221
+ ...options
222
+ });
223
+ };
212
224
  var executeBacktest = (options) => {
213
225
  return (options.client ?? client).post({
214
226
  security: [
@@ -301,6 +313,18 @@ var getDataset = (options) => {
301
313
  ...options
302
314
  });
303
315
  };
316
+ var openDatasetUpload = (options) => {
317
+ return (options.client ?? client).post({
318
+ security: [
319
+ {
320
+ scheme: "bearer",
321
+ type: "http"
322
+ }
323
+ ],
324
+ url: "/datasets/{datasetId}/uploads",
325
+ ...options
326
+ });
327
+ };
304
328
  var finalizeDatasetUpload = (options) => {
305
329
  return (options.client ?? client).post({
306
330
  security: [
@@ -346,12 +370,14 @@ export {
346
370
  getStrategy,
347
371
  getStrategyCode,
348
372
  getSweepResult,
373
+ getSweepRunEquityCurve,
349
374
  getSweepSensitivity,
350
375
  listDatasets,
351
376
  listExchanges,
352
377
  listInstruments,
353
378
  listSegmentInstruments,
354
379
  listStrategies,
380
+ openDatasetUpload,
355
381
  prepareBacktest,
356
382
  validateStrategy
357
383
  };