@qtsurfer/api-client 0.6.0 → 0.8.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.
@@ -4,14 +4,14 @@
4
4
  * General response error
5
5
  */
6
6
  export type ResponseError = {
7
- /**
8
- * Status code
9
- */
10
- code: number;
11
- /**
12
- * Error description
13
- */
14
- message: string;
7
+ /**
8
+ * Status code
9
+ */
10
+ code: number;
11
+ /**
12
+ * Error description
13
+ */
14
+ message: string;
15
15
  };
16
16
 
17
17
  /**
@@ -23,211 +23,211 @@ export type Instrument = string;
23
23
  * HAL-style response envelope for the instruments listing
24
24
  */
25
25
  export type InstrumentListResponse = {
26
- /**
27
- * The list of instruments for the segment
28
- */
29
- data: Array<InstrumentDetail>;
30
- meta: InstrumentListMeta;
31
- _links: InstrumentLinks;
26
+ /**
27
+ * The list of instruments for the segment
28
+ */
29
+ data: Array<InstrumentDetail>;
30
+ meta: InstrumentListMeta;
31
+ _links: InstrumentLinks;
32
32
  };
33
33
 
34
34
  /**
35
35
  * Metadata describing the instruments listing
36
36
  */
37
37
  export type InstrumentListMeta = {
38
- /**
39
- * When this listing was last refreshed
40
- */
41
- updatedAt: string;
42
- /**
43
- * The exchange the instruments belong to
44
- */
45
- exchange: string;
46
- /**
47
- * The market segment served in `data`
48
- */
49
- segment: 'spot' | 'futures';
38
+ /**
39
+ * When this listing was last refreshed
40
+ */
41
+ updatedAt: string;
42
+ /**
43
+ * The exchange the instruments belong to
44
+ */
45
+ exchange: string;
46
+ /**
47
+ * The market segment served in `data`
48
+ */
49
+ segment: "spot" | "futures";
50
50
  };
51
51
 
52
52
  /**
53
53
  * HAL `_links` — segment discovery for the instruments listing
54
54
  */
55
55
  export type InstrumentLinks = {
56
- /**
57
- * Link to this listing
58
- */
59
- self: HalLink;
60
- /**
61
- * Link to the spot instruments listing. Present when the exchange has a spot segment.
62
- */
63
- spot?: HalLink;
64
- /**
65
- * Link to the futures instruments listing. Present only when the exchange has a futures segment.
66
- */
67
- futures?: HalLink;
56
+ /**
57
+ * Link to this listing
58
+ */
59
+ self: HalLink;
60
+ /**
61
+ * Link to the spot instruments listing. Present when the exchange has a spot segment.
62
+ */
63
+ spot?: HalLink;
64
+ /**
65
+ * Link to the futures instruments listing. Present only when the exchange has a futures segment.
66
+ */
67
+ futures?: HalLink;
68
68
  };
69
69
 
70
70
  /**
71
71
  * A HAL link object (Hypertext Application Language)
72
72
  */
73
73
  export type HalLink = {
74
- /**
75
- * The link target as an absolute-path URI reference (resolve against the API base). A URI Template (RFC 6570) when `templated` is true.
76
- */
77
- href: string;
78
- /**
79
- * True when `href` is an RFC 6570 URI Template.
80
- */
81
- templated?: boolean;
74
+ /**
75
+ * The link target as an absolute-path URI reference (resolve against the API base). A URI Template (RFC 6570) when `templated` is true.
76
+ */
77
+ href: string;
78
+ /**
79
+ * True when `href` is an RFC 6570 URI Template.
80
+ */
81
+ templated?: boolean;
82
82
  };
83
83
 
84
84
  /**
85
85
  * Exchange instrument with per-data-type coverage and market info
86
86
  */
87
87
  export type InstrumentDetail = {
88
- /**
89
- * Instrument identifier (e.g. currency pair)
90
- */
91
- id: string;
92
- /**
93
- * Base currency
94
- */
95
- base: string;
96
- /**
97
- * Quote currency
98
- */
99
- quote: string;
100
- coverage?: InstrumentCoverage;
101
- /**
102
- * Last traded price
103
- */
104
- lastPrice?: number;
105
- /**
106
- * Trading volume in the last 24 hours (in quote currency)
107
- */
108
- volume24h?: number;
88
+ /**
89
+ * Instrument identifier (e.g. currency pair)
90
+ */
91
+ id: string;
92
+ /**
93
+ * Base currency
94
+ */
95
+ base: string;
96
+ /**
97
+ * Quote currency
98
+ */
99
+ quote: string;
100
+ coverage?: InstrumentCoverage;
101
+ /**
102
+ * Last traded price
103
+ */
104
+ lastPrice?: number;
105
+ /**
106
+ * Trading volume in the last 24 hours (in quote currency)
107
+ */
108
+ volume24h?: number;
109
109
  };
110
110
 
111
111
  /**
112
112
  * Time coverage of available data for this instrument, per data type
113
113
  */
114
114
  export type InstrumentCoverage = {
115
- /**
116
- * Coverage of ticker data
117
- */
118
- tickers?: CoverageWindow;
119
- /**
120
- * Coverage of kline (candlestick) data
121
- */
122
- klines?: CoverageWindow;
115
+ /**
116
+ * Coverage of ticker data
117
+ */
118
+ tickers?: CoverageWindow;
119
+ /**
120
+ * Coverage of kline (candlestick) data
121
+ */
122
+ klines?: CoverageWindow;
123
123
  };
124
124
 
125
125
  /**
126
126
  * The time range of available data for a single data type
127
127
  */
128
128
  export type CoverageWindow = {
129
- /**
130
- * Earliest timestamp with data available
131
- */
132
- from?: string;
133
- /**
134
- * Latest timestamp with data available
135
- */
136
- to?: string;
137
- /**
138
- * If the instrument stopped producing this data type (delisted/inactive), the timestamp it went inactive. Optional — omitted while the instrument is active.
139
- */
140
- inactiveSince?: string;
129
+ /**
130
+ * Earliest timestamp with data available
131
+ */
132
+ from?: string;
133
+ /**
134
+ * Latest timestamp with data available
135
+ */
136
+ to?: string;
137
+ /**
138
+ * If the instrument stopped producing this data type (delisted/inactive), the timestamp it went inactive. Optional — omitted while the instrument is active.
139
+ */
140
+ inactiveSince?: string;
141
141
  };
142
142
 
143
143
  /**
144
144
  * Exchange service provider
145
145
  */
146
146
  export type Exchange = {
147
- /**
148
- * Unique identifier for the exchange
149
- */
150
- id: string;
151
- /**
152
- * Name of the exchange
153
- */
154
- name: string;
155
- /**
156
- * Description of the exchange
157
- */
158
- description?: string;
147
+ /**
148
+ * Unique identifier for the exchange
149
+ */
150
+ id: string;
151
+ /**
152
+ * Name of the exchange
153
+ */
154
+ name: string;
155
+ /**
156
+ * Description of the exchange
157
+ */
158
+ description?: string;
159
159
  };
160
160
 
161
161
  /**
162
162
  * Managed exchange data sources available for backtesting.
163
163
  */
164
- export type DataSourceType = 'ticker';
164
+ export type DataSourceType = "ticker";
165
165
 
166
166
  export type PrepareRequest = {
167
- instrument: Instrument;
168
- /**
169
- * Start date for the preparation process. Supports the following formats:
170
- * - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
171
- * - ISO DATE (e.g. 2024-12-14)
172
- * - BASIC ISO DATE (e.g., 20241214)
173
- *
174
- */
175
- from: string;
176
- /**
177
- * End date for the preparation process. Supports the following formats:
178
- * - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
179
- * - ISO DATE (e.g. 2024-12-14)
180
- * - BASIC ISO DATE (e.g., 20241214)
181
- *
182
- */
183
- to: string;
184
- /**
185
- * Output bar cadence for the prepared range. Defaults to the publisher's
186
- * native cadence (`1s`); coarser cadences are produced on demand via
187
- * resampling and stored alongside the native blob in cache. Coarser-than-
188
- * source values must be exact multiples of the source cadence — invalid
189
- * labels return `400`.
190
- *
191
- */
192
- cadence?: '1s' | '5s' | '1m' | '5m' | '15m' | '1h' | '4h' | '1d';
167
+ instrument: Instrument;
168
+ /**
169
+ * Start date for the preparation process. Supports the following formats:
170
+ * - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
171
+ * - ISO DATE (e.g. 2024-12-14)
172
+ * - BASIC ISO DATE (e.g., 20241214)
173
+ *
174
+ */
175
+ from: string;
176
+ /**
177
+ * End date for the preparation process. Supports the following formats:
178
+ * - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
179
+ * - ISO DATE (e.g. 2024-12-14)
180
+ * - BASIC ISO DATE (e.g., 20241214)
181
+ *
182
+ */
183
+ to: string;
184
+ /**
185
+ * Output bar cadence for the prepared range. Defaults to the publisher's
186
+ * native cadence (`1s`); coarser cadences are produced on demand via
187
+ * resampling and stored alongside the native blob in cache. Coarser-than-
188
+ * source values must be exact multiples of the source cadence — invalid
189
+ * labels return `400`.
190
+ *
191
+ */
192
+ cadence?: "1s" | "5s" | "1m" | "5m" | "15m" | "1h" | "4h" | "1d";
193
193
  };
194
194
 
195
195
  /**
196
196
  * Information about a single job
197
197
  */
198
198
  export type JobState = {
199
- /**
200
- * Opaque context identifier for the job
201
- */
202
- contextId: string;
203
- /**
204
- * Current status of the job. Treat `Completed | Aborted | Failed` as
205
- * terminal; `New | Started` mean keep polling. A single-instrument prepare
206
- * is always terminal (`Completed`) — decide from
207
- * `PrepareJobState.coverageRatio`, not by polling.
208
- *
209
- */
210
- status: 'New' | 'Started' | 'Completed' | 'Aborted' | 'Failed';
211
- /**
212
- * Detailed status information, if available
213
- */
214
- statusDetail?: string | null;
215
- /**
216
- * Total size of the data being prepared
217
- */
218
- size: number;
219
- /**
220
- * The amount of data processed so far
221
- */
222
- completed: number;
223
- /**
224
- * Timestamp for when the preparation started
225
- */
226
- startTime?: string | null;
227
- /**
228
- * Timestamp for when the preparation finished
229
- */
230
- endTime?: string | null;
199
+ /**
200
+ * Opaque context identifier for the job
201
+ */
202
+ contextId: string;
203
+ /**
204
+ * Current status of the job. Treat `Completed | Aborted | Failed` as
205
+ * terminal; `New | Started` mean keep polling. A single-instrument prepare
206
+ * is always terminal (`Completed`) — decide from
207
+ * `PrepareJobState.coverageRatio`, not by polling.
208
+ *
209
+ */
210
+ status: "New" | "Started" | "Completed" | "Aborted" | "Failed";
211
+ /**
212
+ * Detailed status information, if available
213
+ */
214
+ statusDetail?: string | null;
215
+ /**
216
+ * Total size of the data being prepared
217
+ */
218
+ size: number;
219
+ /**
220
+ * The amount of data processed so far
221
+ */
222
+ completed: number;
223
+ /**
224
+ * Timestamp for when the preparation started
225
+ */
226
+ startTime?: string | null;
227
+ /**
228
+ * Timestamp for when the preparation finished
229
+ */
230
+ endTime?: string | null;
231
231
  };
232
232
 
233
233
  /**
@@ -240,175 +240,381 @@ export type JobState = {
240
240
  *
241
241
  */
242
242
  export type PrepareJobState = JobState & {
243
- /**
244
- * Start of the available data range for the prepared instrument.
245
- */
246
- dataFrom?: string | null;
247
- /**
248
- * End of the available data range for the prepared instrument.
249
- */
250
- dataTo?: string | null;
251
- /**
252
- * `hoursWithData / totalHours` in `[0,1]` (`1.0` when `totalHours` is 0) — the
253
- * fraction of hours in the requested range that have served data.
243
+ /**
244
+ * Start of the available data range for the prepared instrument.
245
+ */
246
+ dataFrom?: string | null;
247
+ /**
248
+ * End of the available data range for the prepared instrument.
249
+ */
250
+ dataTo?: string | null;
251
+ /**
252
+ * `hoursWithData / totalHours` in `[0,1]` (`1.0` when `totalHours` is 0) — the
253
+ * fraction of hours in the requested range that have served data.
254
+ *
255
+ */
256
+ coverageRatio?: number;
257
+ /**
258
+ * Number of whole hours in the requested prepare range.
259
+ */
260
+ totalHours?: number;
261
+ /**
262
+ * Number of hours in the range that have data.
263
+ */
264
+ hoursWithData?: number;
265
+ /**
266
+ * One entry per hour in the range that has no data, with a rationale.
267
+ */
268
+ hoursWithoutData?: Array<{
269
+ /**
270
+ * The hour (UTC, hour-aligned) that has no data.
271
+ */
272
+ hour?: string;
273
+ /**
274
+ * Expected row count for the hour (currently always 0; reserved for
275
+ * future use). The rationale never depends on it.
254
276
  *
255
277
  */
256
- coverageRatio?: number;
257
- /**
258
- * Number of whole hours in the requested prepare range.
259
- */
260
- totalHours?: number;
278
+ expected?: number;
261
279
  /**
262
- * Number of hours in the range that have data.
263
- */
264
- hoursWithData?: number;
265
- /**
266
- * One entry per hour in the range that has no data, with a rationale.
280
+ * Why the hour has no data. `pending_conversion`: data for this hour is
281
+ * still being produced — a re-poll may fill it. `low_activity`: the
282
+ * instrument did not trade that hour. `unknown`: no data to classify by.
283
+ *
267
284
  */
268
- hoursWithoutData?: Array<{
269
- /**
270
- * The hour (UTC, hour-aligned) that has no data.
271
- */
272
- hour?: string;
273
- /**
274
- * Expected row count for the hour (currently always 0; reserved for
275
- * future use). The rationale never depends on it.
276
- *
277
- */
278
- expected?: number;
279
- /**
280
- * Why the hour has no data. `pending_conversion`: data for this hour is
281
- * still being produced — a re-poll may fill it. `low_activity`: the
282
- * instrument did not trade that hour. `unknown`: no data to classify by.
283
- *
284
- */
285
- rationale?: 'pending_conversion' | 'low_activity' | 'unknown';
286
- }>;
285
+ rationale?: "pending_conversion" | "low_activity" | "unknown";
286
+ }>;
287
287
  };
288
288
 
289
289
  /**
290
290
  * A numeric range or an explicit list of values for one strategy property.
291
291
  */
292
- export type SweepAxis = {
293
- from: number;
294
- to: number;
295
- step: number;
296
- } | {
297
- values: Array<number | boolean>;
298
- };
292
+ export type SweepAxis =
293
+ | {
294
+ from: number;
295
+ to: number;
296
+ step: number;
297
+ }
298
+ | {
299
+ values: Array<number | boolean>;
300
+ };
299
301
 
300
302
  export type SweepSpecRequest = {
301
- sampler?: 'grid' | 'random' | 'lhs';
302
- /**
303
- * Reproducibility seed. If omitted, the server generates one with Java's
304
- * `L64X128MixRandom` generator and returns the effective value. The range
305
- * is limited to JavaScript-safe integers so generated clients can replay it exactly.
306
- *
307
- */
308
- seed?: number;
309
- /**
310
- * Number of samples for `random` and `lhs`; ignored by `grid`.
311
- */
312
- samples?: number;
313
- objective?: 'sharpe' | 'sortino' | 'pnl' | 'maxdd';
314
- params: {
315
- [key: string]: SweepAxis;
316
- };
303
+ sampler?: "grid" | "random" | "lhs";
304
+ /**
305
+ * Reproducibility seed. If omitted, the server generates one with Java's
306
+ * `L64X128MixRandom` generator and returns the effective value. The range
307
+ * is limited to JavaScript-safe integers so generated clients can replay it exactly.
308
+ *
309
+ */
310
+ seed?: number;
311
+ /**
312
+ * Number of samples for `random` and `lhs`; ignored by `grid`.
313
+ */
314
+ samples?: number;
315
+ objective?: "sharpe" | "sortino" | "pnl" | "maxdd";
316
+ params: {
317
+ [key: string]: SweepAxis;
318
+ };
317
319
  };
318
320
 
319
321
  export type SweepBaseConfig = {
320
- initialFunding?: number;
321
- feeRate?: number;
322
- buyFeeRate?: number;
323
- sellFeeRate?: number;
324
- feeLeg?: 'RECEIVED' | 'QUOTE' | 'BASE';
325
- percentAmountToLock?: number;
322
+ initialFunding?: number;
323
+ feeRate?: number;
324
+ buyFeeRate?: number;
325
+ sellFeeRate?: number;
326
+ feeLeg?: "RECEIVED" | "QUOTE" | "BASE";
327
+ percentAmountToLock?: number;
326
328
  };
327
329
 
328
330
  export type ExecuteSweepRequest = {
329
- strategyId: StrategyId;
330
- sweep: SweepSpecRequest;
331
- baseConfig?: SweepBaseConfig;
332
- /**
333
- * Store signals for every trial. Keep false for normal sweeps.
334
- */
335
- storeSignals?: boolean;
336
- /**
337
- * Requested horizontal shard count; 0 or omitted selects automatically.
338
- */
339
- shards?: number;
340
- /**
341
- * Trials below this trade count are flagged but remain in the results.
342
- */
343
- minTradeFloor?: number;
331
+ strategyId: StrategyId;
332
+ sweep: SweepSpecRequest;
333
+ baseConfig?: SweepBaseConfig;
334
+ /**
335
+ * Store signals for every trial. Keep false for normal sweeps.
336
+ */
337
+ storeSignals?: boolean;
338
+ /**
339
+ * Requested horizontal shard count; 0 or omitted selects automatically.
340
+ */
341
+ shards?: number;
342
+ /**
343
+ * Trials below this trade count are flagged but remain in the results.
344
+ */
345
+ minTradeFloor?: number;
346
+ walkForward?: WalkForwardRequest;
347
+ };
348
+
349
+ /**
350
+ * 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.
351
+ */
352
+ export type WalkForwardRequest = {
353
+ /**
354
+ * How many sequential optimize-then-score windows to run. Two is the minimum for a reason, and it is structural rather than a tuning choice: parameter drift is measured between consecutive fold winners, and a single fold — one train/test split with no sequence — has no consecutive pair to compare, so it would report the strongest possible stability having measured nothing.
355
+ * The upper bound is a server setting (12 by default) and is deliberately not pinned here, since a spec that hardcodes a tunable limit lies the day it is raised. Exceeding it, or exceeding the sweep budget once multiplied by the grid size, is a 400.
356
+ */
357
+ folds: number;
358
+ /**
359
+ * Share of the session each fold spends optimizing; the remainder is where its winner is scored. Lower values leave more data to be scored on and, on short sessions, are also what lets the requested fold count tile the data at all.
360
+ */
361
+ inSamplePct?: number;
344
362
  };
345
363
 
346
364
  export type ExecuteSweepAccepted = {
347
- sweepId: string;
348
- requestId: string;
349
- totalRuns: number;
350
- shards: number;
351
- /**
352
- * Effective seed used to expand the sweep.
353
- */
354
- seed: number;
355
- /**
356
- * False when an identical sweep already exists and was not enqueued again.
357
- */
358
- queued: boolean;
365
+ sweepId: string;
366
+ requestId: string;
367
+ totalRuns: number;
368
+ shards: number;
369
+ /**
370
+ * Effective seed used to expand the sweep.
371
+ */
372
+ seed: number;
373
+ /**
374
+ * False when an identical sweep already exists and was not enqueued again.
375
+ */
376
+ queued: boolean;
377
+ walkForward?: WalkForwardAccepted;
359
378
  };
360
379
 
380
+ /**
381
+ * Echo of the accepted walk-forward configuration, present only when the submit carried one. `inSamplePct` is the resolved value, so a request that omitted it can see what it got.
382
+ */
383
+ export type WalkForwardAccepted = {
384
+ folds: number;
385
+ inSamplePct: number;
386
+ /**
387
+ * What this sweep actually costs, `folds × (grid size + 1)` — the in-sample runs for every fold plus each fold's one out-of-sample run. Deliberately distinct from the top-level `totalRuns`, which stays the size of the grid that was submitted.
388
+ */
389
+ totalRuns: number;
390
+ };
391
+
392
+ /**
393
+ * How far along a sweep is, and — when the sweep is still running — enough to tell a healthy one from a stuck one. The counts partition the shards (or, for a walk-forward sweep, the folds): every unit is either finished, failed, waiting to be retried, or not yet started.
394
+ */
361
395
  export type SweepProgress = {
362
- done: number;
363
- total: number;
364
- aborted: number;
365
- shardCount: number;
366
- pendingShards: number;
396
+ done: number;
397
+ total: number;
398
+ /**
399
+ * Individual runs that executed and aborted. A row-level count: a shard that fails before producing any rows leaves this at 0, which is why `failedShards` exists alongside it.
400
+ */
401
+ aborted: number;
402
+ shardCount: number;
403
+ pendingShards: number;
404
+ /**
405
+ * Shards (or folds) that failed and will not be retried. Distinct from `aborted`: this counts whole units that never reported, not runs that ran badly.
406
+ */
407
+ failedShards: number;
408
+ /**
409
+ * Units whose last attempt failed on something transient — an I/O error, a worker that died mid-read — and which are queued to be attempted again. Not counted as failures, because they have not failed yet; a sweep with a non-zero value here is still expected to complete.
410
+ */
411
+ retrying: number;
412
+ /**
413
+ * Units that have not reported anything yet. Covers both work still queued behind other work and work claimed by a worker that stopped before it began, which is why a sweep with a persistent value here and a rising `stalledSeconds` is worth looking at.
414
+ */
415
+ notStarted: number;
416
+ /**
417
+ * Seconds since anything last advanced. Omitted on a finished sweep, where it would only measure how long ago it finished, and on sweeps submitted before this field existed.
418
+ */
419
+ stalledSeconds?: number;
420
+ /**
421
+ * Rough seconds remaining, extrapolated from the rate observed so far and assuming nothing else competes for workers. Runs conservative in practice — it has measured 2–5× long when a sweep spent part of its life waiting to be retried, since that wait dilutes the observed rate. **Omitted, never zero, when it cannot be computed**: a sweep with nothing finished yet has no rate to extrapolate from, and a zero would read as "about to finish". Excludes queue wait entirely; `retrying` and `stalledSeconds` are where that shows up.
422
+ */
423
+ etaSeconds?: number;
367
424
  };
368
425
 
369
426
  export type SweepRunRow = {
370
- /**
371
- * Deterministic zero-based expansion index, stable across shards and ranking.
372
- */
373
- runIx: number;
374
- /**
375
- * Present only in the `ranked` view.
376
- */
377
- rank?: number;
378
- params: {
379
- [key: string]: unknown;
380
- };
381
- sharpe: number;
382
- sortino: number;
383
- /**
384
- * Absolute net PnL in the output currency.
385
- */
386
- pnl: number;
387
- pnlPct: number;
388
- cagr: number;
389
- maxDdPct: number;
390
- trades: number;
391
- winRate: number;
392
- belowTradeFloor: boolean;
393
- aborted: boolean;
394
- runtimeMs: number;
427
+ /**
428
+ * Deterministic zero-based expansion index, stable across shards and ranking.
429
+ */
430
+ runIx: number;
431
+ /**
432
+ * Present only in the `ranked` view.
433
+ */
434
+ rank?: number;
435
+ /**
436
+ * The objective of the worst run in this point's immediate neighbourhood — how well the region around it holds up, not how well it scored itself. Present only in the `ranked` view when plateau ranking applied. Always read together with `neighbourCount`.
437
+ */
438
+ plateauScore?: number;
439
+ /**
440
+ * How many neighbouring parameter points backed the `plateauScore`. Zero means the point had no neighbours in the grid, so its score is unevidenced rather than confirmed — the value alone cannot be distinguished from a genuinely robust one.
441
+ */
442
+ neighbourCount?: number;
443
+ /**
444
+ * Probability that this run's Sharpe reflects real edge rather than the best draw from however many parameter vectors were tried. Above ~0.95 the result survives the multiple-testing correction; near 0.5 or below it is indistinguishable from the best of a pile of coin flips. Absent on aborted runs, and on sweeps with too few trials to establish any dispersion to deflate against.
445
+ */
446
+ deflatedSharpe?: number;
447
+ params: {
448
+ [key: string]: unknown;
449
+ };
450
+ sharpe: number;
451
+ sortino: number;
452
+ /**
453
+ * Absolute net PnL in the output currency.
454
+ */
455
+ pnl: number;
456
+ pnlPct: number;
457
+ cagr: number;
458
+ maxDdPct: number;
459
+ trades: number;
460
+ winRate: number;
461
+ belowTradeFloor: boolean;
462
+ aborted: boolean;
463
+ runtimeMs: number;
464
+ };
465
+
466
+ /**
467
+ * Sensitivity aggregates over a sweep's stored rows. Marginals are always complete; heatmaps may be capped, in which case `heatmapsTruncated` is true.
468
+ */
469
+ export type SweepSensitivity = {
470
+ sweepId?: string;
471
+ status?: "RUNNING" | "COMPLETED" | "PARTIAL" | "CANCELLED";
472
+ objective?: "sharpe" | "sortino" | "pnl" | "maxdd";
473
+ /**
474
+ * Rows available when this was computed. Grows while a sweep is still running.
475
+ */
476
+ rowsAnalysed?: number;
477
+ marginals?: Array<SweepMarginal>;
478
+ heatmaps?: Array<SweepHeatmap>;
479
+ /**
480
+ * True when at least one two-parameter surface was left out to stay inside the response budget. Told explicitly because a silently short list would read as "these are all the interactions", which is the wrong thing to conclude from a sensitivity view.
481
+ */
482
+ heatmapsTruncated?: boolean;
483
+ };
484
+
485
+ /**
486
+ * One axis, with every other axis collapsed away.
487
+ */
488
+ export type SweepMarginal = {
489
+ param?: string;
490
+ points?: Array<SweepMarginalPoint>;
491
+ };
492
+
493
+ /**
494
+ * How the objective behaved at one value of one axis. `best` and `mean` disagreeing is informative rather than noise: a high `best` with a poor `mean` marks a value that only works alongside particular settings of the other axes.
495
+ */
496
+ export type SweepMarginalPoint = {
497
+ /**
498
+ * The axis value, as it appears in a run's parameters.
499
+ */
500
+ value?: unknown;
501
+ /**
502
+ * Non-aborted runs that used this value.
503
+ */
504
+ count?: number;
505
+ best?: number;
506
+ mean?: number;
507
+ worst?: number;
508
+ };
509
+
510
+ /**
511
+ * The surface for one pair of axes, with all others collapsed away.
512
+ */
513
+ export type SweepHeatmap = {
514
+ paramA?: string;
515
+ paramB?: string;
516
+ cells?: Array<SweepHeatmapCell>;
517
+ };
518
+
519
+ export type SweepHeatmapCell = {
520
+ valueA?: unknown;
521
+ valueB?: unknown;
522
+ count?: number;
523
+ best?: number;
524
+ mean?: number;
395
525
  };
396
526
 
397
527
  export type ExecuteSweepResult = {
398
- sweepId: string;
399
- status: 'RUNNING' | 'COMPLETED' | 'PARTIAL' | 'CANCELLED';
400
- objective: 'sharpe' | 'sortino' | 'pnl' | 'maxdd';
401
- order: 'ranked' | 'natural';
402
- progress: SweepProgress;
403
- /**
404
- * Total result rows currently available.
405
- */
406
- leaderboardSize: number;
407
- /**
408
- * True only when the ranked view exceeds its display limit.
409
- */
410
- truncated: boolean;
411
- leaderboard: Array<SweepRunRow>;
528
+ sweepId: string;
529
+ status: "RUNNING" | "COMPLETED" | "PARTIAL" | "CANCELLED";
530
+ objective: "sharpe" | "sortino" | "pnl" | "maxdd";
531
+ order: "ranked" | "natural";
532
+ /**
533
+ * Which ordering was actually applied, which is not always the one requested: a sweep with no stored parameter grid cannot be plateau-ranked and falls back to `raw`. Always `raw` when `order=natural`.
534
+ */
535
+ ranking?: "plateau" | "raw";
536
+ /**
537
+ * Probability of backtest overfitting for the sweep as a whole, by combinatorially symmetric cross-validation: how often the configuration that won in-sample lands below median out-of-sample. Above ~0.5 the sweep is selecting noise, whatever its top row says. Computed once when the last shard finishes, so it is absent while the sweep is still running and on sweeps too small for the statistic to mean anything.
538
+ */
539
+ pbo?: number;
540
+ /**
541
+ * How many train/test splits the `pbo` figure was averaged over.
542
+ */
543
+ pboSplits?: number;
544
+ progress: SweepProgress;
545
+ /**
546
+ * Total result rows currently available.
547
+ */
548
+ leaderboardSize: number;
549
+ /**
550
+ * True only when the ranked view exceeds its display limit.
551
+ */
552
+ truncated: boolean;
553
+ leaderboard: Array<SweepRunRow>;
554
+ walkForward?: WalkForwardResult;
555
+ };
556
+
557
+ /**
558
+ * 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.
559
+ */
560
+ export type WalkForwardResult = {
561
+ /**
562
+ * Folds requested at submit.
563
+ */
564
+ folds: number;
565
+ /**
566
+ * Resolved in-sample share each fold optimized on.
567
+ */
568
+ inSamplePct?: number;
569
+ /**
570
+ * Folds that have finished and reported a winner.
571
+ */
572
+ completedFolds: number;
573
+ /**
574
+ * Mean normalized lattice distance between consecutive fold winners. Low is good: winners that stay in a tight band fold after fold are evidence the parameter means something, while winners that jump across the grid every time are the sweep re-fitting noise, and that backtest will not survive contact with live data. **Absent is not zero** — the field is omitted whenever the figure could not be computed (fewer than two folds finished, no stored grid to place winners on), because zero is itself a meaningful reading here and a placeholder would be indistinguishable from perfect stability.
575
+ */
576
+ paramDrift?: number;
577
+ /**
578
+ * One entry per completed fold, oldest first.
579
+ */
580
+ results: Array<WalkForwardFold>;
581
+ };
582
+
583
+ /**
584
+ * What one fold concluded. The out-of-sample row is the answer; the in-sample figure is only there to be compared against it, since any grid produces a flattering in-sample winner — that is what optimizing does. The gap between them is the whole reading.
585
+ */
586
+ export type WalkForwardFold = {
587
+ /**
588
+ * Position in the walk-forward sequence, oldest first.
589
+ */
590
+ foldIx: number;
591
+ /**
592
+ * First index of the optimization window, into the prepared session.
593
+ */
594
+ inSampleFrom: number;
595
+ /**
596
+ * End of the optimization window, exclusive — and where scoring begins.
597
+ */
598
+ inSampleTo: number;
599
+ /**
600
+ * End of the scoring window, exclusive.
601
+ */
602
+ outOfSampleTo: number;
603
+ /**
604
+ * The parameter vector that won this fold's optimization window.
605
+ */
606
+ params: {
607
+ [key: string]: unknown;
608
+ };
609
+ /**
610
+ * How that winner scored on the window it was chosen on.
611
+ */
612
+ inSampleSharpe: number;
613
+ outOfSample: SweepRunRow;
614
+ /**
615
+ * Vectors this fold evaluated in-sample before picking its winner.
616
+ */
617
+ vectorsRun: number;
412
618
  };
413
619
 
414
620
  /**
@@ -417,827 +623,1050 @@ export type ExecuteSweepResult = {
417
623
  *
418
624
  */
419
625
  export type AcceptedJob = {
420
- /**
421
- * Unique job identifier; use this to poll for completion.
422
- */
423
- jobId: string;
626
+ /**
627
+ * Unique job identifier; use this to poll for completion.
628
+ */
629
+ jobId: string;
424
630
  };
425
631
 
426
632
  /**
427
633
  * Backtest job result.
428
634
  */
429
635
  export type BacktestJobResult = {
430
- results: ResultMap;
431
- state: JobState;
636
+ results: ResultMap;
637
+ state: JobState;
432
638
  };
433
639
 
434
640
  /**
435
- * Execution result map. Always includes core fields (hostName, iops, strategyId, instrument). Yield metrics (pnlTotal, pnlTotalPercent, totalTrades, winRate, equityCurve, etc.) are present when the strategy emitted at least one trade. When signal storage is enabled, includes signal fields described below.
641
+ * Execution result map. Always includes core fields (hostName, iops, strategyId, instrument). Yield metrics (pnlTotal, pnlTotalPercent, totalTrades, winRate, equityCurve, etc.) are present when the strategy emitted at least one trade. When signal storage is enabled, includes signal fields described below. `notices` carries what the run had to say about itself, and is absent when it had nothing.
436
642
  */
437
643
  export type ResultMap = {
438
- /**
439
- * Identifier of the worker that executed the strategy. Useful when reporting issues so support can correlate with logs.
440
- */
441
- hostName?: string;
442
- /**
443
- * Instrument operations per second throughput during execution
444
- */
445
- iops?: number;
446
- /**
447
- * Identifier of the compiled strategy that produced this result
448
- */
449
- strategyId: string;
450
- /**
451
- * The instrument (currency pair) that was backtested
452
- */
453
- instrument: string;
454
- /**
455
- * Total profit and loss in the output currency
456
- */
457
- pnlTotal?: number;
458
- /**
459
- * Total PnL as a percentage of the initial capital (`backtestFunding`). Zero when `backtestFunding` is 0.
460
- */
461
- pnlTotalPercent?: number;
462
- /**
463
- * Total number of trades executed by the strategy
464
- */
465
- totalTrades?: number;
466
- /**
467
- * Percentage of profitable trades (0-100)
468
- */
469
- winRate?: number;
470
- /**
471
- * Risk-adjusted return ratio (mean return / standard deviation of returns)
472
- */
473
- sharpeRatio?: number;
474
- /**
475
- * Downside risk-adjusted return ratio (mean return / downside deviation)
476
- */
477
- sortinoRatio?: number;
478
- /**
479
- * Compound Annual Growth Rate
480
- */
481
- cagr?: number;
482
- /**
483
- * Maximum absolute drawdown in the output currency
484
- */
485
- maxDrawdown?: number;
486
- /**
487
- * Maximum percentage drawdown from peak equity
488
- */
489
- maxDrawdownPercent?: number;
490
- /**
491
- * 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.
492
- */
493
- equityCurve?: Array<EquityPoint>;
494
- /**
495
- * Number of signals emitted during strategy execution
496
- */
497
- signalCount?: number;
498
- /**
499
- * Storage key for the signals file. Treat as opaque; use signalsUrl to download.
500
- */
501
- signalsId?: string;
502
- /**
503
- * HTTPS URL to download the signals Parquet file. Use signalsUpload to know when it's ready.
504
- */
505
- signalsUrl?: string;
506
- /**
507
- * Upload status. Done = signal file is available at signalsUrl. Failed = upload error (see signalsUploadReason). Skipped = no signals emitted.
508
- */
509
- signalsUpload?: 'Done' | 'Failed' | 'Skipped';
510
- /**
511
- * ISO 8601 timestamp of when the upload completed. Only present when signalsUpload is Done.
512
- */
513
- signalsUploadedAt?: string;
514
- /**
515
- * Human-readable reason when signalsUpload is Failed or Skipped.
516
- */
517
- signalsUploadReason?: string;
644
+ /**
645
+ * Identifier of the worker that executed the strategy. Useful when reporting issues so support can correlate with logs.
646
+ */
647
+ hostName?: string;
648
+ /**
649
+ * Instrument operations per second throughput during execution
650
+ */
651
+ iops?: number;
652
+ /**
653
+ * **Not the `strategyId` you compiled with** this is the execution context id,
654
+ * `strategy:<user>:<strategyId>`. The compiled strategy's id is the last `:`-separated
655
+ * segment; that, not this whole string, is what `GET /strategy/{strategyId}` takes.
656
+ *
657
+ * Take the segment after the last `:` rather than counting from the front: the shape has
658
+ * changed once already and callers that indexed a fixed position broke on it.
659
+ *
660
+ */
661
+ strategyId: string;
662
+ /**
663
+ * The instrument (currency pair) that was backtested
664
+ */
665
+ instrument: string;
666
+ /**
667
+ * Diagnostics the engine raised over this run, each with `provenance: execute`.
668
+ *
669
+ * **Absent means nothing was raised.** This is the one surface where silence is a real
670
+ * answer: the run happened, over your data, start to finish, and the engine found nothing
671
+ * worth saying. That is not true of the compile path, where an empty list only means a
672
+ * short synthetic series reached nothing — see `GET /strategy/{strategyId}`.
673
+ *
674
+ * Notices are raised on failed and aborted runs too, and those are the ones most worth
675
+ * reading: a run that produced no trades often did so for a reason stated here.
676
+ *
677
+ */
678
+ notices?: Array<Notice>;
679
+ /**
680
+ * How many notices were dropped past the cap of 50. Absent when none were. A large value usually means one fault repeating per instrument or per parameter vector rather than 50 distinct problems.
681
+ */
682
+ noticesTruncated?: number;
683
+ /**
684
+ * Total profit and loss in the output currency
685
+ */
686
+ pnlTotal?: number;
687
+ /**
688
+ * Total PnL as a percentage of the initial capital (`backtestFunding`). Zero when `backtestFunding` is 0.
689
+ */
690
+ pnlTotalPercent?: number;
691
+ /**
692
+ * Total number of trades executed by the strategy
693
+ */
694
+ totalTrades?: number;
695
+ /**
696
+ * Percentage of profitable trades (0-100)
697
+ */
698
+ winRate?: number;
699
+ /**
700
+ * Risk-adjusted return ratio (mean return / standard deviation of returns)
701
+ */
702
+ sharpeRatio?: number;
703
+ /**
704
+ * Downside risk-adjusted return ratio (mean return / downside deviation)
705
+ */
706
+ sortinoRatio?: number;
707
+ /**
708
+ * Compound Annual Growth Rate
709
+ */
710
+ cagr?: number;
711
+ /**
712
+ * Maximum absolute drawdown in the output currency
713
+ */
714
+ maxDrawdown?: number;
715
+ /**
716
+ * Maximum percentage drawdown from peak equity
717
+ */
718
+ maxDrawdownPercent?: number;
719
+ /**
720
+ * 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.
721
+ */
722
+ equityCurve?: Array<EquityPoint>;
723
+ /**
724
+ * Number of signals emitted during strategy execution
725
+ */
726
+ signalCount?: number;
727
+ /**
728
+ * Storage key for the signals file. Treat as opaque; use signalsUrl to download.
729
+ */
730
+ signalsId?: string;
731
+ /**
732
+ * HTTPS URL to download the signals Parquet file. Use signalsUpload to know when it's ready.
733
+ */
734
+ signalsUrl?: string;
735
+ /**
736
+ * Upload status. Done = signal file is available at signalsUrl. Failed = upload error (see signalsUploadReason). Skipped = no signals emitted.
737
+ */
738
+ signalsUpload?: "Done" | "Failed" | "Skipped";
739
+ /**
740
+ * ISO 8601 timestamp of when the upload completed. Only present when signalsUpload is Done.
741
+ */
742
+ signalsUploadedAt?: string;
743
+ /**
744
+ * Human-readable reason when signalsUpload is Failed or Skipped.
745
+ */
746
+ signalsUploadReason?: string;
518
747
  };
519
748
 
520
749
  /**
521
750
  * Single sample of the running equity at a yield event.
522
751
  */
523
752
  export type EquityPoint = {
524
- /**
525
- * Epoch milliseconds. The first point in an equity curve is anchored at the backtest `from`; subsequent points carry the timestamp of each emitted yield.
526
- */
527
- timestamp: number;
528
- /**
529
- * Running equity at this point (`initialCapital + cumulativePnl`).
530
- */
531
- equity: number;
753
+ /**
754
+ * Epoch milliseconds. The first point in an equity curve is anchored at the backtest `from`; subsequent points carry the timestamp of each emitted yield.
755
+ */
756
+ timestamp: number;
757
+ /**
758
+ * Running equity at this point (`initialCapital + cumulativePnl`).
759
+ */
760
+ equity: number;
532
761
  };
533
762
 
534
763
  /**
535
- * Unique identifier for a compiled strategy
764
+ * Unique identifier for a compiled strategy, derived from the source itself: the same code
765
+ * always yields the same id, for every caller, whatever its formatting. See
766
+ * `POST /strategy` for exactly which rewrites preserve it and which do not.
767
+ *
536
768
  */
537
769
  export type StrategyId = string;
538
770
 
771
+ /**
772
+ * A diagnostic the engine raised while the strategy ran. Advisory: it describes something worth
773
+ * knowing about how the strategy is wired, not necessarily an error.
774
+ *
775
+ */
776
+ export type Notice = {
777
+ /**
778
+ * Severity as the engine classified it.
779
+ */
780
+ level: string;
781
+ /**
782
+ * Stable identifier for the kind of finding; safe to match on.
783
+ */
784
+ code: string;
785
+ /**
786
+ * Human-readable explanation.
787
+ */
788
+ message: string;
789
+ /**
790
+ * Where it came from, which matters because the two silences differ: an empty list from a
791
+ * real run (`execute`) is a clean bill of health, while an empty list from
792
+ * `compile-dry-run` is only a lower bound over a bounded synthetic series.
793
+ *
794
+ */
795
+ provenance?: "execute" | "compile-dry-run";
796
+ };
797
+
798
+ /**
799
+ * What is known about a registered strategy: that it compiled, and what validating it found.
800
+ *
801
+ * **`validation: passed` does not mean the strategy is correct.** It means the class loaded and
802
+ * survived the first event of a short synthetic run — a floor, not a guarantee. When
803
+ * `dryRunIncomplete` is true it is a lower floor still, because the run did not finish.
804
+ *
805
+ */
806
+ export type StrategyState = {
807
+ strategyId: StrategyId;
808
+ /**
809
+ * * `not_validated` — registered, never checked. `POST /strategy/{strategyId}/validate`
810
+ * checks it.
811
+ * * `pending` — a check was asked for and has not answered yet.
812
+ * * `passed` — the class loaded and survived its first event.
813
+ * * `failed` — it did not; `detail` says how.
814
+ *
815
+ */
816
+ validation: "not_validated" | "pending" | "passed" | "failed";
817
+ /**
818
+ * When the live compilation was produced.
819
+ */
820
+ compiledAt?: string;
821
+ /**
822
+ * The market data a strategy needs, read off the compiled class rather than off anything
823
+ * you sent — `TickerStrategy`, `KlineStrategy` and `FundingRateStrategy` each declare one,
824
+ * and a `MultiSourceStrategy` declares a set.
825
+ *
826
+ * **Absent is not "needs nothing".** A strategy always needs market data, so an absent
827
+ * field never means an empty requirement — it means the platform could not establish the
828
+ * answer without constructing your strategy, which it will not do to fill in a field.
829
+ * That happens for a `MultiSourceStrategy`, for a class that overrides
830
+ * `getMarketDataSource()`, and for anything registered before this field existed;
831
+ * re-registering the source fills it in.
832
+ *
833
+ */
834
+ requiredSources?: Array<"Ticker" | "KLine" | "FundingRate">;
835
+ /**
836
+ * When the verdict was recorded. Absent until there is one.
837
+ */
838
+ validatedAt?: string;
839
+ /**
840
+ * Why validation failed, or why a queued check has not reported. Present on `failed`, and
841
+ * alongside `validationStalled`.
842
+ *
843
+ */
844
+ detail?: string;
845
+ /**
846
+ * What the run surfaced. An empty or absent list is not a clean bill of health when
847
+ * `dryRunIncomplete` is true — see that field.
848
+ *
849
+ */
850
+ notices?: Array<Notice>;
851
+ /**
852
+ * How many notices were dropped past the cap. Absent when none were.
853
+ */
854
+ noticesTruncated?: number;
855
+ /**
856
+ * The check did not finish its budget — it ran out of time, was refused because the
857
+ * platform was already holding too many unfinishable runs, or hit a failure attributable to
858
+ * the synthetic instrument rather than to your strategy. The verdict stands as far as it
859
+ * went; it simply reached less than a full run would.
860
+ *
861
+ */
862
+ dryRunIncomplete?: boolean;
863
+ /**
864
+ * A queued check has not reported for far longer than one takes. Nothing is disproved about
865
+ * the strategy — the check has not run. Stop waiting and re-request it later.
866
+ *
867
+ */
868
+ validationStalled?: boolean;
869
+ };
870
+
539
871
  export type AuthTokenResponse = {
540
- /**
541
- * Short-lived HS256 JWT. Send as `Authorization: Bearer <token>` on all other endpoints.
542
- */
543
- access_token: string;
544
- /**
545
- * Always `Bearer`.
546
- */
547
- token_type: 'Bearer';
548
- /**
549
- * Seconds until the JWT expires (typically 3600).
550
- */
551
- expires_in: number;
552
- /**
553
- * Scopes granted to this token. Reserved for future use; currently always empty.
554
- */
555
- scopes?: Array<string>;
556
- /**
557
- * Subscription tier this token was issued for. Drives rate limits and feature flags on downstream endpoints.
558
- */
559
- tier: 'free' | 'basic' | 'pro' | 'elite';
872
+ /**
873
+ * Short-lived HS256 JWT. Send as `Authorization: Bearer <token>` on all other endpoints.
874
+ */
875
+ access_token: string;
876
+ /**
877
+ * Always `Bearer`.
878
+ */
879
+ token_type: "Bearer";
880
+ /**
881
+ * Seconds until the JWT expires (typically 3600).
882
+ */
883
+ expires_in: number;
884
+ /**
885
+ * Scopes granted to this token. Reserved for future use; currently always empty.
886
+ */
887
+ scopes?: Array<string>;
888
+ /**
889
+ * Subscription tier this token was issued for. Drives rate limits and feature flags on downstream endpoints.
890
+ */
891
+ tier: "free" | "basic" | "pro" | "elite";
560
892
  };
561
893
 
562
894
  /**
563
895
  * Error envelope returned by `POST /auth/token` when the API key is rejected.
564
896
  */
565
897
  export type AuthTokenError = {
566
- /**
567
- * Machine-readable error reason.
568
- */
569
- code: 'invalid_apikey' | 'apikey_revoked' | 'apikey_expired';
570
- /**
571
- * Human-readable description of the failure.
572
- */
573
- message: string;
898
+ /**
899
+ * Machine-readable error reason.
900
+ */
901
+ code: "invalid_apikey" | "apikey_revoked" | "apikey_expired";
902
+ /**
903
+ * Human-readable description of the failure.
904
+ */
905
+ message: string;
574
906
  };
575
907
 
576
908
  export type AuthenticateData = {
577
- body?: never;
578
- path?: never;
579
- query?: never;
580
- url: '/auth/token';
909
+ body?: never;
910
+ path?: never;
911
+ query?: never;
912
+ url: "/auth/token";
581
913
  };
582
914
 
583
915
  export type AuthenticateErrors = {
584
- /**
585
- * API key is invalid, revoked, or expired.
586
- */
587
- 401: AuthTokenError;
588
- /**
589
- * Rate limit exceeded for this API key.
590
- */
591
- 429: unknown;
916
+ /**
917
+ * API key is invalid, revoked, or expired.
918
+ */
919
+ 401: AuthTokenError;
920
+ /**
921
+ * Rate limit exceeded for this API key.
922
+ */
923
+ 429: unknown;
592
924
  };
593
925
 
594
926
  export type AuthenticateError = AuthenticateErrors[keyof AuthenticateErrors];
595
927
 
596
928
  export type AuthenticateResponses = {
597
- /**
598
- * API key accepted; JWT returned.
599
- */
600
- 200: AuthTokenResponse;
929
+ /**
930
+ * API key accepted; JWT returned.
931
+ */
932
+ 200: AuthTokenResponse;
601
933
  };
602
934
 
603
- export type AuthenticateResponse = AuthenticateResponses[keyof AuthenticateResponses];
935
+ export type AuthenticateResponse =
936
+ AuthenticateResponses[keyof AuthenticateResponses];
604
937
 
605
938
  export type ListExchangesData = {
606
- body?: never;
607
- path?: never;
608
- query?: never;
609
- url: '/exchanges';
939
+ body?: never;
940
+ path?: never;
941
+ query?: never;
942
+ url: "/exchanges";
610
943
  };
611
944
 
612
945
  export type ListExchangesResponses = {
613
- /**
614
- * A JSON array of Exchanges
615
- */
616
- 200: Array<Exchange>;
946
+ /**
947
+ * A JSON array of Exchanges
948
+ */
949
+ 200: Array<Exchange>;
617
950
  };
618
951
 
619
- export type ListExchangesResponse = ListExchangesResponses[keyof ListExchangesResponses];
952
+ export type ListExchangesResponse =
953
+ ListExchangesResponses[keyof ListExchangesResponses];
620
954
 
621
955
  export type ListInstrumentsData = {
622
- body?: never;
623
- path: {
624
- /**
625
- * ID of the exchange to retrieve instruments for
626
- */
627
- exchangeId: string;
628
- };
629
- query?: never;
630
- url: '/exchange/{exchangeId}/instruments';
956
+ body?: never;
957
+ path: {
958
+ /**
959
+ * ID of the exchange to retrieve instruments for
960
+ */
961
+ exchangeId: string;
962
+ };
963
+ query?: never;
964
+ url: "/exchange/{exchangeId}/instruments";
631
965
  };
632
966
 
633
967
  export type ListInstrumentsErrors = {
634
- /**
635
- * Exchange not found or instrument catalog not available
636
- */
637
- 404: ResponseError;
968
+ /**
969
+ * Exchange not found or instrument catalog not available
970
+ */
971
+ 404: ResponseError;
638
972
  };
639
973
 
640
- export type ListInstrumentsError = ListInstrumentsErrors[keyof ListInstrumentsErrors];
974
+ export type ListInstrumentsError =
975
+ ListInstrumentsErrors[keyof ListInstrumentsErrors];
641
976
 
642
977
  export type ListInstrumentsResponses = {
643
- /**
644
- * The default (spot) segment's instruments in `data`, `meta`, and HAL `_links` (self + spot/futures segment discovery)
645
- */
646
- 200: InstrumentListResponse;
978
+ /**
979
+ * The default (spot) segment's instruments in `data`, `meta`, and HAL `_links` (self + spot/futures segment discovery)
980
+ */
981
+ 200: InstrumentListResponse;
647
982
  };
648
983
 
649
- export type ListInstrumentsResponse = ListInstrumentsResponses[keyof ListInstrumentsResponses];
984
+ export type ListInstrumentsResponse =
985
+ ListInstrumentsResponses[keyof ListInstrumentsResponses];
650
986
 
651
987
  export type ListSegmentInstrumentsData = {
652
- body?: never;
653
- path: {
654
- /**
655
- * ID of the exchange to retrieve instruments for
656
- */
657
- exchangeId: string;
658
- /**
659
- * Market segment to list instruments for
660
- */
661
- segment: 'spot' | 'futures';
662
- };
663
- query?: never;
664
- url: '/exchange/{exchangeId}/{segment}/instruments';
988
+ body?: never;
989
+ path: {
990
+ /**
991
+ * ID of the exchange to retrieve instruments for
992
+ */
993
+ exchangeId: string;
994
+ /**
995
+ * Market segment to list instruments for
996
+ */
997
+ segment: "spot" | "futures";
998
+ };
999
+ query?: never;
1000
+ url: "/exchange/{exchangeId}/{segment}/instruments";
665
1001
  };
666
1002
 
667
1003
  export type ListSegmentInstrumentsErrors = {
668
- /**
669
- * Exchange, segment, or instrument catalog not found
670
- */
671
- 404: ResponseError;
1004
+ /**
1005
+ * Exchange, segment, or instrument catalog not found
1006
+ */
1007
+ 404: ResponseError;
672
1008
  };
673
1009
 
674
- export type ListSegmentInstrumentsError = ListSegmentInstrumentsErrors[keyof ListSegmentInstrumentsErrors];
1010
+ export type ListSegmentInstrumentsError =
1011
+ ListSegmentInstrumentsErrors[keyof ListSegmentInstrumentsErrors];
675
1012
 
676
1013
  export type ListSegmentInstrumentsResponses = {
677
- /**
678
- * An object with a `data` array of instrument details (each with per-data-type coverage) and a `meta` block
679
- */
680
- 200: InstrumentListResponse;
1014
+ /**
1015
+ * An object with a `data` array of instrument details (each with per-data-type coverage) and a `meta` block
1016
+ */
1017
+ 200: InstrumentListResponse;
681
1018
  };
682
1019
 
683
- export type ListSegmentInstrumentsResponse = ListSegmentInstrumentsResponses[keyof ListSegmentInstrumentsResponses];
1020
+ export type ListSegmentInstrumentsResponse =
1021
+ ListSegmentInstrumentsResponses[keyof ListSegmentInstrumentsResponses];
684
1022
 
685
1023
  export type DownloadTickersData = {
686
- body?: never;
687
- path: {
688
- /**
689
- * ID of the exchange (e.g. `binance`).
690
- */
691
- exchangeId: string;
692
- /**
693
- * Base asset symbol (first leg of the pair).
694
- */
695
- base: string;
696
- /**
697
- * Quote asset symbol (second leg of the pair).
698
- */
699
- quote: string;
700
- };
701
- query: {
702
- /**
703
- * Hour selector in `YYYY-MM-DDTHH` (UTC). The returned segment covers
704
- * `[HH:00:00Z, HH+1:00:00Z)`.
705
- *
706
- */
707
- hour: string;
708
- /**
709
- * Response wire format. `lastra` (default) returns raw Lastra bytes.
710
- * `parquet` returns Parquet via on-the-fly conversion using
711
- * [lastra-convert](https://github.com/QTSurfer/lastra-convert).
712
- *
713
- */
714
- format?: 'lastra' | 'parquet';
715
- };
716
- url: '/exchange/{exchangeId}/tickers/{base}/{quote}';
717
- };
718
-
719
- export type DownloadTickersErrors = {
1024
+ body?: never;
1025
+ path: {
720
1026
  /**
721
- * Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
1027
+ * ID of the exchange (e.g. `binance`).
722
1028
  */
723
- 400: ResponseError;
1029
+ exchangeId: string;
724
1030
  /**
725
- * No Lastra segment exists for the requested instrument/hour.
1031
+ * Base asset symbol (first leg of the pair).
726
1032
  */
727
- 404: ResponseError;
1033
+ base: string;
728
1034
  /**
729
- * Unexpected I/O error serving the file.
1035
+ * Quote asset symbol (second leg of the pair).
730
1036
  */
731
- 500: ResponseError;
732
- };
733
-
734
- export type DownloadTickersError = DownloadTickersErrors[keyof DownloadTickersErrors];
735
-
736
- export type DownloadTickersResponses = {
1037
+ quote: string;
1038
+ };
1039
+ query: {
737
1040
  /**
738
- * One hour of tickers for the instrument. `Content-Type` is
739
- * `application/vnd.lastra` by default or
740
- * `application/vnd.apache.parquet` when `format=parquet` was
741
- * requested.
1041
+ * Hour selector in `YYYY-MM-DDTHH` (UTC). The returned segment covers
1042
+ * `[HH:00:00Z, HH+1:00:00Z)`.
742
1043
  *
743
1044
  */
744
- 200: Blob | File;
1045
+ hour: string;
1046
+ /**
1047
+ * Response wire format. `lastra` (default) returns raw Lastra bytes.
1048
+ * `parquet` returns Parquet via on-the-fly conversion using
1049
+ * [lastra-convert](https://github.com/QTSurfer/lastra-convert).
1050
+ *
1051
+ */
1052
+ format?: "lastra" | "parquet";
1053
+ };
1054
+ url: "/exchange/{exchangeId}/tickers/{base}/{quote}";
745
1055
  };
746
1056
 
747
- export type DownloadTickersResponse = DownloadTickersResponses[keyof DownloadTickersResponses];
1057
+ export type DownloadTickersErrors = {
1058
+ /**
1059
+ * Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
1060
+ */
1061
+ 400: ResponseError;
1062
+ /**
1063
+ * No Lastra segment exists for the requested instrument/hour.
1064
+ */
1065
+ 404: ResponseError;
1066
+ /**
1067
+ * Unexpected I/O error serving the file.
1068
+ */
1069
+ 500: ResponseError;
1070
+ };
1071
+
1072
+ export type DownloadTickersError =
1073
+ DownloadTickersErrors[keyof DownloadTickersErrors];
748
1074
 
749
- export type DownloadKlinesData = {
750
- body?: never;
751
- path: {
752
- /**
753
- * ID of the exchange (e.g. `binance`).
754
- */
755
- exchangeId: string;
756
- /**
757
- * Base asset symbol.
758
- */
759
- base: string;
760
- /**
761
- * Quote asset symbol.
762
- */
763
- quote: string;
764
- };
765
- query: {
766
- /**
767
- * Hour selector in `YYYY-MM-DDTHH` (UTC). The returned segment covers
768
- * `[HH:00:00Z, HH+1:00:00Z)`.
769
- *
770
- */
771
- hour: string;
772
- /**
773
- * Response wire format. `lastra` (default) returns raw Lastra bytes.
774
- * `parquet` returns Parquet via on-the-fly conversion.
775
- *
776
- */
777
- format?: 'lastra' | 'parquet';
778
- };
779
- url: '/exchange/{exchangeId}/klines/{base}/{quote}';
1075
+ export type DownloadTickersResponses = {
1076
+ /**
1077
+ * One hour of tickers for the instrument. `Content-Type` is
1078
+ * `application/vnd.lastra` by default or
1079
+ * `application/vnd.apache.parquet` when `format=parquet` was
1080
+ * requested.
1081
+ *
1082
+ */
1083
+ 200: Blob | File;
780
1084
  };
781
1085
 
782
- export type DownloadKlinesErrors = {
1086
+ export type DownloadTickersResponse =
1087
+ DownloadTickersResponses[keyof DownloadTickersResponses];
1088
+
1089
+ export type DownloadKlinesData = {
1090
+ body?: never;
1091
+ path: {
783
1092
  /**
784
- * Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
1093
+ * ID of the exchange (e.g. `binance`).
785
1094
  */
786
- 400: ResponseError;
1095
+ exchangeId: string;
787
1096
  /**
788
- * No Lastra segment exists for the requested instrument/hour.
1097
+ * Base asset symbol.
789
1098
  */
790
- 404: ResponseError;
1099
+ base: string;
791
1100
  /**
792
- * Unexpected I/O error serving the file.
1101
+ * Quote asset symbol.
793
1102
  */
794
- 500: ResponseError;
1103
+ quote: string;
1104
+ };
1105
+ query: {
1106
+ /**
1107
+ * Hour selector in `YYYY-MM-DDTHH` (UTC). The returned segment covers
1108
+ * `[HH:00:00Z, HH+1:00:00Z)`.
1109
+ *
1110
+ */
1111
+ hour: string;
1112
+ /**
1113
+ * Response wire format. `lastra` (default) returns raw Lastra bytes.
1114
+ * `parquet` returns Parquet via on-the-fly conversion.
1115
+ *
1116
+ */
1117
+ format?: "lastra" | "parquet";
1118
+ };
1119
+ url: "/exchange/{exchangeId}/klines/{base}/{quote}";
795
1120
  };
796
1121
 
797
- export type DownloadKlinesError = DownloadKlinesErrors[keyof DownloadKlinesErrors];
1122
+ export type DownloadKlinesErrors = {
1123
+ /**
1124
+ * Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
1125
+ */
1126
+ 400: ResponseError;
1127
+ /**
1128
+ * No Lastra segment exists for the requested instrument/hour.
1129
+ */
1130
+ 404: ResponseError;
1131
+ /**
1132
+ * Unexpected I/O error serving the file.
1133
+ */
1134
+ 500: ResponseError;
1135
+ };
1136
+
1137
+ export type DownloadKlinesError =
1138
+ DownloadKlinesErrors[keyof DownloadKlinesErrors];
798
1139
 
799
1140
  export type DownloadKlinesResponses = {
800
- /**
801
- * One hour of klines for the instrument. `Content-Type` is
802
- * `application/vnd.lastra` by default or
803
- * `application/vnd.apache.parquet` when `format=parquet`.
804
- *
805
- */
806
- 200: Blob | File;
1141
+ /**
1142
+ * One hour of klines for the instrument. `Content-Type` is
1143
+ * `application/vnd.lastra` by default or
1144
+ * `application/vnd.apache.parquet` when `format=parquet`.
1145
+ *
1146
+ */
1147
+ 200: Blob | File;
807
1148
  };
808
1149
 
809
- export type DownloadKlinesResponse = DownloadKlinesResponses[keyof DownloadKlinesResponses];
1150
+ export type DownloadKlinesResponse =
1151
+ DownloadKlinesResponses[keyof DownloadKlinesResponses];
810
1152
 
811
1153
  export type CompileStrategyData = {
812
- /**
813
- * Raw strategy Java source code
814
- */
815
- body: string;
816
- headers?: {
817
- /**
818
- * When `true`, compile asynchronously and return `202` with a `jobId`.
819
- */
820
- 'X-Compile-Async'?: boolean;
821
- };
822
- path?: never;
823
- query?: never;
824
- url: '/strategy';
1154
+ /**
1155
+ * Raw strategy Java source code
1156
+ */
1157
+ body: string;
1158
+ path?: never;
1159
+ query?: never;
1160
+ url: "/strategy";
825
1161
  };
826
1162
 
827
1163
  export type CompileStrategyErrors = {
828
- /**
829
- * Invalid strategy (compilation error)
830
- */
831
- 400: ResponseError;
1164
+ /**
1165
+ * The source is not valid Java; the message carries the compiler diagnostics. Nothing is
1166
+ * registered, so there is no id to look up afterwards.
1167
+ *
1168
+ */
1169
+ 400: ResponseError;
1170
+ /**
1171
+ * Too many compilations in flight. Retry later.
1172
+ */
1173
+ 429: ResponseError;
832
1174
  };
833
1175
 
834
- export type CompileStrategyError = CompileStrategyErrors[keyof CompileStrategyErrors];
1176
+ export type CompileStrategyError =
1177
+ CompileStrategyErrors[keyof CompileStrategyErrors];
835
1178
 
836
1179
  export type CompileStrategyResponses = {
1180
+ /**
1181
+ * Compiled and registered
1182
+ */
1183
+ 200: {
1184
+ strategyId: StrategyId;
1185
+ };
1186
+ };
1187
+
1188
+ export type CompileStrategyResponse =
1189
+ CompileStrategyResponses[keyof CompileStrategyResponses];
1190
+
1191
+ export type ValidateStrategyData = {
1192
+ body?: never;
1193
+ path: {
837
1194
  /**
838
- * Strategy compiled successfully (sync mode)
839
- */
840
- 200: {
841
- strategyId: StrategyId;
842
- };
843
- /**
844
- * Compile task accepted (async mode — set `X-Compile-Async: true`)
1195
+ * The id returned by `POST /strategy`
845
1196
  */
846
- 202: AcceptedJob;
1197
+ strategyId: StrategyId;
1198
+ };
1199
+ query?: never;
1200
+ url: "/strategy/{strategyId}/validate";
1201
+ };
1202
+
1203
+ export type ValidateStrategyErrors = {
1204
+ /**
1205
+ * No such registered strategy for this user
1206
+ */
1207
+ 404: ResponseError;
1208
+ };
1209
+
1210
+ export type ValidateStrategyError =
1211
+ ValidateStrategyErrors[keyof ValidateStrategyErrors];
1212
+
1213
+ export type ValidateStrategyResponses = {
1214
+ /**
1215
+ * Already validated; the recorded verdict, unchanged
1216
+ */
1217
+ 200: StrategyState;
1218
+ /**
1219
+ * Validation queued. Not a terminal outcome — poll `GET /strategy/{strategyId}` until
1220
+ * `validation` leaves `pending`.
1221
+ *
1222
+ */
1223
+ 202: {
1224
+ strategyId: StrategyId;
1225
+ validation: "pending";
1226
+ };
847
1227
  };
848
1228
 
849
- export type CompileStrategyResponse = CompileStrategyResponses[keyof CompileStrategyResponses];
1229
+ export type ValidateStrategyResponse =
1230
+ ValidateStrategyResponses[keyof ValidateStrategyResponses];
850
1231
 
851
1232
  export type GetStrategyData = {
852
- body?: never;
853
- path: {
854
- /**
855
- * The id returned by `POST /strategy` (sync) or the `jobId` returned in async mode
856
- */
857
- strategyId: string;
858
- };
859
- query?: never;
860
- url: '/strategy/{strategyId}';
1233
+ body?: never;
1234
+ path: {
1235
+ /**
1236
+ * The id returned by `POST /strategy`
1237
+ */
1238
+ strategyId: StrategyId;
1239
+ };
1240
+ query?: never;
1241
+ url: "/strategy/{strategyId}";
861
1242
  };
862
1243
 
863
1244
  export type GetStrategyErrors = {
864
- /**
865
- * Strategy compile job not found
866
- */
867
- 404: ResponseError;
1245
+ /**
1246
+ * No such registered strategy for this user
1247
+ */
1248
+ 404: ResponseError;
868
1249
  };
869
1250
 
870
1251
  export type GetStrategyError = GetStrategyErrors[keyof GetStrategyErrors];
871
1252
 
872
1253
  export type GetStrategyResponses = {
873
- /**
874
- * Strategy compile state
875
- */
876
- 200: {
877
- /**
878
- * Compile job id (only set in async mode)
879
- */
880
- jobId?: string;
881
- status: 'New' | 'Started' | 'Completed' | 'Aborted' | 'Failed';
882
- strategyId?: StrategyId;
883
- /**
884
- * Compilation error messages when `status` is `Failed`
885
- */
886
- statusDetail?: string | null;
887
- };
1254
+ /**
1255
+ * Strategy state
1256
+ */
1257
+ 200: StrategyState;
888
1258
  };
889
1259
 
890
- export type GetStrategyResponse = GetStrategyResponses[keyof GetStrategyResponses];
1260
+ export type GetStrategyResponse =
1261
+ GetStrategyResponses[keyof GetStrategyResponses];
891
1262
 
892
1263
  export type PrepareBacktestData = {
1264
+ /**
1265
+ * The required data to prepare a backtesting
1266
+ */
1267
+ body: PrepareRequest;
1268
+ path: {
893
1269
  /**
894
- * The required data to prepare a backtesting
1270
+ * ID of the exchange to prepare the backtesting for
895
1271
  */
896
- body: PrepareRequest;
897
- path: {
898
- /**
899
- * ID of the exchange to prepare the backtesting for
900
- */
901
- exchangeId: string;
902
- /**
903
- * The type of data source to prepare from
904
- */
905
- type: DataSourceType;
906
- };
907
- query?: never;
908
- url: '/backtest/{exchangeId}/{type}/prepare';
909
- };
910
-
911
- export type PrepareBacktestErrors = {
1272
+ exchangeId: string;
912
1273
  /**
913
- * Invalid request or parameters. Also returned when `from` is older than the configured
914
- * lookback window or `to` is in the future.
915
- *
916
- */
917
- 400: ResponseError;
918
- /**
919
- * Exchange or data source type not found
1274
+ * The type of data source to prepare from
920
1275
  */
921
- 404: ResponseError;
922
- /**
923
- * Rate limited. Returned when the global queue exceeds capacity or the user has too many
924
- * active backtests.
925
- *
926
- */
927
- 429: ResponseError;
1276
+ type: DataSourceType;
1277
+ };
1278
+ query?: never;
1279
+ url: "/backtest/{exchangeId}/{type}/prepare";
928
1280
  };
929
1281
 
930
- export type PrepareBacktestError = PrepareBacktestErrors[keyof PrepareBacktestErrors];
1282
+ export type PrepareBacktestErrors = {
1283
+ /**
1284
+ * Invalid request or parameters. Also returned when `from` is older than the configured
1285
+ * lookback window or `to` is in the future.
1286
+ *
1287
+ */
1288
+ 400: ResponseError;
1289
+ /**
1290
+ * Exchange or data source type not found
1291
+ */
1292
+ 404: ResponseError;
1293
+ /**
1294
+ * Rate limited. Returned when the global queue exceeds capacity or the user has too many
1295
+ * active backtests.
1296
+ *
1297
+ */
1298
+ 429: ResponseError;
1299
+ };
1300
+
1301
+ export type PrepareBacktestError =
1302
+ PrepareBacktestErrors[keyof PrepareBacktestErrors];
931
1303
 
932
1304
  export type PrepareBacktestResponses = {
933
- /**
934
- * Prepare task accepted (queued for processing)
935
- */
936
- 202: AcceptedJob;
1305
+ /**
1306
+ * Prepare task accepted (queued for processing)
1307
+ */
1308
+ 202: AcceptedJob;
937
1309
  };
938
1310
 
939
- export type PrepareBacktestResponse = PrepareBacktestResponses[keyof PrepareBacktestResponses];
1311
+ export type PrepareBacktestResponse =
1312
+ PrepareBacktestResponses[keyof PrepareBacktestResponses];
940
1313
 
941
1314
  export type GetPrepareStatusData = {
942
- body?: never;
943
- path: {
944
- /**
945
- * ID of the exchange for the backtesting process
946
- */
947
- exchangeId: string;
948
- /**
949
- * The type of data source to prepare from
950
- */
951
- type: DataSourceType;
952
- /**
953
- * Job ID returned by `POST /prepare`
954
- */
955
- jobId: string;
956
- };
957
- query?: never;
958
- url: '/backtest/{exchangeId}/{type}/prepare/{jobId}';
959
- };
960
-
961
- export type GetPrepareStatusErrors = {
1315
+ body?: never;
1316
+ path: {
962
1317
  /**
963
- * Invalid request or parameters
1318
+ * ID of the exchange for the backtesting process
964
1319
  */
965
- 400: ResponseError;
1320
+ exchangeId: string;
966
1321
  /**
967
- * Prepare job not found or expired
1322
+ * The type of data source to prepare from
968
1323
  */
969
- 404: ResponseError;
1324
+ type: DataSourceType;
1325
+ /**
1326
+ * Job ID returned by `POST /prepare`
1327
+ */
1328
+ jobId: string;
1329
+ };
1330
+ query?: never;
1331
+ url: "/backtest/{exchangeId}/{type}/prepare/{jobId}";
970
1332
  };
971
1333
 
972
- export type GetPrepareStatusError = GetPrepareStatusErrors[keyof GetPrepareStatusErrors];
1334
+ export type GetPrepareStatusErrors = {
1335
+ /**
1336
+ * Invalid request or parameters
1337
+ */
1338
+ 400: ResponseError;
1339
+ /**
1340
+ * Prepare job not found or expired
1341
+ */
1342
+ 404: ResponseError;
1343
+ };
1344
+
1345
+ export type GetPrepareStatusError =
1346
+ GetPrepareStatusErrors[keyof GetPrepareStatusErrors];
973
1347
 
974
1348
  export type GetPrepareStatusResponses = {
975
- /**
976
- * Current prepare job state
977
- */
978
- 200: PrepareJobState;
1349
+ /**
1350
+ * Current prepare job state
1351
+ */
1352
+ 200: PrepareJobState;
979
1353
  };
980
1354
 
981
- export type GetPrepareStatusResponse = GetPrepareStatusResponses[keyof GetPrepareStatusResponses];
1355
+ export type GetPrepareStatusResponse =
1356
+ GetPrepareStatusResponses[keyof GetPrepareStatusResponses];
982
1357
 
983
1358
  export type ExecuteSweepData = {
984
- body: ExecuteSweepRequest;
985
- path: {
986
- exchangeId: string;
987
- type: DataSourceType;
988
- /**
989
- * Job ID returned by `POST /backtest/{exchangeId}/{type}/prepare`.
990
- */
991
- requestId: string;
992
- };
993
- query?: never;
994
- url: '/backtest/{exchangeId}/{type}/executeSweep/{requestId}';
1359
+ body: ExecuteSweepRequest;
1360
+ path: {
1361
+ exchangeId: string;
1362
+ type: DataSourceType;
1363
+ /**
1364
+ * Job ID returned by `POST /backtest/{exchangeId}/{type}/prepare`.
1365
+ */
1366
+ requestId: string;
1367
+ };
1368
+ query?: never;
1369
+ url: "/backtest/{exchangeId}/{type}/executeSweep/{requestId}";
995
1370
  };
996
1371
 
997
1372
  export type ExecuteSweepErrors = {
998
- /**
999
- * Invalid sweep specification or the expanded grid exceeds the server limit.
1000
- */
1001
- 400: ResponseError;
1002
- /**
1003
- * Prepared request not found or expired.
1004
- */
1005
- 404: ResponseError;
1006
- /**
1007
- * Sweep queue or user concurrency limit reached.
1008
- */
1009
- 429: ResponseError;
1373
+ /**
1374
+ * Invalid sweep specification or the expanded grid exceeds the server limit.
1375
+ */
1376
+ 400: ResponseError;
1377
+ /**
1378
+ * Prepared request not found or expired.
1379
+ */
1380
+ 404: ResponseError;
1381
+ /**
1382
+ * Sweep queue or user concurrency limit reached.
1383
+ */
1384
+ 429: ResponseError;
1010
1385
  };
1011
1386
 
1012
1387
  export type ExecuteSweepError = ExecuteSweepErrors[keyof ExecuteSweepErrors];
1013
1388
 
1014
1389
  export type ExecuteSweepResponses = {
1015
- /**
1016
- * Sweep accepted. The effective seed is returned for reproducibility.
1017
- */
1018
- 202: ExecuteSweepAccepted;
1390
+ /**
1391
+ * Sweep accepted. The effective seed is returned for reproducibility.
1392
+ */
1393
+ 202: ExecuteSweepAccepted;
1019
1394
  };
1020
1395
 
1021
- export type ExecuteSweepResponse = ExecuteSweepResponses[keyof ExecuteSweepResponses];
1396
+ export type ExecuteSweepResponse =
1397
+ ExecuteSweepResponses[keyof ExecuteSweepResponses];
1022
1398
 
1023
1399
  export type CancelSweepData = {
1024
- body?: never;
1025
- path: {
1026
- exchangeId: string;
1027
- type: DataSourceType;
1028
- requestId: string;
1029
- sweepId: string;
1030
- };
1031
- query?: never;
1032
- url: '/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}';
1400
+ body?: never;
1401
+ path: {
1402
+ exchangeId: string;
1403
+ type: DataSourceType;
1404
+ requestId: string;
1405
+ sweepId: string;
1406
+ };
1407
+ query?: never;
1408
+ url: "/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}";
1033
1409
  };
1034
1410
 
1035
1411
  export type CancelSweepErrors = {
1036
- /**
1037
- * Sweep not found.
1038
- */
1039
- 404: ResponseError;
1412
+ /**
1413
+ * Sweep not found.
1414
+ */
1415
+ 404: ResponseError;
1040
1416
  };
1041
1417
 
1042
1418
  export type CancelSweepError = CancelSweepErrors[keyof CancelSweepErrors];
1043
1419
 
1044
1420
  export type CancelSweepResponses = {
1045
- /**
1046
- * Cancellation requested.
1047
- */
1048
- 200: {
1049
- status: 'cancelling';
1050
- sweepId: string;
1051
- };
1421
+ /**
1422
+ * Cancellation requested.
1423
+ */
1424
+ 200: {
1425
+ status: "cancelling";
1426
+ sweepId: string;
1427
+ };
1052
1428
  };
1053
1429
 
1054
- export type CancelSweepResponse = CancelSweepResponses[keyof CancelSweepResponses];
1430
+ export type CancelSweepResponse =
1431
+ CancelSweepResponses[keyof CancelSweepResponses];
1055
1432
 
1056
1433
  export type GetSweepResultData = {
1057
- body?: never;
1058
- path: {
1059
- exchangeId: string;
1060
- type: DataSourceType;
1061
- requestId: string;
1062
- sweepId: string;
1063
- };
1064
- query?: {
1065
- objective?: 'sharpe' | 'sortino' | 'pnl' | 'maxdd';
1066
- /**
1067
- * `natural` is stable materialisation order; `ranked` is the display view.
1068
- */
1069
- order?: 'ranked' | 'natural';
1070
- };
1071
- url: '/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}';
1434
+ body?: never;
1435
+ path: {
1436
+ exchangeId: string;
1437
+ type: DataSourceType;
1438
+ requestId: string;
1439
+ sweepId: string;
1440
+ };
1441
+ query?: {
1442
+ objective?: "sharpe" | "sortino" | "pnl" | "maxdd";
1443
+ /**
1444
+ * `natural` is stable materialisation order; `ranked` is the display view.
1445
+ */
1446
+ order?: "ranked" | "natural";
1447
+ /**
1448
+ * How the `ranked` view is ordered. `plateau` prefers points whose neighbourhood also scores well; `raw` uses the objective alone. Ignored when `order=natural`, which is always ordered by `runIx`.
1449
+ */
1450
+ ranking?: "plateau" | "raw";
1451
+ };
1452
+ url: "/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}";
1072
1453
  };
1073
1454
 
1074
1455
  export type GetSweepResultErrors = {
1075
- /**
1076
- * Sweep not found or expired.
1077
- */
1078
- 404: ResponseError;
1456
+ /**
1457
+ * Sweep not found or expired.
1458
+ */
1459
+ 404: ResponseError;
1079
1460
  };
1080
1461
 
1081
- export type GetSweepResultError = GetSweepResultErrors[keyof GetSweepResultErrors];
1462
+ export type GetSweepResultError =
1463
+ GetSweepResultErrors[keyof GetSweepResultErrors];
1082
1464
 
1083
1465
  export type GetSweepResultResponses = {
1466
+ /**
1467
+ * Current sweep snapshot and all currently available result rows for the selected view.
1468
+ */
1469
+ 200: ExecuteSweepResult;
1470
+ };
1471
+
1472
+ export type GetSweepResultResponse =
1473
+ GetSweepResultResponses[keyof GetSweepResultResponses];
1474
+
1475
+ export type GetSweepSensitivityData = {
1476
+ body?: never;
1477
+ path: {
1478
+ exchangeId: string;
1479
+ type: DataSourceType;
1480
+ requestId: string;
1481
+ sweepId: string;
1482
+ };
1483
+ query?: {
1084
1484
  /**
1085
- * Current sweep snapshot and all currently available result rows for the selected view.
1485
+ * Which metric to aggregate. Defaults to the objective the sweep was submitted with.
1086
1486
  */
1087
- 200: ExecuteSweepResult;
1487
+ objective?: "sharpe" | "sortino" | "pnl" | "maxdd";
1488
+ };
1489
+ url: "/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}/sensitivity";
1490
+ };
1491
+
1492
+ export type GetSweepSensitivityErrors = {
1493
+ /**
1494
+ * Sweep not found or expired.
1495
+ */
1496
+ 404: ResponseError;
1088
1497
  };
1089
1498
 
1090
- export type GetSweepResultResponse = GetSweepResultResponses[keyof GetSweepResultResponses];
1499
+ export type GetSweepSensitivityError =
1500
+ GetSweepSensitivityErrors[keyof GetSweepSensitivityErrors];
1501
+
1502
+ export type GetSweepSensitivityResponses = {
1503
+ /**
1504
+ * Sensitivity aggregates over the rows available so far.
1505
+ */
1506
+ 200: SweepSensitivity;
1507
+ };
1508
+
1509
+ export type GetSweepSensitivityResponse =
1510
+ GetSweepSensitivityResponses[keyof GetSweepSensitivityResponses];
1091
1511
 
1092
1512
  export type ExecuteBacktestData = {
1513
+ /**
1514
+ * Execute task parameters
1515
+ */
1516
+ body: {
1093
1517
  /**
1094
- * Execute task parameters
1518
+ * Job ID returned by `POST /prepare` (must be in `Completed` state)
1095
1519
  */
1096
- body: {
1097
- /**
1098
- * Job ID returned by `POST /prepare` (must be in `Completed` state)
1099
- */
1100
- prepareJobId: string;
1101
- strategyId: StrategyId;
1102
- /**
1103
- * When true, the worker uploads emitted signals to object storage and the
1104
- * response includes `signalsUrl` / `signalsId` fields. Defaults to false.
1105
- *
1106
- */
1107
- storeSignals?: boolean;
1108
- };
1109
- path: {
1110
- /**
1111
- * ID of the exchange for the backtesting process
1112
- */
1113
- exchangeId: string;
1114
- /**
1115
- * The type of data source to execute from
1116
- */
1117
- type: DataSourceType;
1118
- };
1119
- query?: never;
1120
- url: '/backtest/{exchangeId}/{type}/execute';
1121
- };
1122
-
1123
- export type ExecuteBacktestErrors = {
1520
+ prepareJobId: string;
1521
+ strategyId: StrategyId;
1124
1522
  /**
1125
- * Invalid request or parameters
1523
+ * When true, the worker uploads emitted signals to object storage and the
1524
+ * response includes `signalsUrl` / `signalsId` fields. Defaults to false.
1525
+ *
1126
1526
  */
1127
- 400: ResponseError;
1527
+ storeSignals?: boolean;
1528
+ };
1529
+ path: {
1128
1530
  /**
1129
- * Prepare job not found or expired
1531
+ * ID of the exchange for the backtesting process
1130
1532
  */
1131
- 404: ResponseError;
1533
+ exchangeId: string;
1132
1534
  /**
1133
- * Rate limited (global queue at capacity or per-user limit reached)
1535
+ * The type of data source to execute from
1134
1536
  */
1135
- 429: ResponseError;
1537
+ type: DataSourceType;
1538
+ };
1539
+ query?: never;
1540
+ url: "/backtest/{exchangeId}/{type}/execute";
1136
1541
  };
1137
1542
 
1138
- export type ExecuteBacktestError = ExecuteBacktestErrors[keyof ExecuteBacktestErrors];
1543
+ export type ExecuteBacktestErrors = {
1544
+ /**
1545
+ * Invalid request or parameters
1546
+ */
1547
+ 400: ResponseError;
1548
+ /**
1549
+ * Prepare job not found or expired
1550
+ */
1551
+ 404: ResponseError;
1552
+ /**
1553
+ * Rate limited (global queue at capacity or per-user limit reached)
1554
+ */
1555
+ 429: ResponseError;
1556
+ };
1557
+
1558
+ export type ExecuteBacktestError =
1559
+ ExecuteBacktestErrors[keyof ExecuteBacktestErrors];
1139
1560
 
1140
1561
  export type ExecuteBacktestResponses = {
1141
- /**
1142
- * Execute task accepted (queued for processing)
1143
- */
1144
- 202: AcceptedJob;
1562
+ /**
1563
+ * Execute task accepted (queued for processing)
1564
+ */
1565
+ 202: AcceptedJob;
1145
1566
  };
1146
1567
 
1147
- export type ExecuteBacktestResponse = ExecuteBacktestResponses[keyof ExecuteBacktestResponses];
1568
+ export type ExecuteBacktestResponse =
1569
+ ExecuteBacktestResponses[keyof ExecuteBacktestResponses];
1148
1570
 
1149
1571
  export type CancelBacktestData = {
1150
- body?: never;
1151
- path: {
1152
- exchangeId: string;
1153
- type: DataSourceType;
1154
- /**
1155
- * Job ID returned by `POST /execute`
1156
- */
1157
- jobId: string;
1158
- };
1159
- query?: never;
1160
- url: '/backtest/{exchangeId}/{type}/execute/{jobId}';
1572
+ body?: never;
1573
+ path: {
1574
+ exchangeId: string;
1575
+ type: DataSourceType;
1576
+ /**
1577
+ * Job ID returned by `POST /execute`
1578
+ */
1579
+ jobId: string;
1580
+ };
1581
+ query?: never;
1582
+ url: "/backtest/{exchangeId}/{type}/execute/{jobId}";
1161
1583
  };
1162
1584
 
1163
1585
  export type CancelBacktestErrors = {
1164
- /**
1165
- * Execution not found
1166
- */
1167
- 404: ResponseError;
1586
+ /**
1587
+ * Execution not found
1588
+ */
1589
+ 404: ResponseError;
1168
1590
  };
1169
1591
 
1170
- export type CancelBacktestError = CancelBacktestErrors[keyof CancelBacktestErrors];
1592
+ export type CancelBacktestError =
1593
+ CancelBacktestErrors[keyof CancelBacktestErrors];
1171
1594
 
1172
1595
  export type CancelBacktestResponses = {
1173
- /**
1174
- * Cancellation request accepted
1175
- */
1176
- 200: {
1177
- status?: 'cancelling';
1178
- jobId?: string;
1179
- };
1596
+ /**
1597
+ * Cancellation request accepted
1598
+ */
1599
+ 200: {
1600
+ status?: "cancelling";
1601
+ jobId?: string;
1602
+ };
1180
1603
  };
1181
1604
 
1182
- export type CancelBacktestResponse = CancelBacktestResponses[keyof CancelBacktestResponses];
1605
+ export type CancelBacktestResponse =
1606
+ CancelBacktestResponses[keyof CancelBacktestResponses];
1183
1607
 
1184
1608
  export type GetBacktestResultData = {
1185
- body?: never;
1186
- path: {
1187
- /**
1188
- * ID of the exchange for the backtesting process
1189
- */
1190
- exchangeId: string;
1191
- /**
1192
- * The type of data source to execute from
1193
- */
1194
- type: DataSourceType;
1195
- /**
1196
- * Job ID returned by `POST /execute`
1197
- */
1198
- jobId: string;
1199
- };
1200
- query?: never;
1201
- url: '/backtest/{exchangeId}/{type}/execute/{jobId}';
1202
- };
1203
-
1204
- export type GetBacktestResultErrors = {
1609
+ body?: never;
1610
+ path: {
1205
1611
  /**
1206
- * Invalid request or parameters
1612
+ * ID of the exchange for the backtesting process
1207
1613
  */
1208
- 400: ResponseError;
1614
+ exchangeId: string;
1209
1615
  /**
1210
- * Execution job not found
1616
+ * The type of data source to execute from
1211
1617
  */
1212
- 404: ResponseError;
1213
- };
1214
-
1215
- export type GetBacktestResultError = GetBacktestResultErrors[keyof GetBacktestResultErrors];
1216
-
1217
- export type GetBacktestResultResponses = {
1618
+ type: DataSourceType;
1218
1619
  /**
1219
- * Backtesting execution result
1620
+ * Job ID returned by `POST /execute`
1220
1621
  */
1221
- 200: BacktestJobResult;
1222
- /**
1223
- * The job is known but its result is not readable yet — keep polling.
1224
- *
1225
- * Returned in two situations, both of which mean "ask again", never "you are done":
1226
- * the job has not produced its result yet, or the job reached a terminal status while
1227
- * its stored result could not be read back. The response body is an empty object: it
1228
- * deliberately carries no `state`, so a client cannot mistake it for a finished result.
1229
- *
1230
- * Treat any `202` as a signal to continue the poll loop under your existing timeout.
1231
- * Never treat it as a terminal outcome.
1232
- *
1233
- */
1234
- 202: {
1235
- [key: string]: never;
1236
- };
1622
+ jobId: string;
1623
+ };
1624
+ query?: never;
1625
+ url: "/backtest/{exchangeId}/{type}/execute/{jobId}";
1237
1626
  };
1238
1627
 
1239
- export type GetBacktestResultResponse = GetBacktestResultResponses[keyof GetBacktestResultResponses];
1628
+ export type GetBacktestResultErrors = {
1629
+ /**
1630
+ * Invalid request or parameters
1631
+ */
1632
+ 400: ResponseError;
1633
+ /**
1634
+ * Execution job not found
1635
+ */
1636
+ 404: ResponseError;
1637
+ };
1638
+
1639
+ export type GetBacktestResultError =
1640
+ GetBacktestResultErrors[keyof GetBacktestResultErrors];
1641
+
1642
+ export type GetBacktestResultResponses = {
1643
+ /**
1644
+ * Backtesting execution result
1645
+ */
1646
+ 200: BacktestJobResult;
1647
+ /**
1648
+ * The job is known but its result is not readable yet — keep polling.
1649
+ *
1650
+ * Returned in two situations, both of which mean "ask again", never "you are done":
1651
+ * the job has not produced its result yet, or the job reached a terminal status while
1652
+ * its stored result could not be read back. The response body is an empty object: it
1653
+ * deliberately carries no `state`, so a client cannot mistake it for a finished result.
1654
+ *
1655
+ * Treat any `202` as a signal to continue the poll loop under your existing timeout.
1656
+ * Never treat it as a terminal outcome.
1657
+ *
1658
+ */
1659
+ 202: {
1660
+ [key: string]: never;
1661
+ };
1662
+ };
1663
+
1664
+ export type GetBacktestResultResponse =
1665
+ GetBacktestResultResponses[keyof GetBacktestResultResponses];
1240
1666
 
1241
1667
  export type ClientOptions = {
1242
- baseUrl: 'https://api.staging.qtsurfer.com/v1' | 'https://api.qtsurfer.com/v1' | (string & {});
1243
- };
1668
+ baseUrl:
1669
+ | "https://api.staging.qtsurfer.com/v1"
1670
+ | "https://api.qtsurfer.com/v1"
1671
+ | (string & {});
1672
+ };