@qtsurfer/api-client 0.4.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/README.md +22 -22
- package/dist/index.d.ts +346 -110
- package/dist/index.js +69 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/generated/schemas.gen.ts +379 -0
- package/src/generated/sdk.gen.ts +93 -32
- package/src/generated/types.gen.ts +327 -91
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
|
*/
|
|
@@ -245,6 +273,123 @@ type PrepareJobState = JobState & {
|
|
|
245
273
|
rationale?: 'pending_conversion' | 'low_activity' | 'unknown';
|
|
246
274
|
}>;
|
|
247
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
|
+
};
|
|
248
393
|
/**
|
|
249
394
|
* Response returned by async endpoints (`202 Accepted`). The `jobId` is deterministic for the
|
|
250
395
|
* same input parameters — repeated calls with identical params return the same id.
|
|
@@ -400,13 +545,13 @@ type AuthTokenError = {
|
|
|
400
545
|
*/
|
|
401
546
|
message: string;
|
|
402
547
|
};
|
|
403
|
-
type
|
|
548
|
+
type AuthenticateData = {
|
|
404
549
|
body?: never;
|
|
405
550
|
path?: never;
|
|
406
551
|
query?: never;
|
|
407
552
|
url: '/auth/token';
|
|
408
553
|
};
|
|
409
|
-
type
|
|
554
|
+
type AuthenticateErrors = {
|
|
410
555
|
/**
|
|
411
556
|
* API key is invalid, revoked, or expired.
|
|
412
557
|
*/
|
|
@@ -416,28 +561,28 @@ type AuthErrors = {
|
|
|
416
561
|
*/
|
|
417
562
|
429: unknown;
|
|
418
563
|
};
|
|
419
|
-
type
|
|
420
|
-
type
|
|
564
|
+
type AuthenticateError = AuthenticateErrors[keyof AuthenticateErrors];
|
|
565
|
+
type AuthenticateResponses = {
|
|
421
566
|
/**
|
|
422
567
|
* API key accepted; JWT returned.
|
|
423
568
|
*/
|
|
424
569
|
200: AuthTokenResponse;
|
|
425
570
|
};
|
|
426
|
-
type
|
|
427
|
-
type
|
|
571
|
+
type AuthenticateResponse = AuthenticateResponses[keyof AuthenticateResponses];
|
|
572
|
+
type ListExchangesData = {
|
|
428
573
|
body?: never;
|
|
429
574
|
path?: never;
|
|
430
575
|
query?: never;
|
|
431
576
|
url: '/exchanges';
|
|
432
577
|
};
|
|
433
|
-
type
|
|
578
|
+
type ListExchangesResponses = {
|
|
434
579
|
/**
|
|
435
580
|
* A JSON array of Exchanges
|
|
436
581
|
*/
|
|
437
582
|
200: Array<Exchange>;
|
|
438
583
|
};
|
|
439
|
-
type
|
|
440
|
-
type
|
|
584
|
+
type ListExchangesResponse = ListExchangesResponses[keyof ListExchangesResponses];
|
|
585
|
+
type ListInstrumentsData = {
|
|
441
586
|
body?: never;
|
|
442
587
|
path: {
|
|
443
588
|
/**
|
|
@@ -448,21 +593,21 @@ type GetInstrumentsData = {
|
|
|
448
593
|
query?: never;
|
|
449
594
|
url: '/exchange/{exchangeId}/instruments';
|
|
450
595
|
};
|
|
451
|
-
type
|
|
596
|
+
type ListInstrumentsErrors = {
|
|
452
597
|
/**
|
|
453
598
|
* Exchange not found or instrument catalog not available
|
|
454
599
|
*/
|
|
455
600
|
404: ResponseError;
|
|
456
601
|
};
|
|
457
|
-
type
|
|
458
|
-
type
|
|
602
|
+
type ListInstrumentsError = ListInstrumentsErrors[keyof ListInstrumentsErrors];
|
|
603
|
+
type ListInstrumentsResponses = {
|
|
459
604
|
/**
|
|
460
605
|
* The default (spot) segment's instruments in `data`, `meta`, and HAL `_links` (self + spot/futures segment discovery)
|
|
461
606
|
*/
|
|
462
607
|
200: InstrumentListResponse;
|
|
463
608
|
};
|
|
464
|
-
type
|
|
465
|
-
type
|
|
609
|
+
type ListInstrumentsResponse = ListInstrumentsResponses[keyof ListInstrumentsResponses];
|
|
610
|
+
type ListSegmentInstrumentsData = {
|
|
466
611
|
body?: never;
|
|
467
612
|
path: {
|
|
468
613
|
/**
|
|
@@ -477,21 +622,21 @@ type GetSegmentInstrumentsData = {
|
|
|
477
622
|
query?: never;
|
|
478
623
|
url: '/exchange/{exchangeId}/{segment}/instruments';
|
|
479
624
|
};
|
|
480
|
-
type
|
|
625
|
+
type ListSegmentInstrumentsErrors = {
|
|
481
626
|
/**
|
|
482
627
|
* Exchange, segment, or instrument catalog not found
|
|
483
628
|
*/
|
|
484
629
|
404: ResponseError;
|
|
485
630
|
};
|
|
486
|
-
type
|
|
487
|
-
type
|
|
631
|
+
type ListSegmentInstrumentsError = ListSegmentInstrumentsErrors[keyof ListSegmentInstrumentsErrors];
|
|
632
|
+
type ListSegmentInstrumentsResponses = {
|
|
488
633
|
/**
|
|
489
634
|
* An object with a `data` array of instrument details (each with per-data-type coverage) and a `meta` block
|
|
490
635
|
*/
|
|
491
636
|
200: InstrumentListResponse;
|
|
492
637
|
};
|
|
493
|
-
type
|
|
494
|
-
type
|
|
638
|
+
type ListSegmentInstrumentsResponse = ListSegmentInstrumentsResponses[keyof ListSegmentInstrumentsResponses];
|
|
639
|
+
type DownloadTickersData = {
|
|
495
640
|
body?: never;
|
|
496
641
|
path: {
|
|
497
642
|
/**
|
|
@@ -524,7 +669,7 @@ type GetExchangeTickersHourData = {
|
|
|
524
669
|
};
|
|
525
670
|
url: '/exchange/{exchangeId}/tickers/{base}/{quote}';
|
|
526
671
|
};
|
|
527
|
-
type
|
|
672
|
+
type DownloadTickersErrors = {
|
|
528
673
|
/**
|
|
529
674
|
* Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
|
|
530
675
|
*/
|
|
@@ -538,8 +683,8 @@ type GetExchangeTickersHourErrors = {
|
|
|
538
683
|
*/
|
|
539
684
|
500: ResponseError;
|
|
540
685
|
};
|
|
541
|
-
type
|
|
542
|
-
type
|
|
686
|
+
type DownloadTickersError = DownloadTickersErrors[keyof DownloadTickersErrors];
|
|
687
|
+
type DownloadTickersResponses = {
|
|
543
688
|
/**
|
|
544
689
|
* One hour of tickers for the instrument. `Content-Type` is
|
|
545
690
|
* `application/vnd.lastra` by default or
|
|
@@ -549,8 +694,8 @@ type GetExchangeTickersHourResponses = {
|
|
|
549
694
|
*/
|
|
550
695
|
200: Blob | File;
|
|
551
696
|
};
|
|
552
|
-
type
|
|
553
|
-
type
|
|
697
|
+
type DownloadTickersResponse = DownloadTickersResponses[keyof DownloadTickersResponses];
|
|
698
|
+
type DownloadKlinesData = {
|
|
554
699
|
body?: never;
|
|
555
700
|
path: {
|
|
556
701
|
/**
|
|
@@ -582,7 +727,7 @@ type GetExchangeKlinesHourData = {
|
|
|
582
727
|
};
|
|
583
728
|
url: '/exchange/{exchangeId}/klines/{base}/{quote}';
|
|
584
729
|
};
|
|
585
|
-
type
|
|
730
|
+
type DownloadKlinesErrors = {
|
|
586
731
|
/**
|
|
587
732
|
* Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
|
|
588
733
|
*/
|
|
@@ -596,8 +741,8 @@ type GetExchangeKlinesHourErrors = {
|
|
|
596
741
|
*/
|
|
597
742
|
500: ResponseError;
|
|
598
743
|
};
|
|
599
|
-
type
|
|
600
|
-
type
|
|
744
|
+
type DownloadKlinesError = DownloadKlinesErrors[keyof DownloadKlinesErrors];
|
|
745
|
+
type DownloadKlinesResponses = {
|
|
601
746
|
/**
|
|
602
747
|
* One hour of klines for the instrument. `Content-Type` is
|
|
603
748
|
* `application/vnd.lastra` by default or
|
|
@@ -606,8 +751,8 @@ type GetExchangeKlinesHourResponses = {
|
|
|
606
751
|
*/
|
|
607
752
|
200: Blob | File;
|
|
608
753
|
};
|
|
609
|
-
type
|
|
610
|
-
type
|
|
754
|
+
type DownloadKlinesResponse = DownloadKlinesResponses[keyof DownloadKlinesResponses];
|
|
755
|
+
type CompileStrategyData = {
|
|
611
756
|
/**
|
|
612
757
|
* Raw strategy Java source code
|
|
613
758
|
*/
|
|
@@ -622,14 +767,14 @@ type PostStrategyData = {
|
|
|
622
767
|
query?: never;
|
|
623
768
|
url: '/strategy';
|
|
624
769
|
};
|
|
625
|
-
type
|
|
770
|
+
type CompileStrategyErrors = {
|
|
626
771
|
/**
|
|
627
772
|
* Invalid strategy (compilation error)
|
|
628
773
|
*/
|
|
629
774
|
400: ResponseError;
|
|
630
775
|
};
|
|
631
|
-
type
|
|
632
|
-
type
|
|
776
|
+
type CompileStrategyError = CompileStrategyErrors[keyof CompileStrategyErrors];
|
|
777
|
+
type CompileStrategyResponses = {
|
|
633
778
|
/**
|
|
634
779
|
* Strategy compiled successfully (sync mode)
|
|
635
780
|
*/
|
|
@@ -641,8 +786,8 @@ type PostStrategyResponses = {
|
|
|
641
786
|
*/
|
|
642
787
|
202: AcceptedJob;
|
|
643
788
|
};
|
|
644
|
-
type
|
|
645
|
-
type
|
|
789
|
+
type CompileStrategyResponse = CompileStrategyResponses[keyof CompileStrategyResponses];
|
|
790
|
+
type GetStrategyData = {
|
|
646
791
|
body?: never;
|
|
647
792
|
path: {
|
|
648
793
|
/**
|
|
@@ -653,14 +798,14 @@ type GetStrategyStatusData = {
|
|
|
653
798
|
query?: never;
|
|
654
799
|
url: '/strategy/{strategyId}';
|
|
655
800
|
};
|
|
656
|
-
type
|
|
801
|
+
type GetStrategyErrors = {
|
|
657
802
|
/**
|
|
658
803
|
* Strategy compile job not found
|
|
659
804
|
*/
|
|
660
805
|
404: ResponseError;
|
|
661
806
|
};
|
|
662
|
-
type
|
|
663
|
-
type
|
|
807
|
+
type GetStrategyError = GetStrategyErrors[keyof GetStrategyErrors];
|
|
808
|
+
type GetStrategyResponses = {
|
|
664
809
|
/**
|
|
665
810
|
* Strategy compile state
|
|
666
811
|
*/
|
|
@@ -677,39 +822,12 @@ type GetStrategyStatusResponses = {
|
|
|
677
822
|
statusDetail?: string | null;
|
|
678
823
|
};
|
|
679
824
|
};
|
|
680
|
-
type
|
|
681
|
-
type
|
|
825
|
+
type GetStrategyResponse = GetStrategyResponses[keyof GetStrategyResponses];
|
|
826
|
+
type PrepareBacktestData = {
|
|
682
827
|
/**
|
|
683
828
|
* The required data to prepare a backtesting
|
|
684
829
|
*/
|
|
685
|
-
body:
|
|
686
|
-
instrument: Instrument;
|
|
687
|
-
/**
|
|
688
|
-
* Start date for the preparation process. Supports the following formats:
|
|
689
|
-
* - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
|
|
690
|
-
* - ISO DATE (e.g. 2024-12-14)
|
|
691
|
-
* - BASIC ISO DATE (e.g., 20241214)
|
|
692
|
-
*
|
|
693
|
-
*/
|
|
694
|
-
from: string;
|
|
695
|
-
/**
|
|
696
|
-
* End date for the preparation process. Supports the following formats:
|
|
697
|
-
* - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
|
|
698
|
-
* - ISO DATE (e.g. 2024-12-14)
|
|
699
|
-
* - BASIC ISO DATE (e.g., 20241214)
|
|
700
|
-
*
|
|
701
|
-
*/
|
|
702
|
-
to: string;
|
|
703
|
-
/**
|
|
704
|
-
* Output bar cadence for the prepared range. Defaults to the publisher's
|
|
705
|
-
* native cadence (`1s`); coarser cadences are produced on demand via
|
|
706
|
-
* resampling and stored alongside the native blob in cache. Coarser-than-
|
|
707
|
-
* source values must be exact multiples of the source cadence — invalid
|
|
708
|
-
* labels return `400`.
|
|
709
|
-
*
|
|
710
|
-
*/
|
|
711
|
-
cadence?: '1s' | '5s' | '1m' | '5m' | '15m' | '1h' | '4h' | '1d';
|
|
712
|
-
};
|
|
830
|
+
body: PrepareRequest;
|
|
713
831
|
path: {
|
|
714
832
|
/**
|
|
715
833
|
* ID of the exchange to prepare the backtesting for
|
|
@@ -723,7 +841,7 @@ type PrepareBacktestingData = {
|
|
|
723
841
|
query?: never;
|
|
724
842
|
url: '/backtest/{exchangeId}/{type}/prepare';
|
|
725
843
|
};
|
|
726
|
-
type
|
|
844
|
+
type PrepareBacktestErrors = {
|
|
727
845
|
/**
|
|
728
846
|
* Invalid request or parameters. Also returned when `from` is older than the configured
|
|
729
847
|
* lookback window or `to` is in the future.
|
|
@@ -741,15 +859,15 @@ type PrepareBacktestingErrors = {
|
|
|
741
859
|
*/
|
|
742
860
|
429: ResponseError;
|
|
743
861
|
};
|
|
744
|
-
type
|
|
745
|
-
type
|
|
862
|
+
type PrepareBacktestError = PrepareBacktestErrors[keyof PrepareBacktestErrors];
|
|
863
|
+
type PrepareBacktestResponses = {
|
|
746
864
|
/**
|
|
747
865
|
* Prepare task accepted (queued for processing)
|
|
748
866
|
*/
|
|
749
867
|
202: AcceptedJob;
|
|
750
868
|
};
|
|
751
|
-
type
|
|
752
|
-
type
|
|
869
|
+
type PrepareBacktestResponse = PrepareBacktestResponses[keyof PrepareBacktestResponses];
|
|
870
|
+
type GetPrepareStatusData = {
|
|
753
871
|
body?: never;
|
|
754
872
|
path: {
|
|
755
873
|
/**
|
|
@@ -768,7 +886,7 @@ type GetPreparationStatusData = {
|
|
|
768
886
|
query?: never;
|
|
769
887
|
url: '/backtest/{exchangeId}/{type}/prepare/{jobId}';
|
|
770
888
|
};
|
|
771
|
-
type
|
|
889
|
+
type GetPrepareStatusErrors = {
|
|
772
890
|
/**
|
|
773
891
|
* Invalid request or parameters
|
|
774
892
|
*/
|
|
@@ -778,15 +896,109 @@ type GetPreparationStatusErrors = {
|
|
|
778
896
|
*/
|
|
779
897
|
404: ResponseError;
|
|
780
898
|
};
|
|
781
|
-
type
|
|
782
|
-
type
|
|
899
|
+
type GetPrepareStatusError = GetPrepareStatusErrors[keyof GetPrepareStatusErrors];
|
|
900
|
+
type GetPrepareStatusResponses = {
|
|
783
901
|
/**
|
|
784
902
|
* Current prepare job state
|
|
785
903
|
*/
|
|
786
904
|
200: PrepareJobState;
|
|
787
905
|
};
|
|
788
|
-
type
|
|
789
|
-
type
|
|
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;
|
|
933
|
+
};
|
|
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 = {
|
|
790
1002
|
/**
|
|
791
1003
|
* Execute task parameters
|
|
792
1004
|
*/
|
|
@@ -816,7 +1028,7 @@ type ExecuteBacktestingData = {
|
|
|
816
1028
|
query?: never;
|
|
817
1029
|
url: '/backtest/{exchangeId}/{type}/execute';
|
|
818
1030
|
};
|
|
819
|
-
type
|
|
1031
|
+
type ExecuteBacktestErrors = {
|
|
820
1032
|
/**
|
|
821
1033
|
* Invalid request or parameters
|
|
822
1034
|
*/
|
|
@@ -830,15 +1042,15 @@ type ExecuteBacktestingErrors = {
|
|
|
830
1042
|
*/
|
|
831
1043
|
429: ResponseError;
|
|
832
1044
|
};
|
|
833
|
-
type
|
|
834
|
-
type
|
|
1045
|
+
type ExecuteBacktestError = ExecuteBacktestErrors[keyof ExecuteBacktestErrors];
|
|
1046
|
+
type ExecuteBacktestResponses = {
|
|
835
1047
|
/**
|
|
836
1048
|
* Execute task accepted (queued for processing)
|
|
837
1049
|
*/
|
|
838
1050
|
202: AcceptedJob;
|
|
839
1051
|
};
|
|
840
|
-
type
|
|
841
|
-
type
|
|
1052
|
+
type ExecuteBacktestResponse = ExecuteBacktestResponses[keyof ExecuteBacktestResponses];
|
|
1053
|
+
type CancelBacktestData = {
|
|
842
1054
|
body?: never;
|
|
843
1055
|
path: {
|
|
844
1056
|
exchangeId: string;
|
|
@@ -851,14 +1063,14 @@ type CancelExecutionData = {
|
|
|
851
1063
|
query?: never;
|
|
852
1064
|
url: '/backtest/{exchangeId}/{type}/execute/{jobId}';
|
|
853
1065
|
};
|
|
854
|
-
type
|
|
1066
|
+
type CancelBacktestErrors = {
|
|
855
1067
|
/**
|
|
856
1068
|
* Execution not found
|
|
857
1069
|
*/
|
|
858
1070
|
404: ResponseError;
|
|
859
1071
|
};
|
|
860
|
-
type
|
|
861
|
-
type
|
|
1072
|
+
type CancelBacktestError = CancelBacktestErrors[keyof CancelBacktestErrors];
|
|
1073
|
+
type CancelBacktestResponses = {
|
|
862
1074
|
/**
|
|
863
1075
|
* Cancellation request accepted
|
|
864
1076
|
*/
|
|
@@ -867,8 +1079,8 @@ type CancelExecutionResponses = {
|
|
|
867
1079
|
jobId?: string;
|
|
868
1080
|
};
|
|
869
1081
|
};
|
|
870
|
-
type
|
|
871
|
-
type
|
|
1082
|
+
type CancelBacktestResponse = CancelBacktestResponses[keyof CancelBacktestResponses];
|
|
1083
|
+
type GetBacktestResultData = {
|
|
872
1084
|
body?: never;
|
|
873
1085
|
path: {
|
|
874
1086
|
/**
|
|
@@ -887,7 +1099,7 @@ type GetExecutionResultData = {
|
|
|
887
1099
|
query?: never;
|
|
888
1100
|
url: '/backtest/{exchangeId}/{type}/execute/{jobId}';
|
|
889
1101
|
};
|
|
890
|
-
type
|
|
1102
|
+
type GetBacktestResultErrors = {
|
|
891
1103
|
/**
|
|
892
1104
|
* Invalid request or parameters
|
|
893
1105
|
*/
|
|
@@ -897,14 +1109,14 @@ type GetExecutionResultErrors = {
|
|
|
897
1109
|
*/
|
|
898
1110
|
404: ResponseError;
|
|
899
1111
|
};
|
|
900
|
-
type
|
|
901
|
-
type
|
|
1112
|
+
type GetBacktestResultError = GetBacktestResultErrors[keyof GetBacktestResultErrors];
|
|
1113
|
+
type GetBacktestResultResponses = {
|
|
902
1114
|
/**
|
|
903
1115
|
* Backtesting execution result
|
|
904
1116
|
*/
|
|
905
1117
|
200: BacktestJobResult;
|
|
906
1118
|
};
|
|
907
|
-
type
|
|
1119
|
+
type GetBacktestResultResponse = GetBacktestResultResponses[keyof GetBacktestResultResponses];
|
|
908
1120
|
type ClientOptions = {
|
|
909
1121
|
baseUrl: 'https://api.staging.qtsurfer.com/v1' | 'https://api.qtsurfer.com/v1' | (string & {});
|
|
910
1122
|
};
|
|
@@ -934,29 +1146,29 @@ type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean
|
|
|
934
1146
|
* before expiry (or on a `401` response) by calling this endpoint again.
|
|
935
1147
|
*
|
|
936
1148
|
*/
|
|
937
|
-
declare const
|
|
1149
|
+
declare const authenticate: <ThrowOnError extends boolean = false>(options?: Options<AuthenticateData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AuthTokenResponse, unknown, ThrowOnError>;
|
|
938
1150
|
/**
|
|
939
|
-
*
|
|
1151
|
+
* List the available exchanges
|
|
940
1152
|
*/
|
|
941
|
-
declare const
|
|
1153
|
+
declare const listExchanges: <ThrowOnError extends boolean = false>(options?: Options<ListExchangesData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Exchange[], unknown, ThrowOnError>;
|
|
942
1154
|
/**
|
|
943
|
-
*
|
|
1155
|
+
* List an exchange's instruments (default spot segment)
|
|
944
1156
|
* "Give me binance instruments" — returns the exchange's DEFAULT segment (`spot`)
|
|
945
1157
|
* in `data`, each instrument with per-data-type coverage and market info. `meta`
|
|
946
1158
|
* confirms the served `segment` (`spot`); HAL `_links` carry `self` plus the
|
|
947
1159
|
* `spot` / `futures` segment-discovery links.
|
|
948
1160
|
*
|
|
949
1161
|
*/
|
|
950
|
-
declare const
|
|
1162
|
+
declare const listInstruments: <ThrowOnError extends boolean = false>(options: Options<ListInstrumentsData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<InstrumentListResponse, ResponseError, ThrowOnError>;
|
|
951
1163
|
/**
|
|
952
|
-
*
|
|
1164
|
+
* List an exchange segment's instruments
|
|
953
1165
|
* Returns the instruments for one market segment of the exchange, each with
|
|
954
1166
|
* per-data-type coverage and market info. HAL `_links` carry `self` plus the
|
|
955
1167
|
* `spot` / `futures` segment-discovery links; the default-segment shortcut is
|
|
956
1168
|
* `GET /exchange/{exchangeId}/instruments` (spot).
|
|
957
1169
|
*
|
|
958
1170
|
*/
|
|
959
|
-
declare const
|
|
1171
|
+
declare const listSegmentInstruments: <ThrowOnError extends boolean = false>(options: Options<ListSegmentInstrumentsData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<InstrumentListResponse, ResponseError, ThrowOnError>;
|
|
960
1172
|
/**
|
|
961
1173
|
* Download one hour of tickers for an instrument as a Lastra segment
|
|
962
1174
|
* Serves exactly one hour of raw ticker data for the given instrument on the
|
|
@@ -989,7 +1201,7 @@ declare const getSegmentInstruments: <ThrowOnError extends boolean = false>(opti
|
|
|
989
1201
|
* descriptive filename).
|
|
990
1202
|
*
|
|
991
1203
|
*/
|
|
992
|
-
declare const
|
|
1204
|
+
declare const downloadTickers: <ThrowOnError extends boolean = false>(options: Options<DownloadTickersData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Blob | File, ResponseError, ThrowOnError>;
|
|
993
1205
|
/**
|
|
994
1206
|
* Download one hour of klines for an instrument as a Lastra segment
|
|
995
1207
|
* Same shape and semantics as `/exchange/{exchangeId}/tickers/{base}/{quote}`,
|
|
@@ -1002,7 +1214,7 @@ declare const getExchangeTickersHour: <ThrowOnError extends boolean = false>(opt
|
|
|
1002
1214
|
* per-tick payload would be too large for the window of interest.
|
|
1003
1215
|
*
|
|
1004
1216
|
*/
|
|
1005
|
-
declare const
|
|
1217
|
+
declare const downloadKlines: <ThrowOnError extends boolean = false>(options: Options<DownloadKlinesData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Blob | File, ResponseError, ThrowOnError>;
|
|
1006
1218
|
/**
|
|
1007
1219
|
* Compile a strategy from source code
|
|
1008
1220
|
* Submits raw strategy source for compilation. By default the call is synchronous and returns
|
|
@@ -1014,21 +1226,21 @@ declare const getExchangeKlinesHour: <ThrowOnError extends boolean = false>(opti
|
|
|
1014
1226
|
* same id.
|
|
1015
1227
|
*
|
|
1016
1228
|
*/
|
|
1017
|
-
declare const
|
|
1229
|
+
declare const compileStrategy: <ThrowOnError extends boolean = false>(options: Options<CompileStrategyData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<CompileStrategyResponse, ResponseError, ThrowOnError>;
|
|
1018
1230
|
/**
|
|
1019
|
-
* Get
|
|
1231
|
+
* Get a strategy by id, including its compile status
|
|
1020
1232
|
* Polls the status of a strategy compilation. Useful when the strategy was submitted with
|
|
1021
1233
|
* `X-Compile-Async: true`. Returns the resolved `strategyId` once compilation completes.
|
|
1022
1234
|
*
|
|
1023
1235
|
*/
|
|
1024
|
-
declare const
|
|
1236
|
+
declare const getStrategy: <ThrowOnError extends boolean = false>(options: Options<GetStrategyData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
|
|
1025
1237
|
jobId?: string;
|
|
1026
1238
|
status: "New" | "Started" | "Completed" | "Aborted" | "Failed";
|
|
1027
1239
|
strategyId?: StrategyId;
|
|
1028
1240
|
statusDetail?: string | null;
|
|
1029
1241
|
}, ResponseError, ThrowOnError>;
|
|
1030
1242
|
/**
|
|
1031
|
-
* Prepare
|
|
1243
|
+
* Prepare backtest data
|
|
1032
1244
|
* Enqueues a prepare task over the requested date range. Returns immediately with a `jobId`;
|
|
1033
1245
|
* poll `GET /backtest/{exchangeId}/{type}/prepare/{jobId}` for completion.
|
|
1034
1246
|
*
|
|
@@ -1036,14 +1248,38 @@ declare const getStrategyStatus: <ThrowOnError extends boolean = false>(options:
|
|
|
1036
1248
|
* params do not enqueue duplicate work — they reuse the existing job.
|
|
1037
1249
|
*
|
|
1038
1250
|
*/
|
|
1039
|
-
declare const
|
|
1251
|
+
declare const prepareBacktest: <ThrowOnError extends boolean = false>(options: Options<PrepareBacktestData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AcceptedJob, ResponseError, ThrowOnError>;
|
|
1040
1252
|
/**
|
|
1041
1253
|
* Get the status of a prepare job
|
|
1042
1254
|
* Retrieves the current state of the prepare job identified by `jobId`.
|
|
1043
1255
|
* Poll until `status` is `Completed`, `Failed`, or `Aborted`.
|
|
1044
1256
|
*
|
|
1045
1257
|
*/
|
|
1046
|
-
declare const
|
|
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>;
|
|
1047
1283
|
/**
|
|
1048
1284
|
* Execute a compiled strategy against a prepared dataset
|
|
1049
1285
|
* Enqueues an execute task that runs the strategy identified by `strategyId` over the data
|
|
@@ -1057,7 +1293,7 @@ declare const getPreparationStatus: <ThrowOnError extends boolean = false>(optio
|
|
|
1057
1293
|
* `jobId` (idempotent).
|
|
1058
1294
|
*
|
|
1059
1295
|
*/
|
|
1060
|
-
declare const
|
|
1296
|
+
declare const executeBacktest: <ThrowOnError extends boolean = false>(options: Options<ExecuteBacktestData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AcceptedJob, ResponseError, ThrowOnError>;
|
|
1061
1297
|
/**
|
|
1062
1298
|
* Cancel a running backtest execution
|
|
1063
1299
|
* Requests cancellation of the specified execution. The execution
|
|
@@ -1066,7 +1302,7 @@ declare const executeBacktesting: <ThrowOnError extends boolean = false>(options
|
|
|
1066
1302
|
* to confirm the final status.
|
|
1067
1303
|
*
|
|
1068
1304
|
*/
|
|
1069
|
-
declare const
|
|
1305
|
+
declare const cancelBacktest: <ThrowOnError extends boolean = false>(options: Options<CancelBacktestData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
|
|
1070
1306
|
status?: "cancelling";
|
|
1071
1307
|
jobId?: string;
|
|
1072
1308
|
}, ResponseError, ThrowOnError>;
|
|
@@ -1076,8 +1312,8 @@ declare const cancelExecution: <ThrowOnError extends boolean = false>(options: O
|
|
|
1076
1312
|
* Poll until `state.status` is `Completed`, `Failed`, or `Aborted`.
|
|
1077
1313
|
*
|
|
1078
1314
|
*/
|
|
1079
|
-
declare const
|
|
1315
|
+
declare const getBacktestResult: <ThrowOnError extends boolean = false>(options: Options<GetBacktestResultData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<BacktestJobResult, ResponseError, ThrowOnError>;
|
|
1080
1316
|
|
|
1081
1317
|
declare const client: _hey_api_client_fetch.Client;
|
|
1082
1318
|
|
|
1083
|
-
export { type AcceptedJob, type
|
|
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 };
|