@qtsurfer/api-client 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -153,6 +153,34 @@ type Exchange = {
153
153
  * Managed exchange data sources available for backtesting.
154
154
  */
155
155
  type DataSourceType = 'ticker';
156
+ type PrepareRequest = {
157
+ instrument: Instrument;
158
+ /**
159
+ * Start date for the preparation process. Supports the following formats:
160
+ * - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
161
+ * - ISO DATE (e.g. 2024-12-14)
162
+ * - BASIC ISO DATE (e.g., 20241214)
163
+ *
164
+ */
165
+ from: string;
166
+ /**
167
+ * End date for the preparation process. Supports the following formats:
168
+ * - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
169
+ * - ISO DATE (e.g. 2024-12-14)
170
+ * - BASIC ISO DATE (e.g., 20241214)
171
+ *
172
+ */
173
+ to: string;
174
+ /**
175
+ * Output bar cadence for the prepared range. Defaults to the publisher's
176
+ * native cadence (`1s`); coarser cadences are produced on demand via
177
+ * resampling and stored alongside the native blob in cache. Coarser-than-
178
+ * source values must be exact multiples of the source cadence — invalid
179
+ * labels return `400`.
180
+ *
181
+ */
182
+ cadence?: '1s' | '5s' | '1m' | '5m' | '15m' | '1h' | '4h' | '1d';
183
+ };
156
184
  /**
157
185
  * Information about a single job
158
186
  */
@@ -162,13 +190,13 @@ type JobState = {
162
190
  */
163
191
  contextId: string;
164
192
  /**
165
- * Current status of the job. `Partial` (prepare only) means some
166
- * hours are still being produced asynchronously — keep polling.
167
- * Treat `Completed | Aborted | Failed` as terminal; anything else
168
- * means keep polling.
193
+ * Current status of the job. Treat `Completed | Aborted | Failed` as
194
+ * terminal; `New | Started` mean keep polling. A single-instrument prepare
195
+ * is always terminal (`Completed`) decide from
196
+ * `PrepareJobState.coverageRatio`, not by polling.
169
197
  *
170
198
  */
171
- status: 'New' | 'Started' | 'Partial' | 'Completed' | 'Aborted' | 'Failed';
199
+ status: 'New' | 'Started' | 'Completed' | 'Aborted' | 'Failed';
172
200
  /**
173
201
  * Detailed status information, if available
174
202
  */
@@ -190,6 +218,178 @@ type JobState = {
190
218
  */
191
219
  endTime?: string | null;
192
220
  };
221
+ /**
222
+ * State of a single-instrument prepare job — the `JobState` shape plus a per-hour
223
+ * data-coverage summary. A single-instrument prepare is always terminal
224
+ * (`status: Completed`): the client decides what to do from `coverageRatio` (e.g.
225
+ * execute if it is at or above a chosen threshold) rather than polling for missing
226
+ * hours that may never arrive — a missing hour for one instrument usually means low
227
+ * activity, not missing data.
228
+ *
229
+ */
230
+ type PrepareJobState = JobState & {
231
+ /**
232
+ * Start of the available data range for the prepared instrument.
233
+ */
234
+ dataFrom?: string | null;
235
+ /**
236
+ * End of the available data range for the prepared instrument.
237
+ */
238
+ dataTo?: string | null;
239
+ /**
240
+ * `hoursWithData / totalHours` in `[0,1]` (`1.0` when `totalHours` is 0) — the
241
+ * fraction of hours in the requested range that have served data.
242
+ *
243
+ */
244
+ coverageRatio?: number;
245
+ /**
246
+ * Number of whole hours in the requested prepare range.
247
+ */
248
+ totalHours?: number;
249
+ /**
250
+ * Number of hours in the range that have data.
251
+ */
252
+ hoursWithData?: number;
253
+ /**
254
+ * One entry per hour in the range that has no data, with a rationale.
255
+ */
256
+ hoursWithoutData?: Array<{
257
+ /**
258
+ * The hour (UTC, hour-aligned) that has no data.
259
+ */
260
+ hour?: string;
261
+ /**
262
+ * Expected row count for the hour (currently always 0; reserved for
263
+ * future use). The rationale never depends on it.
264
+ *
265
+ */
266
+ expected?: number;
267
+ /**
268
+ * Why the hour has no data. `pending_conversion`: data for this hour is
269
+ * still being produced — a re-poll may fill it. `low_activity`: the
270
+ * instrument did not trade that hour. `unknown`: no data to classify by.
271
+ *
272
+ */
273
+ rationale?: 'pending_conversion' | 'low_activity' | 'unknown';
274
+ }>;
275
+ };
276
+ /**
277
+ * A numeric range or an explicit list of values for one strategy property.
278
+ */
279
+ type SweepAxis = {
280
+ from: number;
281
+ to: number;
282
+ step: number;
283
+ } | {
284
+ values: Array<number | boolean>;
285
+ };
286
+ type SweepSpecRequest = {
287
+ sampler?: 'grid' | 'random' | 'lhs';
288
+ /**
289
+ * Reproducibility seed. If omitted, the server generates one with Java's
290
+ * `L64X128MixRandom` generator and returns the effective value. The range
291
+ * is limited to JavaScript-safe integers so generated clients can replay it exactly.
292
+ *
293
+ */
294
+ seed?: number;
295
+ /**
296
+ * Number of samples for `random` and `lhs`; ignored by `grid`.
297
+ */
298
+ samples?: number;
299
+ objective?: 'sharpe' | 'sortino' | 'pnl' | 'maxdd';
300
+ params: {
301
+ [key: string]: SweepAxis;
302
+ };
303
+ };
304
+ type SweepBaseConfig = {
305
+ initialFunding?: number;
306
+ feeRate?: number;
307
+ buyFeeRate?: number;
308
+ sellFeeRate?: number;
309
+ feeLeg?: 'RECEIVED' | 'QUOTE' | 'BASE';
310
+ percentAmountToLock?: number;
311
+ };
312
+ type ExecuteSweepRequest = {
313
+ strategyId: StrategyId;
314
+ sweep: SweepSpecRequest;
315
+ baseConfig?: SweepBaseConfig;
316
+ /**
317
+ * Store signals for every trial. Keep false for normal sweeps.
318
+ */
319
+ storeSignals?: boolean;
320
+ /**
321
+ * Requested horizontal shard count; 0 or omitted selects automatically.
322
+ */
323
+ shards?: number;
324
+ /**
325
+ * Trials below this trade count are flagged but remain in the results.
326
+ */
327
+ minTradeFloor?: number;
328
+ };
329
+ type ExecuteSweepAccepted = {
330
+ sweepId: string;
331
+ requestId: string;
332
+ totalRuns: number;
333
+ shards: number;
334
+ /**
335
+ * Effective seed used to expand the sweep.
336
+ */
337
+ seed: number;
338
+ /**
339
+ * False when an identical sweep already exists and was not enqueued again.
340
+ */
341
+ queued: boolean;
342
+ };
343
+ type SweepProgress = {
344
+ done: number;
345
+ total: number;
346
+ aborted: number;
347
+ shardCount: number;
348
+ pendingShards: number;
349
+ };
350
+ type SweepRunRow = {
351
+ /**
352
+ * Deterministic zero-based expansion index, stable across shards and ranking.
353
+ */
354
+ runIx: number;
355
+ /**
356
+ * Present only in the `ranked` view.
357
+ */
358
+ rank?: number;
359
+ params: {
360
+ [key: string]: unknown;
361
+ };
362
+ sharpe: number;
363
+ sortino: number;
364
+ /**
365
+ * Absolute net PnL in the output currency.
366
+ */
367
+ pnl: number;
368
+ pnlPct: number;
369
+ cagr: number;
370
+ maxDdPct: number;
371
+ trades: number;
372
+ winRate: number;
373
+ belowTradeFloor: boolean;
374
+ aborted: boolean;
375
+ runtimeMs: number;
376
+ };
377
+ type ExecuteSweepResult = {
378
+ sweepId: string;
379
+ status: 'RUNNING' | 'COMPLETED' | 'PARTIAL' | 'CANCELLED';
380
+ objective: 'sharpe' | 'sortino' | 'pnl' | 'maxdd';
381
+ order: 'ranked' | 'natural';
382
+ progress: SweepProgress;
383
+ /**
384
+ * Total result rows currently available.
385
+ */
386
+ leaderboardSize: number;
387
+ /**
388
+ * True only when the ranked view exceeds its display limit.
389
+ */
390
+ truncated: boolean;
391
+ leaderboard: Array<SweepRunRow>;
392
+ };
193
393
  /**
194
394
  * Response returned by async endpoints (`202 Accepted`). The `jobId` is deterministic for the
195
395
  * same input parameters — repeated calls with identical params return the same id.
@@ -345,13 +545,13 @@ type AuthTokenError = {
345
545
  */
346
546
  message: string;
347
547
  };
348
- type AuthData = {
548
+ type AuthenticateData = {
349
549
  body?: never;
350
550
  path?: never;
351
551
  query?: never;
352
552
  url: '/auth/token';
353
553
  };
354
- type AuthErrors = {
554
+ type AuthenticateErrors = {
355
555
  /**
356
556
  * API key is invalid, revoked, or expired.
357
557
  */
@@ -361,28 +561,28 @@ type AuthErrors = {
361
561
  */
362
562
  429: unknown;
363
563
  };
364
- type AuthError = AuthErrors[keyof AuthErrors];
365
- type AuthResponses = {
564
+ type AuthenticateError = AuthenticateErrors[keyof AuthenticateErrors];
565
+ type AuthenticateResponses = {
366
566
  /**
367
567
  * API key accepted; JWT returned.
368
568
  */
369
569
  200: AuthTokenResponse;
370
570
  };
371
- type AuthResponse = AuthResponses[keyof AuthResponses];
372
- type GetExchangesData = {
571
+ type AuthenticateResponse = AuthenticateResponses[keyof AuthenticateResponses];
572
+ type ListExchangesData = {
373
573
  body?: never;
374
574
  path?: never;
375
575
  query?: never;
376
576
  url: '/exchanges';
377
577
  };
378
- type GetExchangesResponses = {
578
+ type ListExchangesResponses = {
379
579
  /**
380
580
  * A JSON array of Exchanges
381
581
  */
382
582
  200: Array<Exchange>;
383
583
  };
384
- type GetExchangesResponse = GetExchangesResponses[keyof GetExchangesResponses];
385
- type GetInstrumentsData = {
584
+ type ListExchangesResponse = ListExchangesResponses[keyof ListExchangesResponses];
585
+ type ListInstrumentsData = {
386
586
  body?: never;
387
587
  path: {
388
588
  /**
@@ -393,21 +593,21 @@ type GetInstrumentsData = {
393
593
  query?: never;
394
594
  url: '/exchange/{exchangeId}/instruments';
395
595
  };
396
- type GetInstrumentsErrors = {
596
+ type ListInstrumentsErrors = {
397
597
  /**
398
598
  * Exchange not found or instrument catalog not available
399
599
  */
400
600
  404: ResponseError;
401
601
  };
402
- type GetInstrumentsError = GetInstrumentsErrors[keyof GetInstrumentsErrors];
403
- type GetInstrumentsResponses = {
602
+ type ListInstrumentsError = ListInstrumentsErrors[keyof ListInstrumentsErrors];
603
+ type ListInstrumentsResponses = {
404
604
  /**
405
605
  * The default (spot) segment's instruments in `data`, `meta`, and HAL `_links` (self + spot/futures segment discovery)
406
606
  */
407
607
  200: InstrumentListResponse;
408
608
  };
409
- type GetInstrumentsResponse = GetInstrumentsResponses[keyof GetInstrumentsResponses];
410
- type GetSegmentInstrumentsData = {
609
+ type ListInstrumentsResponse = ListInstrumentsResponses[keyof ListInstrumentsResponses];
610
+ type ListSegmentInstrumentsData = {
411
611
  body?: never;
412
612
  path: {
413
613
  /**
@@ -422,21 +622,21 @@ type GetSegmentInstrumentsData = {
422
622
  query?: never;
423
623
  url: '/exchange/{exchangeId}/{segment}/instruments';
424
624
  };
425
- type GetSegmentInstrumentsErrors = {
625
+ type ListSegmentInstrumentsErrors = {
426
626
  /**
427
627
  * Exchange, segment, or instrument catalog not found
428
628
  */
429
629
  404: ResponseError;
430
630
  };
431
- type GetSegmentInstrumentsError = GetSegmentInstrumentsErrors[keyof GetSegmentInstrumentsErrors];
432
- type GetSegmentInstrumentsResponses = {
631
+ type ListSegmentInstrumentsError = ListSegmentInstrumentsErrors[keyof ListSegmentInstrumentsErrors];
632
+ type ListSegmentInstrumentsResponses = {
433
633
  /**
434
634
  * An object with a `data` array of instrument details (each with per-data-type coverage) and a `meta` block
435
635
  */
436
636
  200: InstrumentListResponse;
437
637
  };
438
- type GetSegmentInstrumentsResponse = GetSegmentInstrumentsResponses[keyof GetSegmentInstrumentsResponses];
439
- type GetExchangeTickersHourData = {
638
+ type ListSegmentInstrumentsResponse = ListSegmentInstrumentsResponses[keyof ListSegmentInstrumentsResponses];
639
+ type DownloadTickersData = {
440
640
  body?: never;
441
641
  path: {
442
642
  /**
@@ -469,7 +669,7 @@ type GetExchangeTickersHourData = {
469
669
  };
470
670
  url: '/exchange/{exchangeId}/tickers/{base}/{quote}';
471
671
  };
472
- type GetExchangeTickersHourErrors = {
672
+ type DownloadTickersErrors = {
473
673
  /**
474
674
  * Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
475
675
  */
@@ -483,8 +683,8 @@ type GetExchangeTickersHourErrors = {
483
683
  */
484
684
  500: ResponseError;
485
685
  };
486
- type GetExchangeTickersHourError = GetExchangeTickersHourErrors[keyof GetExchangeTickersHourErrors];
487
- type GetExchangeTickersHourResponses = {
686
+ type DownloadTickersError = DownloadTickersErrors[keyof DownloadTickersErrors];
687
+ type DownloadTickersResponses = {
488
688
  /**
489
689
  * One hour of tickers for the instrument. `Content-Type` is
490
690
  * `application/vnd.lastra` by default or
@@ -494,8 +694,8 @@ type GetExchangeTickersHourResponses = {
494
694
  */
495
695
  200: Blob | File;
496
696
  };
497
- type GetExchangeTickersHourResponse = GetExchangeTickersHourResponses[keyof GetExchangeTickersHourResponses];
498
- type GetExchangeKlinesHourData = {
697
+ type DownloadTickersResponse = DownloadTickersResponses[keyof DownloadTickersResponses];
698
+ type DownloadKlinesData = {
499
699
  body?: never;
500
700
  path: {
501
701
  /**
@@ -527,7 +727,7 @@ type GetExchangeKlinesHourData = {
527
727
  };
528
728
  url: '/exchange/{exchangeId}/klines/{base}/{quote}';
529
729
  };
530
- type GetExchangeKlinesHourErrors = {
730
+ type DownloadKlinesErrors = {
531
731
  /**
532
732
  * Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
533
733
  */
@@ -541,8 +741,8 @@ type GetExchangeKlinesHourErrors = {
541
741
  */
542
742
  500: ResponseError;
543
743
  };
544
- type GetExchangeKlinesHourError = GetExchangeKlinesHourErrors[keyof GetExchangeKlinesHourErrors];
545
- type GetExchangeKlinesHourResponses = {
744
+ type DownloadKlinesError = DownloadKlinesErrors[keyof DownloadKlinesErrors];
745
+ type DownloadKlinesResponses = {
546
746
  /**
547
747
  * One hour of klines for the instrument. `Content-Type` is
548
748
  * `application/vnd.lastra` by default or
@@ -551,8 +751,8 @@ type GetExchangeKlinesHourResponses = {
551
751
  */
552
752
  200: Blob | File;
553
753
  };
554
- type GetExchangeKlinesHourResponse = GetExchangeKlinesHourResponses[keyof GetExchangeKlinesHourResponses];
555
- type PostStrategyData = {
754
+ type DownloadKlinesResponse = DownloadKlinesResponses[keyof DownloadKlinesResponses];
755
+ type CompileStrategyData = {
556
756
  /**
557
757
  * Raw strategy Java source code
558
758
  */
@@ -567,14 +767,14 @@ type PostStrategyData = {
567
767
  query?: never;
568
768
  url: '/strategy';
569
769
  };
570
- type PostStrategyErrors = {
770
+ type CompileStrategyErrors = {
571
771
  /**
572
772
  * Invalid strategy (compilation error)
573
773
  */
574
774
  400: ResponseError;
575
775
  };
576
- type PostStrategyError = PostStrategyErrors[keyof PostStrategyErrors];
577
- type PostStrategyResponses = {
776
+ type CompileStrategyError = CompileStrategyErrors[keyof CompileStrategyErrors];
777
+ type CompileStrategyResponses = {
578
778
  /**
579
779
  * Strategy compiled successfully (sync mode)
580
780
  */
@@ -586,8 +786,8 @@ type PostStrategyResponses = {
586
786
  */
587
787
  202: AcceptedJob;
588
788
  };
589
- type PostStrategyResponse = PostStrategyResponses[keyof PostStrategyResponses];
590
- type GetStrategyStatusData = {
789
+ type CompileStrategyResponse = CompileStrategyResponses[keyof CompileStrategyResponses];
790
+ type GetStrategyData = {
591
791
  body?: never;
592
792
  path: {
593
793
  /**
@@ -598,14 +798,14 @@ type GetStrategyStatusData = {
598
798
  query?: never;
599
799
  url: '/strategy/{strategyId}';
600
800
  };
601
- type GetStrategyStatusErrors = {
801
+ type GetStrategyErrors = {
602
802
  /**
603
803
  * Strategy compile job not found
604
804
  */
605
805
  404: ResponseError;
606
806
  };
607
- type GetStrategyStatusError = GetStrategyStatusErrors[keyof GetStrategyStatusErrors];
608
- type GetStrategyStatusResponses = {
807
+ type GetStrategyError = GetStrategyErrors[keyof GetStrategyErrors];
808
+ type GetStrategyResponses = {
609
809
  /**
610
810
  * Strategy compile state
611
811
  */
@@ -622,39 +822,12 @@ type GetStrategyStatusResponses = {
622
822
  statusDetail?: string | null;
623
823
  };
624
824
  };
625
- type GetStrategyStatusResponse = GetStrategyStatusResponses[keyof GetStrategyStatusResponses];
626
- type PrepareBacktestingData = {
825
+ type GetStrategyResponse = GetStrategyResponses[keyof GetStrategyResponses];
826
+ type PrepareBacktestData = {
627
827
  /**
628
828
  * The required data to prepare a backtesting
629
829
  */
630
- body: {
631
- instrument: Instrument;
632
- /**
633
- * Start date for the preparation process. Supports the following formats:
634
- * - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
635
- * - ISO DATE (e.g. 2024-12-14)
636
- * - BASIC ISO DATE (e.g., 20241214)
637
- *
638
- */
639
- from: string;
640
- /**
641
- * End date for the preparation process. Supports the following formats:
642
- * - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
643
- * - ISO DATE (e.g. 2024-12-14)
644
- * - BASIC ISO DATE (e.g., 20241214)
645
- *
646
- */
647
- to: string;
648
- /**
649
- * Output bar cadence for the prepared range. Defaults to the publisher's
650
- * native cadence (`1s`); coarser cadences are produced on demand via
651
- * resampling and stored alongside the native blob in cache. Coarser-than-
652
- * source values must be exact multiples of the source cadence — invalid
653
- * labels return `400`.
654
- *
655
- */
656
- cadence?: '1s' | '5s' | '1m' | '5m' | '15m' | '1h' | '4h' | '1d';
657
- };
830
+ body: PrepareRequest;
658
831
  path: {
659
832
  /**
660
833
  * ID of the exchange to prepare the backtesting for
@@ -668,7 +841,7 @@ type PrepareBacktestingData = {
668
841
  query?: never;
669
842
  url: '/backtest/{exchangeId}/{type}/prepare';
670
843
  };
671
- type PrepareBacktestingErrors = {
844
+ type PrepareBacktestErrors = {
672
845
  /**
673
846
  * Invalid request or parameters. Also returned when `from` is older than the configured
674
847
  * lookback window or `to` is in the future.
@@ -686,15 +859,15 @@ type PrepareBacktestingErrors = {
686
859
  */
687
860
  429: ResponseError;
688
861
  };
689
- type PrepareBacktestingError = PrepareBacktestingErrors[keyof PrepareBacktestingErrors];
690
- type PrepareBacktestingResponses = {
862
+ type PrepareBacktestError = PrepareBacktestErrors[keyof PrepareBacktestErrors];
863
+ type PrepareBacktestResponses = {
691
864
  /**
692
865
  * Prepare task accepted (queued for processing)
693
866
  */
694
867
  202: AcceptedJob;
695
868
  };
696
- type PrepareBacktestingResponse = PrepareBacktestingResponses[keyof PrepareBacktestingResponses];
697
- type GetPreparationStatusData = {
869
+ type PrepareBacktestResponse = PrepareBacktestResponses[keyof PrepareBacktestResponses];
870
+ type GetPrepareStatusData = {
698
871
  body?: never;
699
872
  path: {
700
873
  /**
@@ -713,7 +886,7 @@ type GetPreparationStatusData = {
713
886
  query?: never;
714
887
  url: '/backtest/{exchangeId}/{type}/prepare/{jobId}';
715
888
  };
716
- type GetPreparationStatusErrors = {
889
+ type GetPrepareStatusErrors = {
717
890
  /**
718
891
  * Invalid request or parameters
719
892
  */
@@ -723,15 +896,109 @@ type GetPreparationStatusErrors = {
723
896
  */
724
897
  404: ResponseError;
725
898
  };
726
- type GetPreparationStatusError = GetPreparationStatusErrors[keyof GetPreparationStatusErrors];
727
- type GetPreparationStatusResponses = {
899
+ type GetPrepareStatusError = GetPrepareStatusErrors[keyof GetPrepareStatusErrors];
900
+ type GetPrepareStatusResponses = {
728
901
  /**
729
902
  * Current prepare job state
730
903
  */
731
- 200: JobState;
904
+ 200: PrepareJobState;
905
+ };
906
+ type GetPrepareStatusResponse = GetPrepareStatusResponses[keyof GetPrepareStatusResponses];
907
+ type ExecuteSweepData = {
908
+ body: ExecuteSweepRequest;
909
+ path: {
910
+ exchangeId: string;
911
+ type: DataSourceType;
912
+ /**
913
+ * Job ID returned by `POST /backtest/{exchangeId}/{type}/prepare`.
914
+ */
915
+ requestId: string;
916
+ };
917
+ query?: never;
918
+ url: '/backtest/{exchangeId}/{type}/executeSweep/{requestId}';
919
+ };
920
+ type ExecuteSweepErrors = {
921
+ /**
922
+ * Invalid sweep specification or the expanded grid exceeds the server limit.
923
+ */
924
+ 400: ResponseError;
925
+ /**
926
+ * Prepared request not found or expired.
927
+ */
928
+ 404: ResponseError;
929
+ /**
930
+ * Sweep queue or user concurrency limit reached.
931
+ */
932
+ 429: ResponseError;
732
933
  };
733
- type GetPreparationStatusResponse = GetPreparationStatusResponses[keyof GetPreparationStatusResponses];
734
- type ExecuteBacktestingData = {
934
+ type ExecuteSweepError = ExecuteSweepErrors[keyof ExecuteSweepErrors];
935
+ type ExecuteSweepResponses = {
936
+ /**
937
+ * Sweep accepted. The effective seed is returned for reproducibility.
938
+ */
939
+ 202: ExecuteSweepAccepted;
940
+ };
941
+ type ExecuteSweepResponse = ExecuteSweepResponses[keyof ExecuteSweepResponses];
942
+ type CancelSweepData = {
943
+ body?: never;
944
+ path: {
945
+ exchangeId: string;
946
+ type: DataSourceType;
947
+ requestId: string;
948
+ sweepId: string;
949
+ };
950
+ query?: never;
951
+ url: '/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}';
952
+ };
953
+ type CancelSweepErrors = {
954
+ /**
955
+ * Sweep not found.
956
+ */
957
+ 404: ResponseError;
958
+ };
959
+ type CancelSweepError = CancelSweepErrors[keyof CancelSweepErrors];
960
+ type CancelSweepResponses = {
961
+ /**
962
+ * Cancellation requested.
963
+ */
964
+ 200: {
965
+ status: 'cancelling';
966
+ sweepId: string;
967
+ };
968
+ };
969
+ type CancelSweepResponse = CancelSweepResponses[keyof CancelSweepResponses];
970
+ type GetSweepResultData = {
971
+ body?: never;
972
+ path: {
973
+ exchangeId: string;
974
+ type: DataSourceType;
975
+ requestId: string;
976
+ sweepId: string;
977
+ };
978
+ query?: {
979
+ objective?: 'sharpe' | 'sortino' | 'pnl' | 'maxdd';
980
+ /**
981
+ * `natural` is stable materialisation order; `ranked` is the display view.
982
+ */
983
+ order?: 'ranked' | 'natural';
984
+ };
985
+ url: '/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}';
986
+ };
987
+ type GetSweepResultErrors = {
988
+ /**
989
+ * Sweep not found or expired.
990
+ */
991
+ 404: ResponseError;
992
+ };
993
+ type GetSweepResultError = GetSweepResultErrors[keyof GetSweepResultErrors];
994
+ type GetSweepResultResponses = {
995
+ /**
996
+ * Current sweep snapshot and all currently available result rows for the selected view.
997
+ */
998
+ 200: ExecuteSweepResult;
999
+ };
1000
+ type GetSweepResultResponse = GetSweepResultResponses[keyof GetSweepResultResponses];
1001
+ type ExecuteBacktestData = {
735
1002
  /**
736
1003
  * Execute task parameters
737
1004
  */
@@ -761,7 +1028,7 @@ type ExecuteBacktestingData = {
761
1028
  query?: never;
762
1029
  url: '/backtest/{exchangeId}/{type}/execute';
763
1030
  };
764
- type ExecuteBacktestingErrors = {
1031
+ type ExecuteBacktestErrors = {
765
1032
  /**
766
1033
  * Invalid request or parameters
767
1034
  */
@@ -775,15 +1042,15 @@ type ExecuteBacktestingErrors = {
775
1042
  */
776
1043
  429: ResponseError;
777
1044
  };
778
- type ExecuteBacktestingError = ExecuteBacktestingErrors[keyof ExecuteBacktestingErrors];
779
- type ExecuteBacktestingResponses = {
1045
+ type ExecuteBacktestError = ExecuteBacktestErrors[keyof ExecuteBacktestErrors];
1046
+ type ExecuteBacktestResponses = {
780
1047
  /**
781
1048
  * Execute task accepted (queued for processing)
782
1049
  */
783
1050
  202: AcceptedJob;
784
1051
  };
785
- type ExecuteBacktestingResponse = ExecuteBacktestingResponses[keyof ExecuteBacktestingResponses];
786
- type CancelExecutionData = {
1052
+ type ExecuteBacktestResponse = ExecuteBacktestResponses[keyof ExecuteBacktestResponses];
1053
+ type CancelBacktestData = {
787
1054
  body?: never;
788
1055
  path: {
789
1056
  exchangeId: string;
@@ -796,14 +1063,14 @@ type CancelExecutionData = {
796
1063
  query?: never;
797
1064
  url: '/backtest/{exchangeId}/{type}/execute/{jobId}';
798
1065
  };
799
- type CancelExecutionErrors = {
1066
+ type CancelBacktestErrors = {
800
1067
  /**
801
1068
  * Execution not found
802
1069
  */
803
1070
  404: ResponseError;
804
1071
  };
805
- type CancelExecutionError = CancelExecutionErrors[keyof CancelExecutionErrors];
806
- type CancelExecutionResponses = {
1072
+ type CancelBacktestError = CancelBacktestErrors[keyof CancelBacktestErrors];
1073
+ type CancelBacktestResponses = {
807
1074
  /**
808
1075
  * Cancellation request accepted
809
1076
  */
@@ -812,8 +1079,8 @@ type CancelExecutionResponses = {
812
1079
  jobId?: string;
813
1080
  };
814
1081
  };
815
- type CancelExecutionResponse = CancelExecutionResponses[keyof CancelExecutionResponses];
816
- type GetExecutionResultData = {
1082
+ type CancelBacktestResponse = CancelBacktestResponses[keyof CancelBacktestResponses];
1083
+ type GetBacktestResultData = {
817
1084
  body?: never;
818
1085
  path: {
819
1086
  /**
@@ -832,7 +1099,7 @@ type GetExecutionResultData = {
832
1099
  query?: never;
833
1100
  url: '/backtest/{exchangeId}/{type}/execute/{jobId}';
834
1101
  };
835
- type GetExecutionResultErrors = {
1102
+ type GetBacktestResultErrors = {
836
1103
  /**
837
1104
  * Invalid request or parameters
838
1105
  */
@@ -842,14 +1109,14 @@ type GetExecutionResultErrors = {
842
1109
  */
843
1110
  404: ResponseError;
844
1111
  };
845
- type GetExecutionResultError = GetExecutionResultErrors[keyof GetExecutionResultErrors];
846
- type GetExecutionResultResponses = {
1112
+ type GetBacktestResultError = GetBacktestResultErrors[keyof GetBacktestResultErrors];
1113
+ type GetBacktestResultResponses = {
847
1114
  /**
848
1115
  * Backtesting execution result
849
1116
  */
850
1117
  200: BacktestJobResult;
851
1118
  };
852
- type GetExecutionResultResponse = GetExecutionResultResponses[keyof GetExecutionResultResponses];
1119
+ type GetBacktestResultResponse = GetBacktestResultResponses[keyof GetBacktestResultResponses];
853
1120
  type ClientOptions = {
854
1121
  baseUrl: 'https://api.staging.qtsurfer.com/v1' | 'https://api.qtsurfer.com/v1' | (string & {});
855
1122
  };
@@ -879,29 +1146,29 @@ type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean
879
1146
  * before expiry (or on a `401` response) by calling this endpoint again.
880
1147
  *
881
1148
  */
882
- declare const auth: <ThrowOnError extends boolean = false>(options?: Options<AuthData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AuthTokenResponse, unknown, ThrowOnError>;
1149
+ declare const authenticate: <ThrowOnError extends boolean = false>(options?: Options<AuthenticateData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AuthTokenResponse, unknown, ThrowOnError>;
883
1150
  /**
884
- * Get a list of available exchanges
1151
+ * List the available exchanges
885
1152
  */
886
- declare const getExchanges: <ThrowOnError extends boolean = false>(options?: Options<GetExchangesData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Exchange[], unknown, ThrowOnError>;
1153
+ declare const listExchanges: <ThrowOnError extends boolean = false>(options?: Options<ListExchangesData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Exchange[], unknown, ThrowOnError>;
887
1154
  /**
888
- * Get an exchange's instruments (default spot segment)
1155
+ * List an exchange's instruments (default spot segment)
889
1156
  * "Give me binance instruments" — returns the exchange's DEFAULT segment (`spot`)
890
1157
  * in `data`, each instrument with per-data-type coverage and market info. `meta`
891
1158
  * confirms the served `segment` (`spot`); HAL `_links` carry `self` plus the
892
1159
  * `spot` / `futures` segment-discovery links.
893
1160
  *
894
1161
  */
895
- declare const getInstruments: <ThrowOnError extends boolean = false>(options: Options<GetInstrumentsData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<InstrumentListResponse, ResponseError, ThrowOnError>;
1162
+ declare const listInstruments: <ThrowOnError extends boolean = false>(options: Options<ListInstrumentsData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<InstrumentListResponse, ResponseError, ThrowOnError>;
896
1163
  /**
897
- * Get the instruments for a specific exchange segment
1164
+ * List an exchange segment's instruments
898
1165
  * Returns the instruments for one market segment of the exchange, each with
899
1166
  * per-data-type coverage and market info. HAL `_links` carry `self` plus the
900
1167
  * `spot` / `futures` segment-discovery links; the default-segment shortcut is
901
1168
  * `GET /exchange/{exchangeId}/instruments` (spot).
902
1169
  *
903
1170
  */
904
- declare const getSegmentInstruments: <ThrowOnError extends boolean = false>(options: Options<GetSegmentInstrumentsData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<InstrumentListResponse, ResponseError, ThrowOnError>;
1171
+ declare const listSegmentInstruments: <ThrowOnError extends boolean = false>(options: Options<ListSegmentInstrumentsData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<InstrumentListResponse, ResponseError, ThrowOnError>;
905
1172
  /**
906
1173
  * Download one hour of tickers for an instrument as a Lastra segment
907
1174
  * Serves exactly one hour of raw ticker data for the given instrument on the
@@ -934,7 +1201,7 @@ declare const getSegmentInstruments: <ThrowOnError extends boolean = false>(opti
934
1201
  * descriptive filename).
935
1202
  *
936
1203
  */
937
- declare const getExchangeTickersHour: <ThrowOnError extends boolean = false>(options: Options<GetExchangeTickersHourData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Blob | File, ResponseError, ThrowOnError>;
1204
+ declare const downloadTickers: <ThrowOnError extends boolean = false>(options: Options<DownloadTickersData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Blob | File, ResponseError, ThrowOnError>;
938
1205
  /**
939
1206
  * Download one hour of klines for an instrument as a Lastra segment
940
1207
  * Same shape and semantics as `/exchange/{exchangeId}/tickers/{base}/{quote}`,
@@ -947,7 +1214,7 @@ declare const getExchangeTickersHour: <ThrowOnError extends boolean = false>(opt
947
1214
  * per-tick payload would be too large for the window of interest.
948
1215
  *
949
1216
  */
950
- declare const getExchangeKlinesHour: <ThrowOnError extends boolean = false>(options: Options<GetExchangeKlinesHourData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Blob | File, ResponseError, ThrowOnError>;
1217
+ declare const downloadKlines: <ThrowOnError extends boolean = false>(options: Options<DownloadKlinesData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Blob | File, ResponseError, ThrowOnError>;
951
1218
  /**
952
1219
  * Compile a strategy from source code
953
1220
  * Submits raw strategy source for compilation. By default the call is synchronous and returns
@@ -959,21 +1226,21 @@ declare const getExchangeKlinesHour: <ThrowOnError extends boolean = false>(opti
959
1226
  * same id.
960
1227
  *
961
1228
  */
962
- declare const postStrategy: <ThrowOnError extends boolean = false>(options: Options<PostStrategyData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<PostStrategyResponse, ResponseError, ThrowOnError>;
1229
+ declare const compileStrategy: <ThrowOnError extends boolean = false>(options: Options<CompileStrategyData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<CompileStrategyResponse, ResponseError, ThrowOnError>;
963
1230
  /**
964
- * Get the status of an async compile task
1231
+ * Get a strategy by id, including its compile status
965
1232
  * Polls the status of a strategy compilation. Useful when the strategy was submitted with
966
1233
  * `X-Compile-Async: true`. Returns the resolved `strategyId` once compilation completes.
967
1234
  *
968
1235
  */
969
- declare const getStrategyStatus: <ThrowOnError extends boolean = false>(options: Options<GetStrategyStatusData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
1236
+ declare const getStrategy: <ThrowOnError extends boolean = false>(options: Options<GetStrategyData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
970
1237
  jobId?: string;
971
1238
  status: "New" | "Started" | "Completed" | "Aborted" | "Failed";
972
1239
  strategyId?: StrategyId;
973
1240
  statusDetail?: string | null;
974
1241
  }, ResponseError, ThrowOnError>;
975
1242
  /**
976
- * Prepare backtesting data
1243
+ * Prepare backtest data
977
1244
  * Enqueues a prepare task over the requested date range. Returns immediately with a `jobId`;
978
1245
  * poll `GET /backtest/{exchangeId}/{type}/prepare/{jobId}` for completion.
979
1246
  *
@@ -981,14 +1248,38 @@ declare const getStrategyStatus: <ThrowOnError extends boolean = false>(options:
981
1248
  * params do not enqueue duplicate work — they reuse the existing job.
982
1249
  *
983
1250
  */
984
- declare const prepareBacktesting: <ThrowOnError extends boolean = false>(options: Options<PrepareBacktestingData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AcceptedJob, ResponseError, ThrowOnError>;
1251
+ declare const prepareBacktest: <ThrowOnError extends boolean = false>(options: Options<PrepareBacktestData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AcceptedJob, ResponseError, ThrowOnError>;
985
1252
  /**
986
1253
  * Get the status of a prepare job
987
1254
  * Retrieves the current state of the prepare job identified by `jobId`.
988
1255
  * Poll until `status` is `Completed`, `Failed`, or `Aborted`.
989
1256
  *
990
1257
  */
991
- declare const getPreparationStatus: <ThrowOnError extends boolean = false>(options: Options<GetPreparationStatusData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<JobState, ResponseError, ThrowOnError>;
1258
+ declare const getPrepareStatus: <ThrowOnError extends boolean = false>(options: Options<GetPrepareStatusData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<PrepareJobState, ResponseError, ThrowOnError>;
1259
+ /**
1260
+ * Execute a parameter sweep over prepared data
1261
+ * Runs a parameter matrix over the single immutable dataset identified by `requestId`.
1262
+ * The backend expands and executes the matrix internally; clients poll the returned
1263
+ * `sweepId` for incremental results.
1264
+ *
1265
+ */
1266
+ declare const executeSweep: <ThrowOnError extends boolean = false>(options: Options<ExecuteSweepData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<ExecuteSweepAccepted, ResponseError, ThrowOnError>;
1267
+ /**
1268
+ * Cancel a running parameter sweep
1269
+ * Requests cancellation between parameter vectors. Completed rows remain readable.
1270
+ */
1271
+ declare const cancelSweep: <ThrowOnError extends boolean = false>(options: Options<CancelSweepData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
1272
+ status: "cancelling";
1273
+ sweepId: string;
1274
+ }, ResponseError, ThrowOnError>;
1275
+ /**
1276
+ * Get sweep progress and results
1277
+ * Returns incremental sweep progress. The default `ranked` view sorts and may truncate the
1278
+ * display leaderboard. `order=natural` returns every available row, untruncated, ordered by
1279
+ * deterministic `runIx`; use that view when materialising durable trial rows.
1280
+ *
1281
+ */
1282
+ declare const getSweepResult: <ThrowOnError extends boolean = false>(options: Options<GetSweepResultData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<ExecuteSweepResult, ResponseError, ThrowOnError>;
992
1283
  /**
993
1284
  * Execute a compiled strategy against a prepared dataset
994
1285
  * Enqueues an execute task that runs the strategy identified by `strategyId` over the data
@@ -1002,7 +1293,7 @@ declare const getPreparationStatus: <ThrowOnError extends boolean = false>(optio
1002
1293
  * `jobId` (idempotent).
1003
1294
  *
1004
1295
  */
1005
- declare const executeBacktesting: <ThrowOnError extends boolean = false>(options: Options<ExecuteBacktestingData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AcceptedJob, ResponseError, ThrowOnError>;
1296
+ declare const executeBacktest: <ThrowOnError extends boolean = false>(options: Options<ExecuteBacktestData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AcceptedJob, ResponseError, ThrowOnError>;
1006
1297
  /**
1007
1298
  * Cancel a running backtest execution
1008
1299
  * Requests cancellation of the specified execution. The execution
@@ -1011,7 +1302,7 @@ declare const executeBacktesting: <ThrowOnError extends boolean = false>(options
1011
1302
  * to confirm the final status.
1012
1303
  *
1013
1304
  */
1014
- declare const cancelExecution: <ThrowOnError extends boolean = false>(options: Options<CancelExecutionData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
1305
+ declare const cancelBacktest: <ThrowOnError extends boolean = false>(options: Options<CancelBacktestData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
1015
1306
  status?: "cancelling";
1016
1307
  jobId?: string;
1017
1308
  }, ResponseError, ThrowOnError>;
@@ -1021,8 +1312,8 @@ declare const cancelExecution: <ThrowOnError extends boolean = false>(options: O
1021
1312
  * Poll until `state.status` is `Completed`, `Failed`, or `Aborted`.
1022
1313
  *
1023
1314
  */
1024
- declare const getExecutionResult: <ThrowOnError extends boolean = false>(options: Options<GetExecutionResultData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<BacktestJobResult, ResponseError, ThrowOnError>;
1315
+ declare const getBacktestResult: <ThrowOnError extends boolean = false>(options: Options<GetBacktestResultData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<BacktestJobResult, ResponseError, ThrowOnError>;
1025
1316
 
1026
1317
  declare const client: _hey_api_client_fetch.Client;
1027
1318
 
1028
- export { type AcceptedJob, type AuthData, type AuthError, type AuthErrors, type AuthResponse, type AuthResponses, type AuthTokenError, type AuthTokenResponse, type BacktestJobResult, type CancelExecutionData, type CancelExecutionError, type CancelExecutionErrors, type CancelExecutionResponse, type CancelExecutionResponses, type ClientOptions, type CoverageWindow, type DataSourceType, type EquityPoint, type Exchange, type ExecuteBacktestingData, type ExecuteBacktestingError, type ExecuteBacktestingErrors, type ExecuteBacktestingResponse, type ExecuteBacktestingResponses, type GetExchangeKlinesHourData, type GetExchangeKlinesHourError, type GetExchangeKlinesHourErrors, type GetExchangeKlinesHourResponse, type GetExchangeKlinesHourResponses, type GetExchangeTickersHourData, type GetExchangeTickersHourError, type GetExchangeTickersHourErrors, type GetExchangeTickersHourResponse, type GetExchangeTickersHourResponses, type GetExchangesData, type GetExchangesResponse, type GetExchangesResponses, type GetExecutionResultData, type GetExecutionResultError, type GetExecutionResultErrors, type GetExecutionResultResponse, type GetExecutionResultResponses, type GetInstrumentsData, type GetInstrumentsError, type GetInstrumentsErrors, type GetInstrumentsResponse, type GetInstrumentsResponses, type GetPreparationStatusData, type GetPreparationStatusError, type GetPreparationStatusErrors, type GetPreparationStatusResponse, type GetPreparationStatusResponses, type GetSegmentInstrumentsData, type GetSegmentInstrumentsError, type GetSegmentInstrumentsErrors, type GetSegmentInstrumentsResponse, type GetSegmentInstrumentsResponses, type GetStrategyStatusData, type GetStrategyStatusError, type GetStrategyStatusErrors, type GetStrategyStatusResponse, type GetStrategyStatusResponses, type HalLink, type Instrument, type InstrumentCoverage, type InstrumentDetail, type InstrumentLinks, type InstrumentListMeta, type InstrumentListResponse, type JobState, type Options, type PostStrategyData, type PostStrategyError, type PostStrategyErrors, type PostStrategyResponse, type PostStrategyResponses, type PrepareBacktestingData, type PrepareBacktestingError, type PrepareBacktestingErrors, type PrepareBacktestingResponse, type PrepareBacktestingResponses, type ResponseError, type ResultMap, type StrategyId, auth, cancelExecution, client, executeBacktesting, getExchangeKlinesHour, getExchangeTickersHour, getExchanges, getExecutionResult, getInstruments, getPreparationStatus, getSegmentInstruments, getStrategyStatus, postStrategy, prepareBacktesting };
1319
+ export { type AcceptedJob, type AuthTokenError, type AuthTokenResponse, type AuthenticateData, type AuthenticateError, type AuthenticateErrors, type AuthenticateResponse, type AuthenticateResponses, type BacktestJobResult, type CancelBacktestData, type CancelBacktestError, type CancelBacktestErrors, type CancelBacktestResponse, type CancelBacktestResponses, type CancelSweepData, type CancelSweepError, type CancelSweepErrors, type CancelSweepResponse, type CancelSweepResponses, type ClientOptions, type CompileStrategyData, type CompileStrategyError, type CompileStrategyErrors, type CompileStrategyResponse, type CompileStrategyResponses, type CoverageWindow, type DataSourceType, type DownloadKlinesData, type DownloadKlinesError, type DownloadKlinesErrors, type DownloadKlinesResponse, type DownloadKlinesResponses, type DownloadTickersData, type DownloadTickersError, type DownloadTickersErrors, type DownloadTickersResponse, type DownloadTickersResponses, type EquityPoint, type Exchange, type ExecuteBacktestData, type ExecuteBacktestError, type ExecuteBacktestErrors, type ExecuteBacktestResponse, type ExecuteBacktestResponses, type ExecuteSweepAccepted, type ExecuteSweepData, type ExecuteSweepError, type ExecuteSweepErrors, type ExecuteSweepRequest, type ExecuteSweepResponse, type ExecuteSweepResponses, type ExecuteSweepResult, type GetBacktestResultData, type GetBacktestResultError, type GetBacktestResultErrors, type GetBacktestResultResponse, type GetBacktestResultResponses, type GetPrepareStatusData, type GetPrepareStatusError, type GetPrepareStatusErrors, type GetPrepareStatusResponse, type GetPrepareStatusResponses, type GetStrategyData, type GetStrategyError, type GetStrategyErrors, type GetStrategyResponse, type GetStrategyResponses, type GetSweepResultData, type GetSweepResultError, type GetSweepResultErrors, type GetSweepResultResponse, type GetSweepResultResponses, type 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 Options, type PrepareBacktestData, type PrepareBacktestError, type PrepareBacktestErrors, type PrepareBacktestResponse, type PrepareBacktestResponses, type PrepareJobState, type PrepareRequest, type ResponseError, type ResultMap, type StrategyId, type SweepAxis, type SweepBaseConfig, type SweepProgress, type SweepRunRow, type SweepSpecRequest, authenticate, cancelBacktest, cancelSweep, client, compileStrategy, downloadKlines, downloadTickers, executeBacktest, executeSweep, getBacktestResult, getPrepareStatus, getStrategy, getSweepResult, listExchanges, listInstruments, listSegmentInstruments, prepareBacktest };