@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/README.md +24 -24
- package/dist/index.d.ts +407 -116
- package/dist/index.js +69 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/generated/schemas.gen.ts +467 -5
- package/src/generated/sdk.gen.ts +93 -32
- package/src/generated/types.gen.ts +389 -97
|
@@ -163,6 +163,35 @@ export type Exchange = {
|
|
|
163
163
|
*/
|
|
164
164
|
export type DataSourceType = 'ticker';
|
|
165
165
|
|
|
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';
|
|
193
|
+
};
|
|
194
|
+
|
|
166
195
|
/**
|
|
167
196
|
* Information about a single job
|
|
168
197
|
*/
|
|
@@ -172,13 +201,13 @@ export type JobState = {
|
|
|
172
201
|
*/
|
|
173
202
|
contextId: string;
|
|
174
203
|
/**
|
|
175
|
-
* Current status of the job. `
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
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.
|
|
179
208
|
*
|
|
180
209
|
*/
|
|
181
|
-
status: 'New' | 'Started' | '
|
|
210
|
+
status: 'New' | 'Started' | 'Completed' | 'Aborted' | 'Failed';
|
|
182
211
|
/**
|
|
183
212
|
* Detailed status information, if available
|
|
184
213
|
*/
|
|
@@ -201,6 +230,187 @@ export type JobState = {
|
|
|
201
230
|
endTime?: string | null;
|
|
202
231
|
};
|
|
203
232
|
|
|
233
|
+
/**
|
|
234
|
+
* State of a single-instrument prepare job — the `JobState` shape plus a per-hour
|
|
235
|
+
* data-coverage summary. A single-instrument prepare is always terminal
|
|
236
|
+
* (`status: Completed`): the client decides what to do from `coverageRatio` (e.g.
|
|
237
|
+
* execute if it is at or above a chosen threshold) rather than polling for missing
|
|
238
|
+
* hours that may never arrive — a missing hour for one instrument usually means low
|
|
239
|
+
* activity, not missing data.
|
|
240
|
+
*
|
|
241
|
+
*/
|
|
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.
|
|
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.
|
|
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
|
+
}>;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* A numeric range or an explicit list of values for one strategy property.
|
|
291
|
+
*/
|
|
292
|
+
export type SweepAxis = {
|
|
293
|
+
from: number;
|
|
294
|
+
to: number;
|
|
295
|
+
step: number;
|
|
296
|
+
} | {
|
|
297
|
+
values: Array<number | boolean>;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
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
|
+
};
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
export type SweepBaseConfig = {
|
|
320
|
+
initialFunding?: number;
|
|
321
|
+
feeRate?: number;
|
|
322
|
+
buyFeeRate?: number;
|
|
323
|
+
sellFeeRate?: number;
|
|
324
|
+
feeLeg?: 'RECEIVED' | 'QUOTE' | 'BASE';
|
|
325
|
+
percentAmountToLock?: number;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
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;
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
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;
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
export type SweepProgress = {
|
|
362
|
+
done: number;
|
|
363
|
+
total: number;
|
|
364
|
+
aborted: number;
|
|
365
|
+
shardCount: number;
|
|
366
|
+
pendingShards: number;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
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;
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
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>;
|
|
412
|
+
};
|
|
413
|
+
|
|
204
414
|
/**
|
|
205
415
|
* Response returned by async endpoints (`202 Accepted`). The `jobId` is deterministic for the
|
|
206
416
|
* same input parameters — repeated calls with identical params return the same id.
|
|
@@ -363,14 +573,14 @@ export type AuthTokenError = {
|
|
|
363
573
|
message: string;
|
|
364
574
|
};
|
|
365
575
|
|
|
366
|
-
export type
|
|
576
|
+
export type AuthenticateData = {
|
|
367
577
|
body?: never;
|
|
368
578
|
path?: never;
|
|
369
579
|
query?: never;
|
|
370
580
|
url: '/auth/token';
|
|
371
581
|
};
|
|
372
582
|
|
|
373
|
-
export type
|
|
583
|
+
export type AuthenticateErrors = {
|
|
374
584
|
/**
|
|
375
585
|
* API key is invalid, revoked, or expired.
|
|
376
586
|
*/
|
|
@@ -381,34 +591,34 @@ export type AuthErrors = {
|
|
|
381
591
|
429: unknown;
|
|
382
592
|
};
|
|
383
593
|
|
|
384
|
-
export type
|
|
594
|
+
export type AuthenticateError = AuthenticateErrors[keyof AuthenticateErrors];
|
|
385
595
|
|
|
386
|
-
export type
|
|
596
|
+
export type AuthenticateResponses = {
|
|
387
597
|
/**
|
|
388
598
|
* API key accepted; JWT returned.
|
|
389
599
|
*/
|
|
390
600
|
200: AuthTokenResponse;
|
|
391
601
|
};
|
|
392
602
|
|
|
393
|
-
export type
|
|
603
|
+
export type AuthenticateResponse = AuthenticateResponses[keyof AuthenticateResponses];
|
|
394
604
|
|
|
395
|
-
export type
|
|
605
|
+
export type ListExchangesData = {
|
|
396
606
|
body?: never;
|
|
397
607
|
path?: never;
|
|
398
608
|
query?: never;
|
|
399
609
|
url: '/exchanges';
|
|
400
610
|
};
|
|
401
611
|
|
|
402
|
-
export type
|
|
612
|
+
export type ListExchangesResponses = {
|
|
403
613
|
/**
|
|
404
614
|
* A JSON array of Exchanges
|
|
405
615
|
*/
|
|
406
616
|
200: Array<Exchange>;
|
|
407
617
|
};
|
|
408
618
|
|
|
409
|
-
export type
|
|
619
|
+
export type ListExchangesResponse = ListExchangesResponses[keyof ListExchangesResponses];
|
|
410
620
|
|
|
411
|
-
export type
|
|
621
|
+
export type ListInstrumentsData = {
|
|
412
622
|
body?: never;
|
|
413
623
|
path: {
|
|
414
624
|
/**
|
|
@@ -420,25 +630,25 @@ export type GetInstrumentsData = {
|
|
|
420
630
|
url: '/exchange/{exchangeId}/instruments';
|
|
421
631
|
};
|
|
422
632
|
|
|
423
|
-
export type
|
|
633
|
+
export type ListInstrumentsErrors = {
|
|
424
634
|
/**
|
|
425
635
|
* Exchange not found or instrument catalog not available
|
|
426
636
|
*/
|
|
427
637
|
404: ResponseError;
|
|
428
638
|
};
|
|
429
639
|
|
|
430
|
-
export type
|
|
640
|
+
export type ListInstrumentsError = ListInstrumentsErrors[keyof ListInstrumentsErrors];
|
|
431
641
|
|
|
432
|
-
export type
|
|
642
|
+
export type ListInstrumentsResponses = {
|
|
433
643
|
/**
|
|
434
644
|
* The default (spot) segment's instruments in `data`, `meta`, and HAL `_links` (self + spot/futures segment discovery)
|
|
435
645
|
*/
|
|
436
646
|
200: InstrumentListResponse;
|
|
437
647
|
};
|
|
438
648
|
|
|
439
|
-
export type
|
|
649
|
+
export type ListInstrumentsResponse = ListInstrumentsResponses[keyof ListInstrumentsResponses];
|
|
440
650
|
|
|
441
|
-
export type
|
|
651
|
+
export type ListSegmentInstrumentsData = {
|
|
442
652
|
body?: never;
|
|
443
653
|
path: {
|
|
444
654
|
/**
|
|
@@ -454,25 +664,25 @@ export type GetSegmentInstrumentsData = {
|
|
|
454
664
|
url: '/exchange/{exchangeId}/{segment}/instruments';
|
|
455
665
|
};
|
|
456
666
|
|
|
457
|
-
export type
|
|
667
|
+
export type ListSegmentInstrumentsErrors = {
|
|
458
668
|
/**
|
|
459
669
|
* Exchange, segment, or instrument catalog not found
|
|
460
670
|
*/
|
|
461
671
|
404: ResponseError;
|
|
462
672
|
};
|
|
463
673
|
|
|
464
|
-
export type
|
|
674
|
+
export type ListSegmentInstrumentsError = ListSegmentInstrumentsErrors[keyof ListSegmentInstrumentsErrors];
|
|
465
675
|
|
|
466
|
-
export type
|
|
676
|
+
export type ListSegmentInstrumentsResponses = {
|
|
467
677
|
/**
|
|
468
678
|
* An object with a `data` array of instrument details (each with per-data-type coverage) and a `meta` block
|
|
469
679
|
*/
|
|
470
680
|
200: InstrumentListResponse;
|
|
471
681
|
};
|
|
472
682
|
|
|
473
|
-
export type
|
|
683
|
+
export type ListSegmentInstrumentsResponse = ListSegmentInstrumentsResponses[keyof ListSegmentInstrumentsResponses];
|
|
474
684
|
|
|
475
|
-
export type
|
|
685
|
+
export type DownloadTickersData = {
|
|
476
686
|
body?: never;
|
|
477
687
|
path: {
|
|
478
688
|
/**
|
|
@@ -506,7 +716,7 @@ export type GetExchangeTickersHourData = {
|
|
|
506
716
|
url: '/exchange/{exchangeId}/tickers/{base}/{quote}';
|
|
507
717
|
};
|
|
508
718
|
|
|
509
|
-
export type
|
|
719
|
+
export type DownloadTickersErrors = {
|
|
510
720
|
/**
|
|
511
721
|
* Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
|
|
512
722
|
*/
|
|
@@ -521,9 +731,9 @@ export type GetExchangeTickersHourErrors = {
|
|
|
521
731
|
500: ResponseError;
|
|
522
732
|
};
|
|
523
733
|
|
|
524
|
-
export type
|
|
734
|
+
export type DownloadTickersError = DownloadTickersErrors[keyof DownloadTickersErrors];
|
|
525
735
|
|
|
526
|
-
export type
|
|
736
|
+
export type DownloadTickersResponses = {
|
|
527
737
|
/**
|
|
528
738
|
* One hour of tickers for the instrument. `Content-Type` is
|
|
529
739
|
* `application/vnd.lastra` by default or
|
|
@@ -534,9 +744,9 @@ export type GetExchangeTickersHourResponses = {
|
|
|
534
744
|
200: Blob | File;
|
|
535
745
|
};
|
|
536
746
|
|
|
537
|
-
export type
|
|
747
|
+
export type DownloadTickersResponse = DownloadTickersResponses[keyof DownloadTickersResponses];
|
|
538
748
|
|
|
539
|
-
export type
|
|
749
|
+
export type DownloadKlinesData = {
|
|
540
750
|
body?: never;
|
|
541
751
|
path: {
|
|
542
752
|
/**
|
|
@@ -569,7 +779,7 @@ export type GetExchangeKlinesHourData = {
|
|
|
569
779
|
url: '/exchange/{exchangeId}/klines/{base}/{quote}';
|
|
570
780
|
};
|
|
571
781
|
|
|
572
|
-
export type
|
|
782
|
+
export type DownloadKlinesErrors = {
|
|
573
783
|
/**
|
|
574
784
|
* Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
|
|
575
785
|
*/
|
|
@@ -584,9 +794,9 @@ export type GetExchangeKlinesHourErrors = {
|
|
|
584
794
|
500: ResponseError;
|
|
585
795
|
};
|
|
586
796
|
|
|
587
|
-
export type
|
|
797
|
+
export type DownloadKlinesError = DownloadKlinesErrors[keyof DownloadKlinesErrors];
|
|
588
798
|
|
|
589
|
-
export type
|
|
799
|
+
export type DownloadKlinesResponses = {
|
|
590
800
|
/**
|
|
591
801
|
* One hour of klines for the instrument. `Content-Type` is
|
|
592
802
|
* `application/vnd.lastra` by default or
|
|
@@ -596,9 +806,9 @@ export type GetExchangeKlinesHourResponses = {
|
|
|
596
806
|
200: Blob | File;
|
|
597
807
|
};
|
|
598
808
|
|
|
599
|
-
export type
|
|
809
|
+
export type DownloadKlinesResponse = DownloadKlinesResponses[keyof DownloadKlinesResponses];
|
|
600
810
|
|
|
601
|
-
export type
|
|
811
|
+
export type CompileStrategyData = {
|
|
602
812
|
/**
|
|
603
813
|
* Raw strategy Java source code
|
|
604
814
|
*/
|
|
@@ -614,16 +824,16 @@ export type PostStrategyData = {
|
|
|
614
824
|
url: '/strategy';
|
|
615
825
|
};
|
|
616
826
|
|
|
617
|
-
export type
|
|
827
|
+
export type CompileStrategyErrors = {
|
|
618
828
|
/**
|
|
619
829
|
* Invalid strategy (compilation error)
|
|
620
830
|
*/
|
|
621
831
|
400: ResponseError;
|
|
622
832
|
};
|
|
623
833
|
|
|
624
|
-
export type
|
|
834
|
+
export type CompileStrategyError = CompileStrategyErrors[keyof CompileStrategyErrors];
|
|
625
835
|
|
|
626
|
-
export type
|
|
836
|
+
export type CompileStrategyResponses = {
|
|
627
837
|
/**
|
|
628
838
|
* Strategy compiled successfully (sync mode)
|
|
629
839
|
*/
|
|
@@ -636,9 +846,9 @@ export type PostStrategyResponses = {
|
|
|
636
846
|
202: AcceptedJob;
|
|
637
847
|
};
|
|
638
848
|
|
|
639
|
-
export type
|
|
849
|
+
export type CompileStrategyResponse = CompileStrategyResponses[keyof CompileStrategyResponses];
|
|
640
850
|
|
|
641
|
-
export type
|
|
851
|
+
export type GetStrategyData = {
|
|
642
852
|
body?: never;
|
|
643
853
|
path: {
|
|
644
854
|
/**
|
|
@@ -650,16 +860,16 @@ export type GetStrategyStatusData = {
|
|
|
650
860
|
url: '/strategy/{strategyId}';
|
|
651
861
|
};
|
|
652
862
|
|
|
653
|
-
export type
|
|
863
|
+
export type GetStrategyErrors = {
|
|
654
864
|
/**
|
|
655
865
|
* Strategy compile job not found
|
|
656
866
|
*/
|
|
657
867
|
404: ResponseError;
|
|
658
868
|
};
|
|
659
869
|
|
|
660
|
-
export type
|
|
870
|
+
export type GetStrategyError = GetStrategyErrors[keyof GetStrategyErrors];
|
|
661
871
|
|
|
662
|
-
export type
|
|
872
|
+
export type GetStrategyResponses = {
|
|
663
873
|
/**
|
|
664
874
|
* Strategy compile state
|
|
665
875
|
*/
|
|
@@ -677,40 +887,13 @@ export type GetStrategyStatusResponses = {
|
|
|
677
887
|
};
|
|
678
888
|
};
|
|
679
889
|
|
|
680
|
-
export type
|
|
890
|
+
export type GetStrategyResponse = GetStrategyResponses[keyof GetStrategyResponses];
|
|
681
891
|
|
|
682
|
-
export type
|
|
892
|
+
export type PrepareBacktestData = {
|
|
683
893
|
/**
|
|
684
894
|
* The required data to prepare a backtesting
|
|
685
895
|
*/
|
|
686
|
-
body:
|
|
687
|
-
instrument: Instrument;
|
|
688
|
-
/**
|
|
689
|
-
* Start date for the preparation process. Supports the following formats:
|
|
690
|
-
* - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
|
|
691
|
-
* - ISO DATE (e.g. 2024-12-14)
|
|
692
|
-
* - BASIC ISO DATE (e.g., 20241214)
|
|
693
|
-
*
|
|
694
|
-
*/
|
|
695
|
-
from: string;
|
|
696
|
-
/**
|
|
697
|
-
* End date for the preparation process. Supports the following formats:
|
|
698
|
-
* - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
|
|
699
|
-
* - ISO DATE (e.g. 2024-12-14)
|
|
700
|
-
* - BASIC ISO DATE (e.g., 20241214)
|
|
701
|
-
*
|
|
702
|
-
*/
|
|
703
|
-
to: string;
|
|
704
|
-
/**
|
|
705
|
-
* Output bar cadence for the prepared range. Defaults to the publisher's
|
|
706
|
-
* native cadence (`1s`); coarser cadences are produced on demand via
|
|
707
|
-
* resampling and stored alongside the native blob in cache. Coarser-than-
|
|
708
|
-
* source values must be exact multiples of the source cadence — invalid
|
|
709
|
-
* labels return `400`.
|
|
710
|
-
*
|
|
711
|
-
*/
|
|
712
|
-
cadence?: '1s' | '5s' | '1m' | '5m' | '15m' | '1h' | '4h' | '1d';
|
|
713
|
-
};
|
|
896
|
+
body: PrepareRequest;
|
|
714
897
|
path: {
|
|
715
898
|
/**
|
|
716
899
|
* ID of the exchange to prepare the backtesting for
|
|
@@ -725,7 +908,7 @@ export type PrepareBacktestingData = {
|
|
|
725
908
|
url: '/backtest/{exchangeId}/{type}/prepare';
|
|
726
909
|
};
|
|
727
910
|
|
|
728
|
-
export type
|
|
911
|
+
export type PrepareBacktestErrors = {
|
|
729
912
|
/**
|
|
730
913
|
* Invalid request or parameters. Also returned when `from` is older than the configured
|
|
731
914
|
* lookback window or `to` is in the future.
|
|
@@ -744,18 +927,18 @@ export type PrepareBacktestingErrors = {
|
|
|
744
927
|
429: ResponseError;
|
|
745
928
|
};
|
|
746
929
|
|
|
747
|
-
export type
|
|
930
|
+
export type PrepareBacktestError = PrepareBacktestErrors[keyof PrepareBacktestErrors];
|
|
748
931
|
|
|
749
|
-
export type
|
|
932
|
+
export type PrepareBacktestResponses = {
|
|
750
933
|
/**
|
|
751
934
|
* Prepare task accepted (queued for processing)
|
|
752
935
|
*/
|
|
753
936
|
202: AcceptedJob;
|
|
754
937
|
};
|
|
755
938
|
|
|
756
|
-
export type
|
|
939
|
+
export type PrepareBacktestResponse = PrepareBacktestResponses[keyof PrepareBacktestResponses];
|
|
757
940
|
|
|
758
|
-
export type
|
|
941
|
+
export type GetPrepareStatusData = {
|
|
759
942
|
body?: never;
|
|
760
943
|
path: {
|
|
761
944
|
/**
|
|
@@ -775,7 +958,7 @@ export type GetPreparationStatusData = {
|
|
|
775
958
|
url: '/backtest/{exchangeId}/{type}/prepare/{jobId}';
|
|
776
959
|
};
|
|
777
960
|
|
|
778
|
-
export type
|
|
961
|
+
export type GetPrepareStatusErrors = {
|
|
779
962
|
/**
|
|
780
963
|
* Invalid request or parameters
|
|
781
964
|
*/
|
|
@@ -786,18 +969,127 @@ export type GetPreparationStatusErrors = {
|
|
|
786
969
|
404: ResponseError;
|
|
787
970
|
};
|
|
788
971
|
|
|
789
|
-
export type
|
|
972
|
+
export type GetPrepareStatusError = GetPrepareStatusErrors[keyof GetPrepareStatusErrors];
|
|
790
973
|
|
|
791
|
-
export type
|
|
974
|
+
export type GetPrepareStatusResponses = {
|
|
792
975
|
/**
|
|
793
976
|
* Current prepare job state
|
|
794
977
|
*/
|
|
795
|
-
200:
|
|
978
|
+
200: PrepareJobState;
|
|
979
|
+
};
|
|
980
|
+
|
|
981
|
+
export type GetPrepareStatusResponse = GetPrepareStatusResponses[keyof GetPrepareStatusResponses];
|
|
982
|
+
|
|
983
|
+
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}';
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
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;
|
|
1010
|
+
};
|
|
1011
|
+
|
|
1012
|
+
export type ExecuteSweepError = ExecuteSweepErrors[keyof ExecuteSweepErrors];
|
|
1013
|
+
|
|
1014
|
+
export type ExecuteSweepResponses = {
|
|
1015
|
+
/**
|
|
1016
|
+
* Sweep accepted. The effective seed is returned for reproducibility.
|
|
1017
|
+
*/
|
|
1018
|
+
202: ExecuteSweepAccepted;
|
|
1019
|
+
};
|
|
1020
|
+
|
|
1021
|
+
export type ExecuteSweepResponse = ExecuteSweepResponses[keyof ExecuteSweepResponses];
|
|
1022
|
+
|
|
1023
|
+
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}';
|
|
1033
|
+
};
|
|
1034
|
+
|
|
1035
|
+
export type CancelSweepErrors = {
|
|
1036
|
+
/**
|
|
1037
|
+
* Sweep not found.
|
|
1038
|
+
*/
|
|
1039
|
+
404: ResponseError;
|
|
1040
|
+
};
|
|
1041
|
+
|
|
1042
|
+
export type CancelSweepError = CancelSweepErrors[keyof CancelSweepErrors];
|
|
1043
|
+
|
|
1044
|
+
export type CancelSweepResponses = {
|
|
1045
|
+
/**
|
|
1046
|
+
* Cancellation requested.
|
|
1047
|
+
*/
|
|
1048
|
+
200: {
|
|
1049
|
+
status: 'cancelling';
|
|
1050
|
+
sweepId: string;
|
|
1051
|
+
};
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
export type CancelSweepResponse = CancelSweepResponses[keyof CancelSweepResponses];
|
|
1055
|
+
|
|
1056
|
+
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}';
|
|
1072
|
+
};
|
|
1073
|
+
|
|
1074
|
+
export type GetSweepResultErrors = {
|
|
1075
|
+
/**
|
|
1076
|
+
* Sweep not found or expired.
|
|
1077
|
+
*/
|
|
1078
|
+
404: ResponseError;
|
|
1079
|
+
};
|
|
1080
|
+
|
|
1081
|
+
export type GetSweepResultError = GetSweepResultErrors[keyof GetSweepResultErrors];
|
|
1082
|
+
|
|
1083
|
+
export type GetSweepResultResponses = {
|
|
1084
|
+
/**
|
|
1085
|
+
* Current sweep snapshot and all currently available result rows for the selected view.
|
|
1086
|
+
*/
|
|
1087
|
+
200: ExecuteSweepResult;
|
|
796
1088
|
};
|
|
797
1089
|
|
|
798
|
-
export type
|
|
1090
|
+
export type GetSweepResultResponse = GetSweepResultResponses[keyof GetSweepResultResponses];
|
|
799
1091
|
|
|
800
|
-
export type
|
|
1092
|
+
export type ExecuteBacktestData = {
|
|
801
1093
|
/**
|
|
802
1094
|
* Execute task parameters
|
|
803
1095
|
*/
|
|
@@ -828,7 +1120,7 @@ export type ExecuteBacktestingData = {
|
|
|
828
1120
|
url: '/backtest/{exchangeId}/{type}/execute';
|
|
829
1121
|
};
|
|
830
1122
|
|
|
831
|
-
export type
|
|
1123
|
+
export type ExecuteBacktestErrors = {
|
|
832
1124
|
/**
|
|
833
1125
|
* Invalid request or parameters
|
|
834
1126
|
*/
|
|
@@ -843,18 +1135,18 @@ export type ExecuteBacktestingErrors = {
|
|
|
843
1135
|
429: ResponseError;
|
|
844
1136
|
};
|
|
845
1137
|
|
|
846
|
-
export type
|
|
1138
|
+
export type ExecuteBacktestError = ExecuteBacktestErrors[keyof ExecuteBacktestErrors];
|
|
847
1139
|
|
|
848
|
-
export type
|
|
1140
|
+
export type ExecuteBacktestResponses = {
|
|
849
1141
|
/**
|
|
850
1142
|
* Execute task accepted (queued for processing)
|
|
851
1143
|
*/
|
|
852
1144
|
202: AcceptedJob;
|
|
853
1145
|
};
|
|
854
1146
|
|
|
855
|
-
export type
|
|
1147
|
+
export type ExecuteBacktestResponse = ExecuteBacktestResponses[keyof ExecuteBacktestResponses];
|
|
856
1148
|
|
|
857
|
-
export type
|
|
1149
|
+
export type CancelBacktestData = {
|
|
858
1150
|
body?: never;
|
|
859
1151
|
path: {
|
|
860
1152
|
exchangeId: string;
|
|
@@ -868,16 +1160,16 @@ export type CancelExecutionData = {
|
|
|
868
1160
|
url: '/backtest/{exchangeId}/{type}/execute/{jobId}';
|
|
869
1161
|
};
|
|
870
1162
|
|
|
871
|
-
export type
|
|
1163
|
+
export type CancelBacktestErrors = {
|
|
872
1164
|
/**
|
|
873
1165
|
* Execution not found
|
|
874
1166
|
*/
|
|
875
1167
|
404: ResponseError;
|
|
876
1168
|
};
|
|
877
1169
|
|
|
878
|
-
export type
|
|
1170
|
+
export type CancelBacktestError = CancelBacktestErrors[keyof CancelBacktestErrors];
|
|
879
1171
|
|
|
880
|
-
export type
|
|
1172
|
+
export type CancelBacktestResponses = {
|
|
881
1173
|
/**
|
|
882
1174
|
* Cancellation request accepted
|
|
883
1175
|
*/
|
|
@@ -887,9 +1179,9 @@ export type CancelExecutionResponses = {
|
|
|
887
1179
|
};
|
|
888
1180
|
};
|
|
889
1181
|
|
|
890
|
-
export type
|
|
1182
|
+
export type CancelBacktestResponse = CancelBacktestResponses[keyof CancelBacktestResponses];
|
|
891
1183
|
|
|
892
|
-
export type
|
|
1184
|
+
export type GetBacktestResultData = {
|
|
893
1185
|
body?: never;
|
|
894
1186
|
path: {
|
|
895
1187
|
/**
|
|
@@ -909,7 +1201,7 @@ export type GetExecutionResultData = {
|
|
|
909
1201
|
url: '/backtest/{exchangeId}/{type}/execute/{jobId}';
|
|
910
1202
|
};
|
|
911
1203
|
|
|
912
|
-
export type
|
|
1204
|
+
export type GetBacktestResultErrors = {
|
|
913
1205
|
/**
|
|
914
1206
|
* Invalid request or parameters
|
|
915
1207
|
*/
|
|
@@ -920,16 +1212,16 @@ export type GetExecutionResultErrors = {
|
|
|
920
1212
|
404: ResponseError;
|
|
921
1213
|
};
|
|
922
1214
|
|
|
923
|
-
export type
|
|
1215
|
+
export type GetBacktestResultError = GetBacktestResultErrors[keyof GetBacktestResultErrors];
|
|
924
1216
|
|
|
925
|
-
export type
|
|
1217
|
+
export type GetBacktestResultResponses = {
|
|
926
1218
|
/**
|
|
927
1219
|
* Backtesting execution result
|
|
928
1220
|
*/
|
|
929
1221
|
200: BacktestJobResult;
|
|
930
1222
|
};
|
|
931
1223
|
|
|
932
|
-
export type
|
|
1224
|
+
export type GetBacktestResultResponse = GetBacktestResultResponses[keyof GetBacktestResultResponses];
|
|
933
1225
|
|
|
934
1226
|
export type ClientOptions = {
|
|
935
1227
|
baseUrl: 'https://api.staging.qtsurfer.com/v1' | 'https://api.qtsurfer.com/v1' | (string & {});
|