@qtsurfer/api-client 0.1.0 → 0.1.1
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 +6 -0
- package/dist/index.d.ts +636 -3
- package/dist/index.js +128 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/dist/generated/client.gen.d.ts +0 -13
- package/dist/generated/client.gen.d.ts.map +0 -1
- package/dist/generated/client.gen.js +0 -6
- package/dist/generated/client.gen.js.map +0 -1
- package/dist/generated/index.d.ts +0 -3
- package/dist/generated/index.d.ts.map +0 -1
- package/dist/generated/index.js +0 -4
- package/dist/generated/index.js.map +0 -1
- package/dist/generated/schemas.gen.d.ts +0 -284
- package/dist/generated/schemas.gen.d.ts.map +0 -1
- package/dist/generated/schemas.gen.js +0 -287
- package/dist/generated/schemas.gen.js.map +0 -1
- package/dist/generated/sdk.gen.d.ts +0 -98
- package/dist/generated/sdk.gen.d.ts.map +0 -1
- package/dist/generated/sdk.gen.js +0 -177
- package/dist/generated/sdk.gen.js.map +0 -1
- package/dist/generated/types.gen.d.ts +0 -534
- package/dist/generated/types.gen.d.ts.map +0 -1
- package/dist/generated/types.gen.js +0 -3
- package/dist/generated/types.gen.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @qtsurfer/api-client
|
|
2
2
|
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://github.com/QTSurfer/api-client-ts/actions/workflows/ci.yml"><img src="https://github.com/QTSurfer/api-client-ts/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
5
|
+
<a href="https://www.npmjs.com/package/@qtsurfer/api-client"><img src="https://img.shields.io/npm/v/@qtsurfer/api-client" alt="npm"></a>
|
|
6
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License"></a>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
3
9
|
Auto-generated TypeScript API client for the [QTSurfer API](https://github.com/QTSurfer/qtsurfer-api), produced from the OpenAPI 3.1 spec with [`@hey-api/openapi-ts`](https://heyapi.dev/).
|
|
4
10
|
|
|
5
11
|
This package is intentionally thin: one function per operation, 1:1 with the spec. For workflow orchestration (polling, retries, domain objects, unified errors), use [`@qtsurfer/sdk`](https://github.com/QTSurfer/sdk-ts).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,636 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as _hey_api_client_fetch from '@hey-api/client-fetch';
|
|
2
|
+
import { TDataShape, Options as Options$1, Client } from '@hey-api/client-fetch';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* General response error
|
|
6
|
+
*/
|
|
7
|
+
type ResponseError = {
|
|
8
|
+
/**
|
|
9
|
+
* Status code
|
|
10
|
+
*/
|
|
11
|
+
code: number;
|
|
12
|
+
/**
|
|
13
|
+
* Error description
|
|
14
|
+
*/
|
|
15
|
+
message: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Exchange instrument identifier (e.g. a currency pair)
|
|
19
|
+
*/
|
|
20
|
+
type Instrument = string;
|
|
21
|
+
/**
|
|
22
|
+
* Exchange instrument with data availability and market info
|
|
23
|
+
*/
|
|
24
|
+
type InstrumentDetail = {
|
|
25
|
+
/**
|
|
26
|
+
* Instrument identifier (e.g. currency pair)
|
|
27
|
+
*/
|
|
28
|
+
id: string;
|
|
29
|
+
/**
|
|
30
|
+
* Base currency
|
|
31
|
+
*/
|
|
32
|
+
base: string;
|
|
33
|
+
/**
|
|
34
|
+
* Quote currency
|
|
35
|
+
*/
|
|
36
|
+
quote: string;
|
|
37
|
+
/**
|
|
38
|
+
* Earliest timestamp with quality-verified data available for backtesting
|
|
39
|
+
*/
|
|
40
|
+
dataFrom?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Latest timestamp with quality-verified data available for backtesting
|
|
43
|
+
*/
|
|
44
|
+
dataTo?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Last traded price
|
|
47
|
+
*/
|
|
48
|
+
lastPrice?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Trading volume in the last 24 hours (in quote currency)
|
|
51
|
+
*/
|
|
52
|
+
volume24h?: number;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Exchange service provider
|
|
56
|
+
*/
|
|
57
|
+
type Exchange = {
|
|
58
|
+
/**
|
|
59
|
+
* Unique identifier for the exchange
|
|
60
|
+
*/
|
|
61
|
+
id: string;
|
|
62
|
+
/**
|
|
63
|
+
* Name of the exchange
|
|
64
|
+
*/
|
|
65
|
+
name: string;
|
|
66
|
+
/**
|
|
67
|
+
* Description of the exchange
|
|
68
|
+
*/
|
|
69
|
+
description?: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Managed exchange data sources available for backtesting. Currently only ticker is supported; kline and funding rate support is planned.
|
|
73
|
+
*/
|
|
74
|
+
type DataSourceType = 'ticker';
|
|
75
|
+
/**
|
|
76
|
+
* Information about a single job
|
|
77
|
+
*/
|
|
78
|
+
type JobState = {
|
|
79
|
+
/**
|
|
80
|
+
* Unique context ID for the job
|
|
81
|
+
*/
|
|
82
|
+
contextId: string;
|
|
83
|
+
/**
|
|
84
|
+
* Current status of the job
|
|
85
|
+
*/
|
|
86
|
+
status: 'New' | 'Started' | 'Completed' | 'Aborted' | 'Failed';
|
|
87
|
+
/**
|
|
88
|
+
* Detailed status information, if available
|
|
89
|
+
*/
|
|
90
|
+
statusDetail?: string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Total size of the data being prepared
|
|
93
|
+
*/
|
|
94
|
+
size: number;
|
|
95
|
+
/**
|
|
96
|
+
* The amount of data processed so far
|
|
97
|
+
*/
|
|
98
|
+
completed: number;
|
|
99
|
+
/**
|
|
100
|
+
* Timestamp for when the preparation started
|
|
101
|
+
*/
|
|
102
|
+
startTime?: string | null;
|
|
103
|
+
/**
|
|
104
|
+
* Timestamp for when the preparation finished
|
|
105
|
+
*/
|
|
106
|
+
endTime?: string | null;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Response returned by async endpoints (`202 Accepted`). The `jobId` is deterministic for the
|
|
110
|
+
* same input parameters — repeated calls with identical params return the same id.
|
|
111
|
+
*
|
|
112
|
+
*/
|
|
113
|
+
type AcceptedJob = {
|
|
114
|
+
/**
|
|
115
|
+
* Unique job identifier; use this to poll for completion.
|
|
116
|
+
*/
|
|
117
|
+
jobId: string;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Backtest job result.
|
|
121
|
+
*/
|
|
122
|
+
type BacktestJobResult = {
|
|
123
|
+
results: ResultMap;
|
|
124
|
+
state: JobState;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Execution result map. Always includes core fields (hostName, iops, strategyId, instrument). Yield metrics (pnlTotal, totalTrades, winRate, etc.) are present when the strategy emitted at least one trade. When signal storage is enabled, includes signal fields described below.
|
|
128
|
+
*/
|
|
129
|
+
type ResultMap = {
|
|
130
|
+
/**
|
|
131
|
+
* Hostname of the worker node that executed the strategy
|
|
132
|
+
*/
|
|
133
|
+
hostName?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Instrument operations per second throughput during execution
|
|
136
|
+
*/
|
|
137
|
+
iops?: number;
|
|
138
|
+
/**
|
|
139
|
+
* Redis key of the compiled strategy used for execution. Format: strategy:{userId}:ticker:{compilationId}
|
|
140
|
+
*/
|
|
141
|
+
strategyId: string;
|
|
142
|
+
/**
|
|
143
|
+
* The instrument (currency pair) that was backtested
|
|
144
|
+
*/
|
|
145
|
+
instrument: string;
|
|
146
|
+
/**
|
|
147
|
+
* Total profit and loss in the output currency
|
|
148
|
+
*/
|
|
149
|
+
pnlTotal?: number;
|
|
150
|
+
/**
|
|
151
|
+
* Total number of trades executed by the strategy
|
|
152
|
+
*/
|
|
153
|
+
totalTrades?: number;
|
|
154
|
+
/**
|
|
155
|
+
* Percentage of profitable trades (0-100)
|
|
156
|
+
*/
|
|
157
|
+
winRate?: number;
|
|
158
|
+
/**
|
|
159
|
+
* Risk-adjusted return ratio (mean return / standard deviation of returns)
|
|
160
|
+
*/
|
|
161
|
+
sharpeRatio?: number;
|
|
162
|
+
/**
|
|
163
|
+
* Downside risk-adjusted return ratio (mean return / downside deviation)
|
|
164
|
+
*/
|
|
165
|
+
sortinoRatio?: number;
|
|
166
|
+
/**
|
|
167
|
+
* Compound Annual Growth Rate
|
|
168
|
+
*/
|
|
169
|
+
cagr?: number;
|
|
170
|
+
/**
|
|
171
|
+
* Maximum absolute drawdown in the output currency
|
|
172
|
+
*/
|
|
173
|
+
maxDrawdown?: number;
|
|
174
|
+
/**
|
|
175
|
+
* Maximum percentage drawdown from peak equity
|
|
176
|
+
*/
|
|
177
|
+
maxDrawdownPercent?: number;
|
|
178
|
+
/**
|
|
179
|
+
* Number of signals emitted during strategy execution
|
|
180
|
+
*/
|
|
181
|
+
signalCount?: number;
|
|
182
|
+
/**
|
|
183
|
+
* Storage key for the signal Parquet file. Format: {userId}/exec/{exchange}/{jobId}
|
|
184
|
+
*/
|
|
185
|
+
signalsId?: string;
|
|
186
|
+
/**
|
|
187
|
+
* Public HTTPS URL to the Parquet file. Computed at setup time from publicBaseUrl + signalsId + .parquet. Available even before upload completes.
|
|
188
|
+
*/
|
|
189
|
+
signalsUrl?: string;
|
|
190
|
+
/**
|
|
191
|
+
* Upload status. Done = file uploaded to R2. Failed = upload error (see signalsUploadReason). Skipped = no signals emitted or storage not configured.
|
|
192
|
+
*/
|
|
193
|
+
signalsUpload?: 'Done' | 'Failed' | 'Skipped';
|
|
194
|
+
/**
|
|
195
|
+
* ISO 8601 timestamp of when the upload completed. Only present when signalsUpload is Done.
|
|
196
|
+
*/
|
|
197
|
+
signalsUploadedAt?: string;
|
|
198
|
+
/**
|
|
199
|
+
* Human-readable reason when signalsUpload is Failed or Skipped.
|
|
200
|
+
*/
|
|
201
|
+
signalsUploadReason?: string;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Unique identifier for a compiled strategy
|
|
205
|
+
*/
|
|
206
|
+
type StrategyId = string;
|
|
207
|
+
type GetExchangesData = {
|
|
208
|
+
body?: never;
|
|
209
|
+
path?: never;
|
|
210
|
+
query?: never;
|
|
211
|
+
url: '/exchanges';
|
|
212
|
+
};
|
|
213
|
+
type GetExchangesResponses = {
|
|
214
|
+
/**
|
|
215
|
+
* A JSON array of Exchanges
|
|
216
|
+
*/
|
|
217
|
+
200: Array<Exchange>;
|
|
218
|
+
};
|
|
219
|
+
type GetExchangesResponse = GetExchangesResponses[keyof GetExchangesResponses];
|
|
220
|
+
type GetInstrumentsData = {
|
|
221
|
+
body?: never;
|
|
222
|
+
path: {
|
|
223
|
+
/**
|
|
224
|
+
* ID of the exchange to retrieve instruments for
|
|
225
|
+
*/
|
|
226
|
+
exchangeId: string;
|
|
227
|
+
};
|
|
228
|
+
query?: never;
|
|
229
|
+
url: '/exchange/{exchangeId}/instruments';
|
|
230
|
+
};
|
|
231
|
+
type GetInstrumentsErrors = {
|
|
232
|
+
/**
|
|
233
|
+
* Exchange not found or instrument catalog not available
|
|
234
|
+
*/
|
|
235
|
+
404: ResponseError;
|
|
236
|
+
};
|
|
237
|
+
type GetInstrumentsError = GetInstrumentsErrors[keyof GetInstrumentsErrors];
|
|
238
|
+
type GetInstrumentsResponses = {
|
|
239
|
+
/**
|
|
240
|
+
* A JSON array of Instrument details with data availability
|
|
241
|
+
*/
|
|
242
|
+
200: Array<InstrumentDetail>;
|
|
243
|
+
};
|
|
244
|
+
type GetInstrumentsResponse = GetInstrumentsResponses[keyof GetInstrumentsResponses];
|
|
245
|
+
type PostStrategyData = {
|
|
246
|
+
/**
|
|
247
|
+
* Raw strategy Java source code
|
|
248
|
+
*/
|
|
249
|
+
body: string;
|
|
250
|
+
headers?: {
|
|
251
|
+
/**
|
|
252
|
+
* When `true`, compile asynchronously and return `202` with a `jobId`.
|
|
253
|
+
*/
|
|
254
|
+
'X-Compile-Async'?: boolean;
|
|
255
|
+
};
|
|
256
|
+
path?: never;
|
|
257
|
+
query?: never;
|
|
258
|
+
url: '/strategy';
|
|
259
|
+
};
|
|
260
|
+
type PostStrategyErrors = {
|
|
261
|
+
/**
|
|
262
|
+
* Invalid strategy (compilation error)
|
|
263
|
+
*/
|
|
264
|
+
400: ResponseError;
|
|
265
|
+
};
|
|
266
|
+
type PostStrategyError = PostStrategyErrors[keyof PostStrategyErrors];
|
|
267
|
+
type PostStrategyResponses = {
|
|
268
|
+
/**
|
|
269
|
+
* Strategy compiled successfully (sync mode)
|
|
270
|
+
*/
|
|
271
|
+
200: {
|
|
272
|
+
strategyId: StrategyId;
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* Compile task accepted (async mode — set `X-Compile-Async: true`)
|
|
276
|
+
*/
|
|
277
|
+
202: AcceptedJob;
|
|
278
|
+
};
|
|
279
|
+
type PostStrategyResponse = PostStrategyResponses[keyof PostStrategyResponses];
|
|
280
|
+
type GetStrategyStatusData = {
|
|
281
|
+
body?: never;
|
|
282
|
+
path: {
|
|
283
|
+
/**
|
|
284
|
+
* The id returned by `POST /strategy` (sync) or the `jobId` returned in async mode
|
|
285
|
+
*/
|
|
286
|
+
strategyId: string;
|
|
287
|
+
};
|
|
288
|
+
query?: never;
|
|
289
|
+
url: '/strategy/{strategyId}';
|
|
290
|
+
};
|
|
291
|
+
type GetStrategyStatusErrors = {
|
|
292
|
+
/**
|
|
293
|
+
* Strategy compile job not found
|
|
294
|
+
*/
|
|
295
|
+
404: ResponseError;
|
|
296
|
+
};
|
|
297
|
+
type GetStrategyStatusError = GetStrategyStatusErrors[keyof GetStrategyStatusErrors];
|
|
298
|
+
type GetStrategyStatusResponses = {
|
|
299
|
+
/**
|
|
300
|
+
* Strategy compile state
|
|
301
|
+
*/
|
|
302
|
+
200: {
|
|
303
|
+
/**
|
|
304
|
+
* Compile job id (only set in async mode)
|
|
305
|
+
*/
|
|
306
|
+
jobId?: string;
|
|
307
|
+
status: 'New' | 'Started' | 'Completed' | 'Aborted' | 'Failed';
|
|
308
|
+
strategyId?: StrategyId;
|
|
309
|
+
/**
|
|
310
|
+
* Compilation error messages when `status` is `Failed`
|
|
311
|
+
*/
|
|
312
|
+
statusDetail?: string | null;
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
type GetStrategyStatusResponse = GetStrategyStatusResponses[keyof GetStrategyStatusResponses];
|
|
316
|
+
type PrepareBacktestingData = {
|
|
317
|
+
/**
|
|
318
|
+
* The required data to prepare a backtesting
|
|
319
|
+
*/
|
|
320
|
+
body: {
|
|
321
|
+
instrument: Instrument;
|
|
322
|
+
/**
|
|
323
|
+
* Start date for the preparation process. Supports the following formats:
|
|
324
|
+
* - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
|
|
325
|
+
* - ISO DATE (e.g. 2024-12-14)
|
|
326
|
+
* - BASIC ISO DATE (e.g., 20241214)
|
|
327
|
+
*
|
|
328
|
+
*/
|
|
329
|
+
from: string;
|
|
330
|
+
/**
|
|
331
|
+
* End date for the preparation process. Supports the following formats:
|
|
332
|
+
* - ISO-8601 (e.g. 2024-12-14T23:59:59Z)
|
|
333
|
+
* - ISO DATE (e.g. 2024-12-14)
|
|
334
|
+
* - BASIC ISO DATE (e.g., 20241214)
|
|
335
|
+
*
|
|
336
|
+
*/
|
|
337
|
+
to: string;
|
|
338
|
+
};
|
|
339
|
+
path: {
|
|
340
|
+
/**
|
|
341
|
+
* ID of the exchange to prepare the backtesting for
|
|
342
|
+
*/
|
|
343
|
+
exchangeId: string;
|
|
344
|
+
/**
|
|
345
|
+
* The type of data source to prepare from
|
|
346
|
+
*/
|
|
347
|
+
type: DataSourceType;
|
|
348
|
+
};
|
|
349
|
+
query?: never;
|
|
350
|
+
url: '/backtest/{exchangeId}/{type}/prepare';
|
|
351
|
+
};
|
|
352
|
+
type PrepareBacktestingErrors = {
|
|
353
|
+
/**
|
|
354
|
+
* Invalid request or parameters. Also returned when `from` is older than the configured
|
|
355
|
+
* lookback window or `to` is in the future.
|
|
356
|
+
*
|
|
357
|
+
*/
|
|
358
|
+
400: ResponseError;
|
|
359
|
+
/**
|
|
360
|
+
* Exchange or data source type not found
|
|
361
|
+
*/
|
|
362
|
+
404: ResponseError;
|
|
363
|
+
/**
|
|
364
|
+
* Rate limited. Returned when the global queue exceeds capacity or the user has too many
|
|
365
|
+
* active backtests.
|
|
366
|
+
*
|
|
367
|
+
*/
|
|
368
|
+
429: ResponseError;
|
|
369
|
+
};
|
|
370
|
+
type PrepareBacktestingError = PrepareBacktestingErrors[keyof PrepareBacktestingErrors];
|
|
371
|
+
type PrepareBacktestingResponses = {
|
|
372
|
+
/**
|
|
373
|
+
* Prepare task accepted (queued for processing)
|
|
374
|
+
*/
|
|
375
|
+
202: AcceptedJob;
|
|
376
|
+
};
|
|
377
|
+
type PrepareBacktestingResponse = PrepareBacktestingResponses[keyof PrepareBacktestingResponses];
|
|
378
|
+
type GetPreparationStatusData = {
|
|
379
|
+
body?: never;
|
|
380
|
+
path: {
|
|
381
|
+
/**
|
|
382
|
+
* ID of the exchange for the backtesting process
|
|
383
|
+
*/
|
|
384
|
+
exchangeId: string;
|
|
385
|
+
/**
|
|
386
|
+
* The type of data source to prepare from
|
|
387
|
+
*/
|
|
388
|
+
type: DataSourceType;
|
|
389
|
+
/**
|
|
390
|
+
* Job ID returned by `POST /prepare`
|
|
391
|
+
*/
|
|
392
|
+
jobId: string;
|
|
393
|
+
};
|
|
394
|
+
query?: never;
|
|
395
|
+
url: '/backtest/{exchangeId}/{type}/prepare/{jobId}';
|
|
396
|
+
};
|
|
397
|
+
type GetPreparationStatusErrors = {
|
|
398
|
+
/**
|
|
399
|
+
* Invalid request or parameters
|
|
400
|
+
*/
|
|
401
|
+
400: ResponseError;
|
|
402
|
+
/**
|
|
403
|
+
* Prepare job not found or expired
|
|
404
|
+
*/
|
|
405
|
+
404: ResponseError;
|
|
406
|
+
};
|
|
407
|
+
type GetPreparationStatusError = GetPreparationStatusErrors[keyof GetPreparationStatusErrors];
|
|
408
|
+
type GetPreparationStatusResponses = {
|
|
409
|
+
/**
|
|
410
|
+
* Current prepare job state
|
|
411
|
+
*/
|
|
412
|
+
200: JobState;
|
|
413
|
+
};
|
|
414
|
+
type GetPreparationStatusResponse = GetPreparationStatusResponses[keyof GetPreparationStatusResponses];
|
|
415
|
+
type ExecuteBacktestingData = {
|
|
416
|
+
/**
|
|
417
|
+
* Execute task parameters
|
|
418
|
+
*/
|
|
419
|
+
body: {
|
|
420
|
+
/**
|
|
421
|
+
* Job ID returned by `POST /prepare` (must be in `Completed` state)
|
|
422
|
+
*/
|
|
423
|
+
prepareJobId: string;
|
|
424
|
+
strategyId: StrategyId;
|
|
425
|
+
/**
|
|
426
|
+
* When true, the worker uploads emitted signals to object storage and the
|
|
427
|
+
* response includes `signalsUrl` / `signalsId` fields. Defaults to false.
|
|
428
|
+
*
|
|
429
|
+
*/
|
|
430
|
+
storeSignals?: boolean;
|
|
431
|
+
};
|
|
432
|
+
path: {
|
|
433
|
+
/**
|
|
434
|
+
* ID of the exchange for the backtesting process
|
|
435
|
+
*/
|
|
436
|
+
exchangeId: string;
|
|
437
|
+
/**
|
|
438
|
+
* The type of data source to execute from
|
|
439
|
+
*/
|
|
440
|
+
type: DataSourceType;
|
|
441
|
+
};
|
|
442
|
+
query?: never;
|
|
443
|
+
url: '/backtest/{exchangeId}/{type}/execute';
|
|
444
|
+
};
|
|
445
|
+
type ExecuteBacktestingErrors = {
|
|
446
|
+
/**
|
|
447
|
+
* Invalid request or parameters
|
|
448
|
+
*/
|
|
449
|
+
400: ResponseError;
|
|
450
|
+
/**
|
|
451
|
+
* Prepare job not found or expired
|
|
452
|
+
*/
|
|
453
|
+
404: ResponseError;
|
|
454
|
+
/**
|
|
455
|
+
* Rate limited (global queue at capacity or per-user limit reached)
|
|
456
|
+
*/
|
|
457
|
+
429: ResponseError;
|
|
458
|
+
};
|
|
459
|
+
type ExecuteBacktestingError = ExecuteBacktestingErrors[keyof ExecuteBacktestingErrors];
|
|
460
|
+
type ExecuteBacktestingResponses = {
|
|
461
|
+
/**
|
|
462
|
+
* Execute task accepted (queued for processing)
|
|
463
|
+
*/
|
|
464
|
+
202: AcceptedJob;
|
|
465
|
+
};
|
|
466
|
+
type ExecuteBacktestingResponse = ExecuteBacktestingResponses[keyof ExecuteBacktestingResponses];
|
|
467
|
+
type CancelExecutionData = {
|
|
468
|
+
body?: never;
|
|
469
|
+
path: {
|
|
470
|
+
exchangeId: string;
|
|
471
|
+
type: DataSourceType;
|
|
472
|
+
/**
|
|
473
|
+
* Job ID returned by `POST /execute`
|
|
474
|
+
*/
|
|
475
|
+
jobId: string;
|
|
476
|
+
};
|
|
477
|
+
query?: never;
|
|
478
|
+
url: '/backtest/{exchangeId}/{type}/execute/{jobId}';
|
|
479
|
+
};
|
|
480
|
+
type CancelExecutionErrors = {
|
|
481
|
+
/**
|
|
482
|
+
* Execution not found
|
|
483
|
+
*/
|
|
484
|
+
404: ResponseError;
|
|
485
|
+
};
|
|
486
|
+
type CancelExecutionError = CancelExecutionErrors[keyof CancelExecutionErrors];
|
|
487
|
+
type CancelExecutionResponses = {
|
|
488
|
+
/**
|
|
489
|
+
* Cancellation request accepted
|
|
490
|
+
*/
|
|
491
|
+
200: {
|
|
492
|
+
status?: 'cancelling';
|
|
493
|
+
jobId?: string;
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
type CancelExecutionResponse = CancelExecutionResponses[keyof CancelExecutionResponses];
|
|
497
|
+
type GetExecutionResultData = {
|
|
498
|
+
body?: never;
|
|
499
|
+
path: {
|
|
500
|
+
/**
|
|
501
|
+
* ID of the exchange for the backtesting process
|
|
502
|
+
*/
|
|
503
|
+
exchangeId: string;
|
|
504
|
+
/**
|
|
505
|
+
* The type of data source to execute from
|
|
506
|
+
*/
|
|
507
|
+
type: DataSourceType;
|
|
508
|
+
/**
|
|
509
|
+
* Job ID returned by `POST /execute`
|
|
510
|
+
*/
|
|
511
|
+
jobId: string;
|
|
512
|
+
};
|
|
513
|
+
query?: never;
|
|
514
|
+
url: '/backtest/{exchangeId}/{type}/execute/{jobId}';
|
|
515
|
+
};
|
|
516
|
+
type GetExecutionResultErrors = {
|
|
517
|
+
/**
|
|
518
|
+
* Invalid request or parameters
|
|
519
|
+
*/
|
|
520
|
+
400: ResponseError;
|
|
521
|
+
/**
|
|
522
|
+
* Execution job not found
|
|
523
|
+
*/
|
|
524
|
+
404: ResponseError;
|
|
525
|
+
};
|
|
526
|
+
type GetExecutionResultError = GetExecutionResultErrors[keyof GetExecutionResultErrors];
|
|
527
|
+
type GetExecutionResultResponses = {
|
|
528
|
+
/**
|
|
529
|
+
* Backtesting execution result
|
|
530
|
+
*/
|
|
531
|
+
200: BacktestJobResult;
|
|
532
|
+
};
|
|
533
|
+
type GetExecutionResultResponse = GetExecutionResultResponses[keyof GetExecutionResultResponses];
|
|
534
|
+
type ClientOptions = {
|
|
535
|
+
baseUrl: 'https://api.staging.qtsurfer.com/v1' | 'https://api.qtsurfer.com/v1' | (string & {});
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options$1<TData, ThrowOnError> & {
|
|
539
|
+
/**
|
|
540
|
+
* You can provide a client instance returned by `createClient()` instead of
|
|
541
|
+
* individual options. This might be also useful if you want to implement a
|
|
542
|
+
* custom client.
|
|
543
|
+
*/
|
|
544
|
+
client?: Client;
|
|
545
|
+
/**
|
|
546
|
+
* You can pass arbitrary values through the `meta` object. This can be
|
|
547
|
+
* used to access values that aren't defined as part of the SDK function.
|
|
548
|
+
*/
|
|
549
|
+
meta?: Record<string, unknown>;
|
|
550
|
+
};
|
|
551
|
+
/**
|
|
552
|
+
* Get a list of available exchanges
|
|
553
|
+
*/
|
|
554
|
+
declare const getExchanges: <ThrowOnError extends boolean = false>(options?: Options<GetExchangesData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Exchange[], unknown, ThrowOnError>;
|
|
555
|
+
/**
|
|
556
|
+
* Get a list of Instruments from a specific exchange
|
|
557
|
+
*/
|
|
558
|
+
declare const getInstruments: <ThrowOnError extends boolean = false>(options: Options<GetInstrumentsData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<InstrumentDetail[], ResponseError, ThrowOnError>;
|
|
559
|
+
/**
|
|
560
|
+
* Compile a strategy from source code
|
|
561
|
+
* Submits raw strategy source for compilation. By default the call is synchronous and returns
|
|
562
|
+
* the `strategyId` once compilation succeeds. Set the header `X-Compile-Async: true` to enqueue
|
|
563
|
+
* the compile task and return immediately with a `jobId` — poll
|
|
564
|
+
* `GET /strategy/{strategyId}` to check status.
|
|
565
|
+
*
|
|
566
|
+
* The `strategyId` is deterministic: the same source for the same user always produces the
|
|
567
|
+
* same id.
|
|
568
|
+
*
|
|
569
|
+
*/
|
|
570
|
+
declare const postStrategy: <ThrowOnError extends boolean = false>(options: Options<PostStrategyData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<PostStrategyResponse, ResponseError, ThrowOnError>;
|
|
571
|
+
/**
|
|
572
|
+
* Get the status of an async compile task
|
|
573
|
+
* Polls the status of a strategy compilation. Useful when the strategy was submitted with
|
|
574
|
+
* `X-Compile-Async: true`. Returns the resolved `strategyId` once compilation completes.
|
|
575
|
+
*
|
|
576
|
+
*/
|
|
577
|
+
declare const getStrategyStatus: <ThrowOnError extends boolean = false>(options: Options<GetStrategyStatusData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
|
|
578
|
+
jobId?: string;
|
|
579
|
+
status: "New" | "Started" | "Completed" | "Aborted" | "Failed";
|
|
580
|
+
strategyId?: StrategyId;
|
|
581
|
+
statusDetail?: string | null;
|
|
582
|
+
}, ResponseError, ThrowOnError>;
|
|
583
|
+
/**
|
|
584
|
+
* Prepare backtesting data
|
|
585
|
+
* Enqueues a prepare task over the requested date range. Returns immediately with a `jobId`;
|
|
586
|
+
* poll `GET /backtest/{exchangeId}/{type}/prepare/{jobId}` for completion.
|
|
587
|
+
*
|
|
588
|
+
* The same params always return the same `jobId` (idempotent). Repeated calls with identical
|
|
589
|
+
* params do not enqueue duplicate work — they reuse the existing job.
|
|
590
|
+
*
|
|
591
|
+
*/
|
|
592
|
+
declare const prepareBacktesting: <ThrowOnError extends boolean = false>(options: Options<PrepareBacktestingData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AcceptedJob, ResponseError, ThrowOnError>;
|
|
593
|
+
/**
|
|
594
|
+
* Get the status of a prepare job
|
|
595
|
+
* Retrieves the current state of the prepare job identified by `jobId`.
|
|
596
|
+
* Poll until `status` is `Completed`, `Failed`, or `Aborted`.
|
|
597
|
+
*
|
|
598
|
+
*/
|
|
599
|
+
declare const getPreparationStatus: <ThrowOnError extends boolean = false>(options: Options<GetPreparationStatusData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<JobState, ResponseError, ThrowOnError>;
|
|
600
|
+
/**
|
|
601
|
+
* Execute a compiled strategy against a prepared dataset
|
|
602
|
+
* Enqueues an execute task that runs the strategy identified by `strategyId` over the data
|
|
603
|
+
* prepared by the prepare job identified by `prepareJobId`. The instrument and date range are
|
|
604
|
+
* recovered from the prepare job — they do not need to be sent again.
|
|
605
|
+
*
|
|
606
|
+
* Returns immediately with a `jobId`; poll `GET /backtest/{exchangeId}/{type}/execute/{jobId}`
|
|
607
|
+
* for the result.
|
|
608
|
+
*
|
|
609
|
+
* The same params (same `prepareJobId`, `strategyId`, `storeSignals`) always return the same
|
|
610
|
+
* `jobId` (idempotent).
|
|
611
|
+
*
|
|
612
|
+
*/
|
|
613
|
+
declare const executeBacktesting: <ThrowOnError extends boolean = false>(options: Options<ExecuteBacktestingData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AcceptedJob, ResponseError, ThrowOnError>;
|
|
614
|
+
/**
|
|
615
|
+
* Cancel a running backtest execution
|
|
616
|
+
* Requests cancellation of the specified execution. The execution
|
|
617
|
+
* status will transition to `Aborted` once the cancellation is
|
|
618
|
+
* processed. Cancellation is asynchronous — poll the GET endpoint
|
|
619
|
+
* to confirm the final status.
|
|
620
|
+
*
|
|
621
|
+
*/
|
|
622
|
+
declare const cancelExecution: <ThrowOnError extends boolean = false>(options: Options<CancelExecutionData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
|
|
623
|
+
status?: "cancelling";
|
|
624
|
+
jobId?: string;
|
|
625
|
+
}, ResponseError, ThrowOnError>;
|
|
626
|
+
/**
|
|
627
|
+
* Get the result of a backtest execution job
|
|
628
|
+
* Retrieves the current state and results of the execute job identified by `jobId`.
|
|
629
|
+
* Poll until `state.status` is `Completed`, `Failed`, or `Aborted`.
|
|
630
|
+
*
|
|
631
|
+
*/
|
|
632
|
+
declare const getExecutionResult: <ThrowOnError extends boolean = false>(options: Options<GetExecutionResultData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<BacktestJobResult, ResponseError, ThrowOnError>;
|
|
633
|
+
|
|
634
|
+
declare const client: _hey_api_client_fetch.Client;
|
|
635
|
+
|
|
636
|
+
export { type AcceptedJob, type BacktestJobResult, type CancelExecutionData, type CancelExecutionError, type CancelExecutionErrors, type CancelExecutionResponse, type CancelExecutionResponses, type ClientOptions, type DataSourceType, type Exchange, type ExecuteBacktestingData, type ExecuteBacktestingError, type ExecuteBacktestingErrors, type ExecuteBacktestingResponse, type ExecuteBacktestingResponses, 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 GetStrategyStatusData, type GetStrategyStatusError, type GetStrategyStatusErrors, type GetStrategyStatusResponse, type GetStrategyStatusResponses, type Instrument, type InstrumentDetail, 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, cancelExecution, client, executeBacktesting, getExchanges, getExecutionResult, getInstruments, getPreparationStatus, getStrategyStatus, postStrategy, prepareBacktesting };
|