@qtsurfer/api-client 0.10.0 → 0.12.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 +9 -2
- package/dist/index.d.ts +713 -24
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/generated/schemas.gen.ts +608 -32
- package/src/generated/sdk.gen.ts +242 -2
- package/src/generated/types.gen.ts +680 -21
package/dist/index.d.ts
CHANGED
|
@@ -169,8 +169,32 @@ type Exchange = {
|
|
|
169
169
|
* Managed exchange data sources available for backtesting.
|
|
170
170
|
*/
|
|
171
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
|
+
*/
|
|
172
179
|
type PrepareRequest = {
|
|
173
|
-
|
|
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;
|
|
174
198
|
/**
|
|
175
199
|
* Start date for the preparation process. Supports the following formats:
|
|
176
200
|
* - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
|
|
@@ -195,7 +219,7 @@ type PrepareRequest = {
|
|
|
195
219
|
* labels return `400`.
|
|
196
220
|
*
|
|
197
221
|
*/
|
|
198
|
-
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";
|
|
199
223
|
};
|
|
200
224
|
/**
|
|
201
225
|
* Information about a single job
|
|
@@ -235,12 +259,19 @@ type JobState = {
|
|
|
235
259
|
endTime?: string | null;
|
|
236
260
|
};
|
|
237
261
|
/**
|
|
238
|
-
* State of a single-instrument prepare job — the `JobState` shape plus a
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
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.
|
|
244
275
|
*
|
|
245
276
|
*/
|
|
246
277
|
type PrepareJobState = JobState & {
|
|
@@ -253,21 +284,48 @@ type PrepareJobState = JobState & {
|
|
|
253
284
|
*/
|
|
254
285
|
dataTo?: string | null;
|
|
255
286
|
/**
|
|
256
|
-
* `hoursWithData / totalHours` in `[0,1]` (`1.0` when
|
|
257
|
-
* fraction of hours in the requested range that have served
|
|
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.
|
|
258
292
|
*
|
|
259
293
|
*/
|
|
260
294
|
coverageRatio?: number;
|
|
261
295
|
/**
|
|
262
|
-
* 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
|
+
*
|
|
263
299
|
*/
|
|
264
300
|
totalHours?: number;
|
|
265
301
|
/**
|
|
266
|
-
* 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
|
+
*
|
|
267
305
|
*/
|
|
268
306
|
hoursWithData?: number;
|
|
269
307
|
/**
|
|
270
|
-
*
|
|
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
|
+
*
|
|
271
329
|
*/
|
|
272
330
|
hoursWithoutData?: Array<{
|
|
273
331
|
/**
|
|
@@ -342,6 +400,41 @@ type ExecuteSweepRequest = {
|
|
|
342
400
|
*/
|
|
343
401
|
minTradeFloor?: number;
|
|
344
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;
|
|
345
438
|
};
|
|
346
439
|
/**
|
|
347
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.
|
|
@@ -454,6 +547,10 @@ type SweepRunRow = {
|
|
|
454
547
|
belowTradeFloor: boolean;
|
|
455
548
|
aborted: boolean;
|
|
456
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;
|
|
457
554
|
};
|
|
458
555
|
/**
|
|
459
556
|
* Sensitivity aggregates over a sweep's stored rows. Marginals are always complete; heatmaps may be capped, in which case `heatmapsTruncated` is true.
|
|
@@ -513,6 +610,9 @@ type SweepHeatmapCell = {
|
|
|
513
610
|
};
|
|
514
611
|
type ExecuteSweepResult = {
|
|
515
612
|
sweepId: string;
|
|
613
|
+
/**
|
|
614
|
+
* The sweep's own status vocabulary — not the same set `state.status` below uses. See `state` for why.
|
|
615
|
+
*/
|
|
516
616
|
status: "RUNNING" | "COMPLETED" | "PARTIAL" | "CANCELLED";
|
|
517
617
|
objective: "sharpe" | "sortino" | "pnl" | "maxdd";
|
|
518
618
|
order: "ranked" | "natural";
|
|
@@ -544,6 +644,13 @@ type ExecuteSweepResult = {
|
|
|
544
644
|
truncated: boolean;
|
|
545
645
|
leaderboard: Array<SweepRunRow>;
|
|
546
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;
|
|
547
654
|
};
|
|
548
655
|
/**
|
|
549
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.
|
|
@@ -704,9 +811,9 @@ type ResultMap = {
|
|
|
704
811
|
*/
|
|
705
812
|
maxDrawdownPercent?: number;
|
|
706
813
|
/**
|
|
707
|
-
* Equity curve over the backtest.
|
|
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.
|
|
708
815
|
*/
|
|
709
|
-
equityCurve?:
|
|
816
|
+
equityCurve?: EquityCurveResult;
|
|
710
817
|
/**
|
|
711
818
|
* Number of signals emitted during strategy execution
|
|
712
819
|
*/
|
|
@@ -745,6 +852,57 @@ type EquityPoint = {
|
|
|
745
852
|
*/
|
|
746
853
|
equity: number;
|
|
747
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
|
+
};
|
|
748
906
|
/**
|
|
749
907
|
* Unique identifier for a compiled strategy, derived from the source itself: the same code
|
|
750
908
|
* always yields the same id, for every caller, whatever its formatting. See
|
|
@@ -752,6 +910,51 @@ type EquityPoint = {
|
|
|
752
910
|
*
|
|
753
911
|
*/
|
|
754
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
|
+
};
|
|
755
958
|
/**
|
|
756
959
|
* A diagnostic the engine raised while the strategy ran. Advisory: it describes something worth
|
|
757
960
|
* knowing about how the strategy is wired, not necessarily an error.
|
|
@@ -871,6 +1074,160 @@ type StrategyState = {
|
|
|
871
1074
|
validationStalled?: boolean;
|
|
872
1075
|
_links?: StrategyLinks;
|
|
873
1076
|
};
|
|
1077
|
+
/**
|
|
1078
|
+
* A dataset's own metadata — not its data. `currentVersionId` is what a prepare against
|
|
1079
|
+
* `exchangeId: user` reads by default; see `DatasetVersion` for what a version carries.
|
|
1080
|
+
*
|
|
1081
|
+
* `from`/`to`/`cadence` mirror that current version's own discovered range and cadence, so
|
|
1082
|
+
* you don't need a second call to `GET /datasets/{datasetId}/uploads/{uploadId}` just to see
|
|
1083
|
+
* what a dataset covers. Absent until a version exists.
|
|
1084
|
+
*
|
|
1085
|
+
*/
|
|
1086
|
+
type Dataset = {
|
|
1087
|
+
/**
|
|
1088
|
+
* Opaque id, returned by `POST /datasets`.
|
|
1089
|
+
*/
|
|
1090
|
+
datasetId: string;
|
|
1091
|
+
/**
|
|
1092
|
+
* Unique among your datasets.
|
|
1093
|
+
*/
|
|
1094
|
+
name: string;
|
|
1095
|
+
/**
|
|
1096
|
+
* Always `ticker` in v1.
|
|
1097
|
+
*/
|
|
1098
|
+
type: "ticker";
|
|
1099
|
+
instrument: Instrument;
|
|
1100
|
+
/**
|
|
1101
|
+
* When the dataset was created.
|
|
1102
|
+
*/
|
|
1103
|
+
createdAt: string;
|
|
1104
|
+
/**
|
|
1105
|
+
* The id of the most recently finalized, successfully ingested version. Absent until at
|
|
1106
|
+
* least one upload has finished ingesting.
|
|
1107
|
+
*
|
|
1108
|
+
*/
|
|
1109
|
+
currentVersionId?: string;
|
|
1110
|
+
/**
|
|
1111
|
+
* When `currentVersionId` last changed. Absent until it has a value.
|
|
1112
|
+
*/
|
|
1113
|
+
updatedAt?: string;
|
|
1114
|
+
/**
|
|
1115
|
+
* Start of `currentVersionId`'s own data range, as discovered at ingest time. Absent
|
|
1116
|
+
* until a version exists.
|
|
1117
|
+
*
|
|
1118
|
+
*/
|
|
1119
|
+
from?: string;
|
|
1120
|
+
/**
|
|
1121
|
+
* End of `currentVersionId`'s own data range, as discovered at ingest time. Absent until
|
|
1122
|
+
* a version exists.
|
|
1123
|
+
*
|
|
1124
|
+
*/
|
|
1125
|
+
to?: string;
|
|
1126
|
+
/**
|
|
1127
|
+
* `currentVersionId`'s own discovered bar cadence (e.g. `1s`, `1m`, `1h`). Absent until a
|
|
1128
|
+
* version exists.
|
|
1129
|
+
*
|
|
1130
|
+
*/
|
|
1131
|
+
cadence?: string;
|
|
1132
|
+
};
|
|
1133
|
+
/**
|
|
1134
|
+
* A `Dataset` plus a self link. Returned by `GET /datasets/{datasetId}`.
|
|
1135
|
+
*/
|
|
1136
|
+
type DatasetWithLinks = Dataset & {
|
|
1137
|
+
_links?: {
|
|
1138
|
+
self?: {
|
|
1139
|
+
href?: string;
|
|
1140
|
+
};
|
|
1141
|
+
};
|
|
1142
|
+
};
|
|
1143
|
+
/**
|
|
1144
|
+
* A `Dataset` plus the first upload session — the presigned URL to PUT the file to.
|
|
1145
|
+
*
|
|
1146
|
+
*/
|
|
1147
|
+
type DatasetCreated = Dataset & {
|
|
1148
|
+
/**
|
|
1149
|
+
* Identifies this upload session. Pass to
|
|
1150
|
+
* `POST /datasets/{datasetId}/uploads/{uploadId}/finalize` once the PUT completes.
|
|
1151
|
+
*
|
|
1152
|
+
*/
|
|
1153
|
+
uploadId: string;
|
|
1154
|
+
upload: {
|
|
1155
|
+
/**
|
|
1156
|
+
* Presigned URL. `PUT` the raw CSV file here directly — no `Authorization`
|
|
1157
|
+
* header, no other API credentials.
|
|
1158
|
+
*
|
|
1159
|
+
*/
|
|
1160
|
+
url: string;
|
|
1161
|
+
/**
|
|
1162
|
+
* How long `url` stays valid.
|
|
1163
|
+
*/
|
|
1164
|
+
expiresInMinutes: number;
|
|
1165
|
+
};
|
|
1166
|
+
};
|
|
1167
|
+
/**
|
|
1168
|
+
* One successfully ingested upload. Cadence and timestamp unit are discovered from the file,
|
|
1169
|
+
* not declared by the caller.
|
|
1170
|
+
*
|
|
1171
|
+
*/
|
|
1172
|
+
type DatasetVersion = {
|
|
1173
|
+
datasetId: string;
|
|
1174
|
+
/**
|
|
1175
|
+
* The version id. Pass as `datasetVersionId` on `POST .../prepare` to pin it.
|
|
1176
|
+
*/
|
|
1177
|
+
id?: string;
|
|
1178
|
+
/**
|
|
1179
|
+
* Size of the uploaded file.
|
|
1180
|
+
*/
|
|
1181
|
+
bytes?: number;
|
|
1182
|
+
/**
|
|
1183
|
+
* Number of data rows.
|
|
1184
|
+
*/
|
|
1185
|
+
rows?: number;
|
|
1186
|
+
/**
|
|
1187
|
+
* The discovered bar cadence (e.g. `1s`, `1m`, `1h`).
|
|
1188
|
+
*/
|
|
1189
|
+
cadence?: string;
|
|
1190
|
+
/**
|
|
1191
|
+
* The unit the `timestamp` column was uploaded in — ISO-8601, or the epoch band its
|
|
1192
|
+
* numeric values fell in (seconds, millis, or micros).
|
|
1193
|
+
*
|
|
1194
|
+
*/
|
|
1195
|
+
timestampUnit?: "iso" | "s" | "ms" | "us";
|
|
1196
|
+
/**
|
|
1197
|
+
* Number of gaps at the discovered cadence.
|
|
1198
|
+
*/
|
|
1199
|
+
gaps?: number;
|
|
1200
|
+
/**
|
|
1201
|
+
* The largest gap, in units of the discovered cadence step.
|
|
1202
|
+
*/
|
|
1203
|
+
largestGapSteps?: number;
|
|
1204
|
+
};
|
|
1205
|
+
/**
|
|
1206
|
+
* Progress of one upload, from staged through ingest. Postgres-backed once a version exists,
|
|
1207
|
+
* so `ready`/`failed` are permanent answers; `uploading`/`ingesting` reflect in-flight state
|
|
1208
|
+
* that can itself age out — see the `404` case on `GET .../uploads/{uploadId}`.
|
|
1209
|
+
*
|
|
1210
|
+
*/
|
|
1211
|
+
type DatasetUploadState = {
|
|
1212
|
+
uploadId: string;
|
|
1213
|
+
/**
|
|
1214
|
+
* * `uploading` — the file was PUT to the presigned URL, but `finalize` has not been
|
|
1215
|
+
* called yet.
|
|
1216
|
+
* * `ingesting` — `finalize` was called; the worker is parsing and validating the file.
|
|
1217
|
+
* * `ready` — ingested successfully. `version` carries the result.
|
|
1218
|
+
* * `failed` — ingest rejected the file (e.g. bad CSV contract, mixed timestamp units).
|
|
1219
|
+
*
|
|
1220
|
+
*/
|
|
1221
|
+
status: "uploading" | "ingesting" | "ready" | "failed";
|
|
1222
|
+
/**
|
|
1223
|
+
* The ingest job id, while `status` is `ingesting`.
|
|
1224
|
+
*/
|
|
1225
|
+
jobId?: string;
|
|
1226
|
+
/**
|
|
1227
|
+
* Present when `status` is `ready` or `failed`.
|
|
1228
|
+
*/
|
|
1229
|
+
version?: DatasetVersion;
|
|
1230
|
+
};
|
|
874
1231
|
type AuthTokenResponse = {
|
|
875
1232
|
/**
|
|
876
1233
|
* Short-lived HS256 JWT. Send as `Authorization: Bearer <token>` on all other endpoints.
|
|
@@ -1157,6 +1514,12 @@ type CompileStrategyResponses = {
|
|
|
1157
1514
|
*/
|
|
1158
1515
|
200: {
|
|
1159
1516
|
strategyId: StrategyId;
|
|
1517
|
+
/**
|
|
1518
|
+
* What could be established about this strategy's sweep-key vocabulary without
|
|
1519
|
+
* constructing it. See `DeclaredProperty` — best-effort, not exhaustive.
|
|
1520
|
+
*
|
|
1521
|
+
*/
|
|
1522
|
+
declaredProperties?: Array<DeclaredProperty>;
|
|
1160
1523
|
};
|
|
1161
1524
|
};
|
|
1162
1525
|
type CompileStrategyResponse = CompileStrategyResponses[keyof CompileStrategyResponses];
|
|
@@ -1288,7 +1651,9 @@ type PrepareBacktestData = {
|
|
|
1288
1651
|
body: PrepareRequest;
|
|
1289
1652
|
path: {
|
|
1290
1653
|
/**
|
|
1291
|
-
* ID of the exchange to prepare the backtesting for
|
|
1654
|
+
* ID of the exchange to prepare the backtesting for (e.g. `binance`), or the reserved
|
|
1655
|
+
* value `user` to prepare from a dataset you uploaded instead of a managed exchange.
|
|
1656
|
+
*
|
|
1292
1657
|
*/
|
|
1293
1658
|
exchangeId: string;
|
|
1294
1659
|
/**
|
|
@@ -1302,17 +1667,23 @@ type PrepareBacktestData = {
|
|
|
1302
1667
|
type PrepareBacktestErrors = {
|
|
1303
1668
|
/**
|
|
1304
1669
|
* Invalid request or parameters. Also returned when `from` is older than the configured
|
|
1305
|
-
* lookback window or `to` is in the future.
|
|
1670
|
+
* lookback window or `to` is in the future. For `exchangeId: user`, also returned when
|
|
1671
|
+
* the dataset's current upload has not finished ingesting, or `cadence` asks for a finer
|
|
1672
|
+
* granularity than the dataset's own discovered cadence, or the requested range exceeds
|
|
1673
|
+
* your tier's range limit.
|
|
1306
1674
|
*
|
|
1307
1675
|
*/
|
|
1308
1676
|
400: ResponseError;
|
|
1309
1677
|
/**
|
|
1310
|
-
* Exchange or data source type not found
|
|
1678
|
+
* Exchange or data source type not found. For `exchangeId: user`, also returned when
|
|
1679
|
+
* `datasetId` (or a pinned `datasetVersionId`) doesn't exist or isn't yours.
|
|
1680
|
+
*
|
|
1311
1681
|
*/
|
|
1312
1682
|
404: ResponseError;
|
|
1313
1683
|
/**
|
|
1314
1684
|
* Rate limited. Returned when the global queue exceeds capacity or the user has too many
|
|
1315
|
-
* active backtests.
|
|
1685
|
+
* active backtests. Does not apply to `exchangeId: user` — a dataset prepare reads an
|
|
1686
|
+
* already-ingested file rather than enqueueing worker capacity.
|
|
1316
1687
|
*
|
|
1317
1688
|
*/
|
|
1318
1689
|
429: ResponseError;
|
|
@@ -1329,7 +1700,9 @@ type GetPrepareStatusData = {
|
|
|
1329
1700
|
body?: never;
|
|
1330
1701
|
path: {
|
|
1331
1702
|
/**
|
|
1332
|
-
* ID of the exchange for the backtesting process
|
|
1703
|
+
* ID of the exchange for the backtesting process, or the reserved value `user` for a
|
|
1704
|
+
* dataset-backed prepare.
|
|
1705
|
+
*
|
|
1333
1706
|
*/
|
|
1334
1707
|
exchangeId: string;
|
|
1335
1708
|
/**
|
|
@@ -1490,6 +1863,48 @@ type GetSweepSensitivityResponses = {
|
|
|
1490
1863
|
200: SweepSensitivity;
|
|
1491
1864
|
};
|
|
1492
1865
|
type GetSweepSensitivityResponse = GetSweepSensitivityResponses[keyof GetSweepSensitivityResponses];
|
|
1866
|
+
type GetSweepRunEquityCurveData = {
|
|
1867
|
+
body?: never;
|
|
1868
|
+
path: {
|
|
1869
|
+
exchangeId: string;
|
|
1870
|
+
type: DataSourceType;
|
|
1871
|
+
requestId: string;
|
|
1872
|
+
sweepId: string;
|
|
1873
|
+
/**
|
|
1874
|
+
* The trial's `runIx`, as it appears on its leaderboard row.
|
|
1875
|
+
*/
|
|
1876
|
+
runIx: number;
|
|
1877
|
+
};
|
|
1878
|
+
query?: {
|
|
1879
|
+
/**
|
|
1880
|
+
* Requested JSON shape. Omit to use the sweep's submitted default; may be overridden either way by the server's size guard.
|
|
1881
|
+
*/
|
|
1882
|
+
outMode?: EquityCurveOutMode;
|
|
1883
|
+
/**
|
|
1884
|
+
* 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).
|
|
1885
|
+
*/
|
|
1886
|
+
resample?: number;
|
|
1887
|
+
/**
|
|
1888
|
+
* Delta-encode both fields from the second point onward. Omit to use the sweep's submitted default.
|
|
1889
|
+
*/
|
|
1890
|
+
differential?: boolean;
|
|
1891
|
+
};
|
|
1892
|
+
url: "/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}/runs/{runIx}/equityCurve";
|
|
1893
|
+
};
|
|
1894
|
+
type GetSweepRunEquityCurveErrors = {
|
|
1895
|
+
/**
|
|
1896
|
+
* Sweep or `runIx` not found, or that trial's curve was never selected — indistinguishable from a caller's perspective.
|
|
1897
|
+
*/
|
|
1898
|
+
404: ResponseError;
|
|
1899
|
+
};
|
|
1900
|
+
type GetSweepRunEquityCurveError = GetSweepRunEquityCurveErrors[keyof GetSweepRunEquityCurveErrors];
|
|
1901
|
+
type GetSweepRunEquityCurveResponses = {
|
|
1902
|
+
/**
|
|
1903
|
+
* The trial's equity curve, shaped per the resolved options.
|
|
1904
|
+
*/
|
|
1905
|
+
200: EquityCurveResult;
|
|
1906
|
+
};
|
|
1907
|
+
type GetSweepRunEquityCurveResponse = GetSweepRunEquityCurveResponses[keyof GetSweepRunEquityCurveResponses];
|
|
1493
1908
|
type ExecuteBacktestData = {
|
|
1494
1909
|
/**
|
|
1495
1910
|
* Execute task parameters
|
|
@@ -1506,10 +1921,13 @@ type ExecuteBacktestData = {
|
|
|
1506
1921
|
*
|
|
1507
1922
|
*/
|
|
1508
1923
|
storeSignals?: boolean;
|
|
1924
|
+
equityCurve?: EquityCurveOptions;
|
|
1509
1925
|
};
|
|
1510
1926
|
path: {
|
|
1511
1927
|
/**
|
|
1512
|
-
* ID of the exchange for the backtesting process
|
|
1928
|
+
* ID of the exchange for the backtesting process, or the reserved value `user` if
|
|
1929
|
+
* `prepareJobId` came from a dataset-backed prepare.
|
|
1930
|
+
*
|
|
1513
1931
|
*/
|
|
1514
1932
|
exchangeId: string;
|
|
1515
1933
|
/**
|
|
@@ -1624,6 +2042,179 @@ type GetBacktestResultResponses = {
|
|
|
1624
2042
|
};
|
|
1625
2043
|
};
|
|
1626
2044
|
type GetBacktestResultResponse = GetBacktestResultResponses[keyof GetBacktestResultResponses];
|
|
2045
|
+
type ListDatasetsData = {
|
|
2046
|
+
body?: never;
|
|
2047
|
+
path?: never;
|
|
2048
|
+
query?: never;
|
|
2049
|
+
url: "/datasets";
|
|
2050
|
+
};
|
|
2051
|
+
type ListDatasetsResponses = {
|
|
2052
|
+
/**
|
|
2053
|
+
* Your datasets
|
|
2054
|
+
*/
|
|
2055
|
+
200: {
|
|
2056
|
+
datasets: Array<Dataset>;
|
|
2057
|
+
};
|
|
2058
|
+
};
|
|
2059
|
+
type ListDatasetsResponse = ListDatasetsResponses[keyof ListDatasetsResponses];
|
|
2060
|
+
type CreateDatasetData = {
|
|
2061
|
+
/**
|
|
2062
|
+
* The dataset to create
|
|
2063
|
+
*/
|
|
2064
|
+
body: {
|
|
2065
|
+
/**
|
|
2066
|
+
* A name unique among your datasets. `409` if already taken.
|
|
2067
|
+
*/
|
|
2068
|
+
name: string;
|
|
2069
|
+
instrument: Instrument;
|
|
2070
|
+
};
|
|
2071
|
+
path?: never;
|
|
2072
|
+
query?: never;
|
|
2073
|
+
url: "/datasets";
|
|
2074
|
+
};
|
|
2075
|
+
type CreateDatasetErrors = {
|
|
2076
|
+
/**
|
|
2077
|
+
* Invalid request, or `instrument` is not a plain spot pair
|
|
2078
|
+
*/
|
|
2079
|
+
400: ResponseError;
|
|
2080
|
+
/**
|
|
2081
|
+
* You already have a dataset with this `name`
|
|
2082
|
+
*/
|
|
2083
|
+
409: ResponseError;
|
|
2084
|
+
/**
|
|
2085
|
+
* Your tier's dataset count limit is reached. Delete one, or upgrade.
|
|
2086
|
+
*/
|
|
2087
|
+
429: ResponseError;
|
|
2088
|
+
};
|
|
2089
|
+
type CreateDatasetError = CreateDatasetErrors[keyof CreateDatasetErrors];
|
|
2090
|
+
type CreateDatasetResponses = {
|
|
2091
|
+
/**
|
|
2092
|
+
* Dataset created, with an upload session ready for its first version
|
|
2093
|
+
*/
|
|
2094
|
+
201: DatasetCreated;
|
|
2095
|
+
};
|
|
2096
|
+
type CreateDatasetResponse = CreateDatasetResponses[keyof CreateDatasetResponses];
|
|
2097
|
+
type DeleteDatasetData = {
|
|
2098
|
+
body?: never;
|
|
2099
|
+
path: {
|
|
2100
|
+
/**
|
|
2101
|
+
* The id returned by `POST /datasets`
|
|
2102
|
+
*/
|
|
2103
|
+
datasetId: string;
|
|
2104
|
+
};
|
|
2105
|
+
query?: never;
|
|
2106
|
+
url: "/datasets/{datasetId}";
|
|
2107
|
+
};
|
|
2108
|
+
type DeleteDatasetErrors = {
|
|
2109
|
+
/**
|
|
2110
|
+
* No such dataset for this user, or already deleted
|
|
2111
|
+
*/
|
|
2112
|
+
404: ResponseError;
|
|
2113
|
+
};
|
|
2114
|
+
type DeleteDatasetError = DeleteDatasetErrors[keyof DeleteDatasetErrors];
|
|
2115
|
+
type DeleteDatasetResponses = {
|
|
2116
|
+
/**
|
|
2117
|
+
* Deleted
|
|
2118
|
+
*/
|
|
2119
|
+
200: {
|
|
2120
|
+
datasetId: string;
|
|
2121
|
+
deleted: true;
|
|
2122
|
+
};
|
|
2123
|
+
};
|
|
2124
|
+
type DeleteDatasetResponse = DeleteDatasetResponses[keyof DeleteDatasetResponses];
|
|
2125
|
+
type GetDatasetData = {
|
|
2126
|
+
body?: never;
|
|
2127
|
+
path: {
|
|
2128
|
+
/**
|
|
2129
|
+
* The id returned by `POST /datasets`
|
|
2130
|
+
*/
|
|
2131
|
+
datasetId: string;
|
|
2132
|
+
};
|
|
2133
|
+
query?: never;
|
|
2134
|
+
url: "/datasets/{datasetId}";
|
|
2135
|
+
};
|
|
2136
|
+
type GetDatasetErrors = {
|
|
2137
|
+
/**
|
|
2138
|
+
* No such dataset for this user
|
|
2139
|
+
*/
|
|
2140
|
+
404: ResponseError;
|
|
2141
|
+
};
|
|
2142
|
+
type GetDatasetError = GetDatasetErrors[keyof GetDatasetErrors];
|
|
2143
|
+
type GetDatasetResponses = {
|
|
2144
|
+
/**
|
|
2145
|
+
* Dataset detail
|
|
2146
|
+
*/
|
|
2147
|
+
200: DatasetWithLinks;
|
|
2148
|
+
};
|
|
2149
|
+
type GetDatasetResponse = GetDatasetResponses[keyof GetDatasetResponses];
|
|
2150
|
+
type FinalizeDatasetUploadData = {
|
|
2151
|
+
body?: never;
|
|
2152
|
+
path: {
|
|
2153
|
+
/**
|
|
2154
|
+
* The id returned by `POST /datasets`
|
|
2155
|
+
*/
|
|
2156
|
+
datasetId: string;
|
|
2157
|
+
/**
|
|
2158
|
+
* The `uploadId` returned by `POST /datasets`
|
|
2159
|
+
*/
|
|
2160
|
+
uploadId: string;
|
|
2161
|
+
};
|
|
2162
|
+
query?: never;
|
|
2163
|
+
url: "/datasets/{datasetId}/uploads/{uploadId}/finalize";
|
|
2164
|
+
};
|
|
2165
|
+
type FinalizeDatasetUploadErrors = {
|
|
2166
|
+
/**
|
|
2167
|
+
* No such dataset for this user, or nothing was PUT to `upload.url` yet — a finalize with
|
|
2168
|
+
* nothing to finalize.
|
|
2169
|
+
*
|
|
2170
|
+
*/
|
|
2171
|
+
404: ResponseError;
|
|
2172
|
+
/**
|
|
2173
|
+
* The uploaded file exceeds your tier's size limit for a dataset.
|
|
2174
|
+
*/
|
|
2175
|
+
413: ResponseError;
|
|
2176
|
+
};
|
|
2177
|
+
type FinalizeDatasetUploadError = FinalizeDatasetUploadErrors[keyof FinalizeDatasetUploadErrors];
|
|
2178
|
+
type FinalizeDatasetUploadResponses = {
|
|
2179
|
+
/**
|
|
2180
|
+
* Ingest queued
|
|
2181
|
+
*/
|
|
2182
|
+
202: {
|
|
2183
|
+
jobId: string;
|
|
2184
|
+
};
|
|
2185
|
+
};
|
|
2186
|
+
type FinalizeDatasetUploadResponse = FinalizeDatasetUploadResponses[keyof FinalizeDatasetUploadResponses];
|
|
2187
|
+
type GetDatasetUploadData = {
|
|
2188
|
+
body?: never;
|
|
2189
|
+
path: {
|
|
2190
|
+
/**
|
|
2191
|
+
* The id returned by `POST /datasets`
|
|
2192
|
+
*/
|
|
2193
|
+
datasetId: string;
|
|
2194
|
+
/**
|
|
2195
|
+
* The `uploadId` returned by `POST /datasets`
|
|
2196
|
+
*/
|
|
2197
|
+
uploadId: string;
|
|
2198
|
+
};
|
|
2199
|
+
query?: never;
|
|
2200
|
+
url: "/datasets/{datasetId}/uploads/{uploadId}";
|
|
2201
|
+
};
|
|
2202
|
+
type GetDatasetUploadErrors = {
|
|
2203
|
+
/**
|
|
2204
|
+
* No such dataset for this user, or genuinely nothing is known about this `uploadId` — no
|
|
2205
|
+
* version, no in-flight job, and nothing was ever PUT to its upload URL.
|
|
2206
|
+
*
|
|
2207
|
+
*/
|
|
2208
|
+
404: ResponseError;
|
|
2209
|
+
};
|
|
2210
|
+
type GetDatasetUploadError = GetDatasetUploadErrors[keyof GetDatasetUploadErrors];
|
|
2211
|
+
type GetDatasetUploadResponses = {
|
|
2212
|
+
/**
|
|
2213
|
+
* Current upload/ingest state
|
|
2214
|
+
*/
|
|
2215
|
+
200: DatasetUploadState;
|
|
2216
|
+
};
|
|
2217
|
+
type GetDatasetUploadResponse = GetDatasetUploadResponses[keyof GetDatasetUploadResponses];
|
|
1627
2218
|
type ClientOptions = {
|
|
1628
2219
|
baseUrl: "https://api.qtsurfer.net/v1" | "https://api.qtsurfer.com/v1" | (string & {});
|
|
1629
2220
|
};
|
|
@@ -1759,9 +2350,14 @@ declare const listStrategies: <ThrowOnError extends boolean = false>(options?: O
|
|
|
1759
2350
|
* different means are two strategies, because deciding otherwise would mean deciding program
|
|
1760
2351
|
* equivalence.
|
|
1761
2352
|
*
|
|
2353
|
+
* The response also lists `declaredProperties` — the sweep/execute param keys this strategy
|
|
2354
|
+
* is known to accept, so a caller can catch a typo'd key before submitting a sweep instead of
|
|
2355
|
+
* only learning it from a rejected one. See `DeclaredProperty`: best-effort, not exhaustive.
|
|
2356
|
+
*
|
|
1762
2357
|
*/
|
|
1763
2358
|
declare const compileStrategy: <ThrowOnError extends boolean = false>(options: Options<CompileStrategyData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
|
|
1764
2359
|
strategyId: StrategyId;
|
|
2360
|
+
declaredProperties?: Array<DeclaredProperty>;
|
|
1765
2361
|
}, ResponseError, ThrowOnError>;
|
|
1766
2362
|
/**
|
|
1767
2363
|
* Check that a registered strategy can actually run
|
|
@@ -1829,6 +2425,11 @@ declare const getStrategyCode: <ThrowOnError extends boolean = false>(options: O
|
|
|
1829
2425
|
* The same params always return the same `jobId` (idempotent). Repeated calls with identical
|
|
1830
2426
|
* params do not enqueue duplicate work — they reuse the existing job.
|
|
1831
2427
|
*
|
|
2428
|
+
* **`exchangeId: user` is reserved for your own uploaded data.** Instead of a managed
|
|
2429
|
+
* exchange, it prepares from a dataset you created via `POST /datasets` (see the **Dataset**
|
|
2430
|
+
* endpoints) — send `datasetId` in place of `instrument`. See `PrepareRequest` below for the
|
|
2431
|
+
* two request shapes.
|
|
2432
|
+
*
|
|
1832
2433
|
*/
|
|
1833
2434
|
declare const prepareBacktest: <ThrowOnError extends boolean = false>(options: Options<PrepareBacktestData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AcceptedJob, ResponseError, ThrowOnError>;
|
|
1834
2435
|
/**
|
|
@@ -1836,6 +2437,9 @@ declare const prepareBacktest: <ThrowOnError extends boolean = false>(options: O
|
|
|
1836
2437
|
* Retrieves the current state of the prepare job identified by `jobId`.
|
|
1837
2438
|
* Poll until `status` is `Completed`, `Failed`, or `Aborted`.
|
|
1838
2439
|
*
|
|
2440
|
+
* For a dataset prepare (`exchangeId: user`), coverage is reported against the dataset's own
|
|
2441
|
+
* cadence grid instead of hours — see `cadence`/`gaps`/`largestGapSteps` on `PrepareJobState`.
|
|
2442
|
+
*
|
|
1839
2443
|
*/
|
|
1840
2444
|
declare const getPrepareStatus: <ThrowOnError extends boolean = false>(options: Options<GetPrepareStatusData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<PrepareJobState, ResponseError, ThrowOnError>;
|
|
1841
2445
|
/**
|
|
@@ -1924,6 +2528,23 @@ declare const getSweepResult: <ThrowOnError extends boolean = false>(options: Op
|
|
|
1924
2528
|
*
|
|
1925
2529
|
*/
|
|
1926
2530
|
declare const getSweepSensitivity: <ThrowOnError extends boolean = false>(options: Options<GetSweepSensitivityData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<SweepSensitivity, ResponseError, ThrowOnError>;
|
|
2531
|
+
/**
|
|
2532
|
+
* Get one sweep trial's equity curve
|
|
2533
|
+
* The resource a leaderboard row's `equityCurve.url` points at — only reachable when that
|
|
2534
|
+
* trial's curve was actually selected (`equityCurve.mode: topN` or `topPct` on the sweep
|
|
2535
|
+
* submission, and this trial ranked among the winners). Returns the exact same
|
|
2536
|
+
* `{points|timestamps+equities, meta}` shape a plain backtest's inline `equityCurve` carries.
|
|
2537
|
+
*
|
|
2538
|
+
* Query params reshape the response the same way a plain backtest's `equityCurve` options do.
|
|
2539
|
+
* A param genuinely absent from the query string falls back to the `equityCurve` transform
|
|
2540
|
+
* preference the sweep was submitted with — a param
|
|
2541
|
+
* present but malformed does not fall back, it degrades the same way it always has. Above a
|
|
2542
|
+
* server-side size threshold, the shape is forced regardless of either — `meta.outMode` in
|
|
2543
|
+
* the response, not the query string or the submitted default, is the source of truth for
|
|
2544
|
+
* what shape actually came back.
|
|
2545
|
+
*
|
|
2546
|
+
*/
|
|
2547
|
+
declare const getSweepRunEquityCurve: <ThrowOnError extends boolean = false>(options: Options<GetSweepRunEquityCurveData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<EquityCurveResult, ResponseError, ThrowOnError>;
|
|
1927
2548
|
/**
|
|
1928
2549
|
* Execute a compiled strategy against a prepared dataset
|
|
1929
2550
|
* Enqueues an execute task that runs the strategy identified by `strategyId` over the data
|
|
@@ -1933,8 +2554,12 @@ declare const getSweepSensitivity: <ThrowOnError extends boolean = false>(option
|
|
|
1933
2554
|
* Returns immediately with a `jobId`; poll `GET /backtest/{exchangeId}/{type}/execute/{jobId}`
|
|
1934
2555
|
* for the result.
|
|
1935
2556
|
*
|
|
1936
|
-
* The same params (same `prepareJobId`, `strategyId`, `storeSignals`) always
|
|
1937
|
-
* `jobId` (idempotent)
|
|
2557
|
+
* The same params (same `prepareJobId`, `strategyId`, `storeSignals`, `equityCurve`) always
|
|
2558
|
+
* return the same `jobId` (idempotent) — a request that omits `equityCurve` dedupes exactly
|
|
2559
|
+
* as it did before that field existed.
|
|
2560
|
+
*
|
|
2561
|
+
* Works unchanged for a dataset-backed prepare (`exchangeId: user`) — the request body is
|
|
2562
|
+
* identical either way, since the instrument and range are recovered from `prepareJobId`.
|
|
1938
2563
|
*
|
|
1939
2564
|
*/
|
|
1940
2565
|
declare const executeBacktest: <ThrowOnError extends boolean = false>(options: Options<ExecuteBacktestData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AcceptedJob, ResponseError, ThrowOnError>;
|
|
@@ -1961,7 +2586,71 @@ declare const cancelBacktest: <ThrowOnError extends boolean = false>(options: Op
|
|
|
1961
2586
|
*
|
|
1962
2587
|
*/
|
|
1963
2588
|
declare const getBacktestResult: <ThrowOnError extends boolean = false>(options: Options<GetBacktestResultData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<GetBacktestResultResponse, ResponseError, ThrowOnError>;
|
|
2589
|
+
/**
|
|
2590
|
+
* List your datasets
|
|
2591
|
+
* Every dataset you have created and not deleted, most recently created first. Never a `404`
|
|
2592
|
+
* — an empty array if you have none, same convention as `GET /strategies`.
|
|
2593
|
+
*
|
|
2594
|
+
*/
|
|
2595
|
+
declare const listDatasets: <ThrowOnError extends boolean = false>(options?: Options<ListDatasetsData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
|
|
2596
|
+
datasets: Array<Dataset>;
|
|
2597
|
+
}, unknown, ThrowOnError>;
|
|
2598
|
+
/**
|
|
2599
|
+
* Create a dataset and get a URL to upload it to
|
|
2600
|
+
* Creates a dataset AND its first upload session in one call — a presigned URL your client
|
|
2601
|
+
* PUTs the file to directly, no API credentials involved in that PUT. Call
|
|
2602
|
+
* `POST /datasets/{datasetId}/uploads/{uploadId}/finalize` once the upload completes to kick
|
|
2603
|
+
* off ingest.
|
|
2604
|
+
*
|
|
2605
|
+
* v1 is ticker data only — `type` is not a request field, it is always `"ticker"` in the
|
|
2606
|
+
* response. `instrument` must be a plain spot pair (`BASE/QUOTE`, exactly one `/`); derivative
|
|
2607
|
+
* forms (e.g. `BTC/USDT:USDT`) are rejected.
|
|
2608
|
+
*
|
|
2609
|
+
* **Upload format.** A CSV with a header row. Required columns: `timestamp` (ISO-8601, or
|
|
2610
|
+
* numeric epoch seconds/millis/micros — detected from the first row, then enforced for every
|
|
2611
|
+
* later row), `close`. Optional columns: `open`, `high`, `low`, `volume`, `quoteVolume`,
|
|
2612
|
+
* `bid`, `bidSize`, `ask`, `askSize`. Cadence and timestamp unit are discovered from the data,
|
|
2613
|
+
* not declared.
|
|
2614
|
+
*
|
|
2615
|
+
*/
|
|
2616
|
+
declare const createDataset: <ThrowOnError extends boolean = false>(options: Options<CreateDatasetData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<DatasetCreated, ResponseError, ThrowOnError>;
|
|
2617
|
+
/**
|
|
2618
|
+
* Delete a dataset
|
|
2619
|
+
* Soft-delete — the dataset stops appearing in `GET /datasets`/`GET /datasets/{datasetId}` and
|
|
2620
|
+
* can no longer be prepared from, but its object data is reclaimed later rather than purged
|
|
2621
|
+
* inline, so a backtest already running against one of its versions is not disrupted.
|
|
2622
|
+
*
|
|
2623
|
+
*/
|
|
2624
|
+
declare const deleteDataset: <ThrowOnError extends boolean = false>(options: Options<DeleteDatasetData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
|
|
2625
|
+
datasetId: string;
|
|
2626
|
+
deleted: true;
|
|
2627
|
+
}, ResponseError, ThrowOnError>;
|
|
2628
|
+
/**
|
|
2629
|
+
* Get a dataset by id
|
|
2630
|
+
* Detail for one dataset, plus a self link.
|
|
2631
|
+
*/
|
|
2632
|
+
declare const getDataset: <ThrowOnError extends boolean = false>(options: Options<GetDatasetData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<DatasetWithLinks, ResponseError, ThrowOnError>;
|
|
2633
|
+
/**
|
|
2634
|
+
* Finalize an uploaded file and start ingest
|
|
2635
|
+
* Call once the file has been PUT to the `upload.url` from `POST /datasets`. Enqueues ingest
|
|
2636
|
+
* and returns immediately; poll
|
|
2637
|
+
* `GET /datasets/{datasetId}/uploads/{uploadId}` for the result.
|
|
2638
|
+
*
|
|
2639
|
+
* Idempotent — a repeat finalize of the same upload returns the same `jobId` rather than
|
|
2640
|
+
* enqueueing a second ingest.
|
|
2641
|
+
*
|
|
2642
|
+
*/
|
|
2643
|
+
declare const finalizeDatasetUpload: <ThrowOnError extends boolean = false>(options: Options<FinalizeDatasetUploadData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
|
|
2644
|
+
jobId: string;
|
|
2645
|
+
}, ResponseError, ThrowOnError>;
|
|
2646
|
+
/**
|
|
2647
|
+
* Get the state of an upload/ingest
|
|
2648
|
+
* Poll after `POST .../finalize` until `status` is `ready` or `failed`. Also reports
|
|
2649
|
+
* `uploading` (finalize not called yet, but the file was PUT) before you finalize at all.
|
|
2650
|
+
*
|
|
2651
|
+
*/
|
|
2652
|
+
declare const getDatasetUpload: <ThrowOnError extends boolean = false>(options: Options<GetDatasetUploadData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<DatasetUploadState, ResponseError, ThrowOnError>;
|
|
1964
2653
|
|
|
1965
2654
|
declare const client: _hey_api_client_fetch.Client;
|
|
1966
2655
|
|
|
1967
|
-
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 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 GetBacktestResultData, type GetBacktestResultError, type GetBacktestResultErrors, type GetBacktestResultResponse, type GetBacktestResultResponses, 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 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, deleteStrategy, downloadKlines, downloadTickers, executeBacktest, executeSweep, getBacktestResult, getPrepareStatus, getStrategy, getStrategyCode, getSweepResult, getSweepSensitivity, listExchanges, listInstruments, listSegmentInstruments, listStrategies, prepareBacktest, validateStrategy };
|
|
2656
|
+
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 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 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, prepareBacktest, validateStrategy };
|