@qtsurfer/api-client 0.4.0 → 0.6.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 +365 -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 +97 -32
- package/src/generated/types.gen.ts +342 -91
package/src/generated/sdk.gen.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
|
|
3
3
|
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
|
|
4
|
-
import type {
|
|
4
|
+
import type { AuthenticateData, AuthenticateResponse, AuthenticateError, ListExchangesData, ListExchangesResponse, ListInstrumentsData, ListInstrumentsResponse, ListInstrumentsError, ListSegmentInstrumentsData, ListSegmentInstrumentsResponse, ListSegmentInstrumentsError, DownloadTickersData, DownloadTickersResponse, DownloadTickersError, DownloadKlinesData, DownloadKlinesResponse, DownloadKlinesError, CompileStrategyData, CompileStrategyResponse, CompileStrategyError, GetStrategyData, GetStrategyResponse, GetStrategyError, PrepareBacktestData, PrepareBacktestResponse, PrepareBacktestError, GetPrepareStatusData, GetPrepareStatusResponse, GetPrepareStatusError, ExecuteSweepData, ExecuteSweepResponse, ExecuteSweepError, CancelSweepData, CancelSweepResponse, CancelSweepError, GetSweepResultData, GetSweepResultResponse, GetSweepResultError, ExecuteBacktestData, ExecuteBacktestResponse, ExecuteBacktestError, CancelBacktestData, CancelBacktestResponse, CancelBacktestError, GetBacktestResultData, GetBacktestResultResponse, GetBacktestResultError } from './types.gen';
|
|
5
5
|
import { client as _heyApiClient } from './client.gen';
|
|
6
6
|
|
|
7
7
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
|
|
@@ -30,8 +30,8 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
|
|
|
30
30
|
* before expiry (or on a `401` response) by calling this endpoint again.
|
|
31
31
|
*
|
|
32
32
|
*/
|
|
33
|
-
export const
|
|
34
|
-
return (options?.client ?? _heyApiClient).post<
|
|
33
|
+
export const authenticate = <ThrowOnError extends boolean = false>(options?: Options<AuthenticateData, ThrowOnError>) => {
|
|
34
|
+
return (options?.client ?? _heyApiClient).post<AuthenticateResponse, AuthenticateError, ThrowOnError>({
|
|
35
35
|
security: [
|
|
36
36
|
{
|
|
37
37
|
name: 'X-API-Key',
|
|
@@ -44,40 +44,40 @@ export const auth = <ThrowOnError extends boolean = false>(options?: Options<Aut
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* List the available exchanges
|
|
48
48
|
*/
|
|
49
|
-
export const
|
|
50
|
-
return (options?.client ?? _heyApiClient).get<
|
|
49
|
+
export const listExchanges = <ThrowOnError extends boolean = false>(options?: Options<ListExchangesData, ThrowOnError>) => {
|
|
50
|
+
return (options?.client ?? _heyApiClient).get<ListExchangesResponse, unknown, ThrowOnError>({
|
|
51
51
|
url: '/exchanges',
|
|
52
52
|
...options
|
|
53
53
|
});
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* List an exchange's instruments (default spot segment)
|
|
58
58
|
* "Give me binance instruments" — returns the exchange's DEFAULT segment (`spot`)
|
|
59
59
|
* in `data`, each instrument with per-data-type coverage and market info. `meta`
|
|
60
60
|
* confirms the served `segment` (`spot`); HAL `_links` carry `self` plus the
|
|
61
61
|
* `spot` / `futures` segment-discovery links.
|
|
62
62
|
*
|
|
63
63
|
*/
|
|
64
|
-
export const
|
|
65
|
-
return (options.client ?? _heyApiClient).get<
|
|
64
|
+
export const listInstruments = <ThrowOnError extends boolean = false>(options: Options<ListInstrumentsData, ThrowOnError>) => {
|
|
65
|
+
return (options.client ?? _heyApiClient).get<ListInstrumentsResponse, ListInstrumentsError, ThrowOnError>({
|
|
66
66
|
url: '/exchange/{exchangeId}/instruments',
|
|
67
67
|
...options
|
|
68
68
|
});
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* List an exchange segment's instruments
|
|
73
73
|
* Returns the instruments for one market segment of the exchange, each with
|
|
74
74
|
* per-data-type coverage and market info. HAL `_links` carry `self` plus the
|
|
75
75
|
* `spot` / `futures` segment-discovery links; the default-segment shortcut is
|
|
76
76
|
* `GET /exchange/{exchangeId}/instruments` (spot).
|
|
77
77
|
*
|
|
78
78
|
*/
|
|
79
|
-
export const
|
|
80
|
-
return (options.client ?? _heyApiClient).get<
|
|
79
|
+
export const listSegmentInstruments = <ThrowOnError extends boolean = false>(options: Options<ListSegmentInstrumentsData, ThrowOnError>) => {
|
|
80
|
+
return (options.client ?? _heyApiClient).get<ListSegmentInstrumentsResponse, ListSegmentInstrumentsError, ThrowOnError>({
|
|
81
81
|
url: '/exchange/{exchangeId}/{segment}/instruments',
|
|
82
82
|
...options
|
|
83
83
|
});
|
|
@@ -115,8 +115,8 @@ export const getSegmentInstruments = <ThrowOnError extends boolean = false>(opti
|
|
|
115
115
|
* descriptive filename).
|
|
116
116
|
*
|
|
117
117
|
*/
|
|
118
|
-
export const
|
|
119
|
-
return (options.client ?? _heyApiClient).get<
|
|
118
|
+
export const downloadTickers = <ThrowOnError extends boolean = false>(options: Options<DownloadTickersData, ThrowOnError>) => {
|
|
119
|
+
return (options.client ?? _heyApiClient).get<DownloadTickersResponse, DownloadTickersError, ThrowOnError>({
|
|
120
120
|
url: '/exchange/{exchangeId}/tickers/{base}/{quote}',
|
|
121
121
|
...options
|
|
122
122
|
});
|
|
@@ -134,8 +134,8 @@ export const getExchangeTickersHour = <ThrowOnError extends boolean = false>(opt
|
|
|
134
134
|
* per-tick payload would be too large for the window of interest.
|
|
135
135
|
*
|
|
136
136
|
*/
|
|
137
|
-
export const
|
|
138
|
-
return (options.client ?? _heyApiClient).get<
|
|
137
|
+
export const downloadKlines = <ThrowOnError extends boolean = false>(options: Options<DownloadKlinesData, ThrowOnError>) => {
|
|
138
|
+
return (options.client ?? _heyApiClient).get<DownloadKlinesResponse, DownloadKlinesError, ThrowOnError>({
|
|
139
139
|
url: '/exchange/{exchangeId}/klines/{base}/{quote}',
|
|
140
140
|
...options
|
|
141
141
|
});
|
|
@@ -152,8 +152,8 @@ export const getExchangeKlinesHour = <ThrowOnError extends boolean = false>(opti
|
|
|
152
152
|
* same id.
|
|
153
153
|
*
|
|
154
154
|
*/
|
|
155
|
-
export const
|
|
156
|
-
return (options.client ?? _heyApiClient).post<
|
|
155
|
+
export const compileStrategy = <ThrowOnError extends boolean = false>(options: Options<CompileStrategyData, ThrowOnError>) => {
|
|
156
|
+
return (options.client ?? _heyApiClient).post<CompileStrategyResponse, CompileStrategyError, ThrowOnError>({
|
|
157
157
|
bodySerializer: null,
|
|
158
158
|
security: [
|
|
159
159
|
{
|
|
@@ -171,13 +171,13 @@ export const postStrategy = <ThrowOnError extends boolean = false>(options: Opti
|
|
|
171
171
|
};
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
|
-
* Get
|
|
174
|
+
* Get a strategy by id, including its compile status
|
|
175
175
|
* Polls the status of a strategy compilation. Useful when the strategy was submitted with
|
|
176
176
|
* `X-Compile-Async: true`. Returns the resolved `strategyId` once compilation completes.
|
|
177
177
|
*
|
|
178
178
|
*/
|
|
179
|
-
export const
|
|
180
|
-
return (options.client ?? _heyApiClient).get<
|
|
179
|
+
export const getStrategy = <ThrowOnError extends boolean = false>(options: Options<GetStrategyData, ThrowOnError>) => {
|
|
180
|
+
return (options.client ?? _heyApiClient).get<GetStrategyResponse, GetStrategyError, ThrowOnError>({
|
|
181
181
|
security: [
|
|
182
182
|
{
|
|
183
183
|
scheme: 'bearer',
|
|
@@ -190,7 +190,7 @@ export const getStrategyStatus = <ThrowOnError extends boolean = false>(options:
|
|
|
190
190
|
};
|
|
191
191
|
|
|
192
192
|
/**
|
|
193
|
-
* Prepare
|
|
193
|
+
* Prepare backtest data
|
|
194
194
|
* Enqueues a prepare task over the requested date range. Returns immediately with a `jobId`;
|
|
195
195
|
* poll `GET /backtest/{exchangeId}/{type}/prepare/{jobId}` for completion.
|
|
196
196
|
*
|
|
@@ -198,8 +198,8 @@ export const getStrategyStatus = <ThrowOnError extends boolean = false>(options:
|
|
|
198
198
|
* params do not enqueue duplicate work — they reuse the existing job.
|
|
199
199
|
*
|
|
200
200
|
*/
|
|
201
|
-
export const
|
|
202
|
-
return (options.client ?? _heyApiClient).post<
|
|
201
|
+
export const prepareBacktest = <ThrowOnError extends boolean = false>(options: Options<PrepareBacktestData, ThrowOnError>) => {
|
|
202
|
+
return (options.client ?? _heyApiClient).post<PrepareBacktestResponse, PrepareBacktestError, ThrowOnError>({
|
|
203
203
|
security: [
|
|
204
204
|
{
|
|
205
205
|
scheme: 'bearer',
|
|
@@ -221,8 +221,8 @@ export const prepareBacktesting = <ThrowOnError extends boolean = false>(options
|
|
|
221
221
|
* Poll until `status` is `Completed`, `Failed`, or `Aborted`.
|
|
222
222
|
*
|
|
223
223
|
*/
|
|
224
|
-
export const
|
|
225
|
-
return (options.client ?? _heyApiClient).get<
|
|
224
|
+
export const getPrepareStatus = <ThrowOnError extends boolean = false>(options: Options<GetPrepareStatusData, ThrowOnError>) => {
|
|
225
|
+
return (options.client ?? _heyApiClient).get<GetPrepareStatusResponse, GetPrepareStatusError, ThrowOnError>({
|
|
226
226
|
security: [
|
|
227
227
|
{
|
|
228
228
|
scheme: 'bearer',
|
|
@@ -234,6 +234,67 @@ export const getPreparationStatus = <ThrowOnError extends boolean = false>(optio
|
|
|
234
234
|
});
|
|
235
235
|
};
|
|
236
236
|
|
|
237
|
+
/**
|
|
238
|
+
* Execute a parameter sweep over prepared data
|
|
239
|
+
* Runs a parameter matrix over the single immutable dataset identified by `requestId`.
|
|
240
|
+
* The backend expands and executes the matrix internally; clients poll the returned
|
|
241
|
+
* `sweepId` for incremental results.
|
|
242
|
+
*
|
|
243
|
+
*/
|
|
244
|
+
export const executeSweep = <ThrowOnError extends boolean = false>(options: Options<ExecuteSweepData, ThrowOnError>) => {
|
|
245
|
+
return (options.client ?? _heyApiClient).post<ExecuteSweepResponse, ExecuteSweepError, ThrowOnError>({
|
|
246
|
+
security: [
|
|
247
|
+
{
|
|
248
|
+
scheme: 'bearer',
|
|
249
|
+
type: 'http'
|
|
250
|
+
}
|
|
251
|
+
],
|
|
252
|
+
url: '/backtest/{exchangeId}/{type}/executeSweep/{requestId}',
|
|
253
|
+
...options,
|
|
254
|
+
headers: {
|
|
255
|
+
'Content-Type': 'application/json',
|
|
256
|
+
...options?.headers
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Cancel a running parameter sweep
|
|
263
|
+
* Requests cancellation between parameter vectors. Completed rows remain readable.
|
|
264
|
+
*/
|
|
265
|
+
export const cancelSweep = <ThrowOnError extends boolean = false>(options: Options<CancelSweepData, ThrowOnError>) => {
|
|
266
|
+
return (options.client ?? _heyApiClient).delete<CancelSweepResponse, CancelSweepError, ThrowOnError>({
|
|
267
|
+
security: [
|
|
268
|
+
{
|
|
269
|
+
scheme: 'bearer',
|
|
270
|
+
type: 'http'
|
|
271
|
+
}
|
|
272
|
+
],
|
|
273
|
+
url: '/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}',
|
|
274
|
+
...options
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Get sweep progress and results
|
|
280
|
+
* Returns incremental sweep progress. The default `ranked` view sorts and may truncate the
|
|
281
|
+
* display leaderboard. `order=natural` returns every available row, untruncated, ordered by
|
|
282
|
+
* deterministic `runIx`; use that view when materialising durable trial rows.
|
|
283
|
+
*
|
|
284
|
+
*/
|
|
285
|
+
export const getSweepResult = <ThrowOnError extends boolean = false>(options: Options<GetSweepResultData, ThrowOnError>) => {
|
|
286
|
+
return (options.client ?? _heyApiClient).get<GetSweepResultResponse, GetSweepResultError, ThrowOnError>({
|
|
287
|
+
security: [
|
|
288
|
+
{
|
|
289
|
+
scheme: 'bearer',
|
|
290
|
+
type: 'http'
|
|
291
|
+
}
|
|
292
|
+
],
|
|
293
|
+
url: '/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}',
|
|
294
|
+
...options
|
|
295
|
+
});
|
|
296
|
+
};
|
|
297
|
+
|
|
237
298
|
/**
|
|
238
299
|
* Execute a compiled strategy against a prepared dataset
|
|
239
300
|
* Enqueues an execute task that runs the strategy identified by `strategyId` over the data
|
|
@@ -247,8 +308,8 @@ export const getPreparationStatus = <ThrowOnError extends boolean = false>(optio
|
|
|
247
308
|
* `jobId` (idempotent).
|
|
248
309
|
*
|
|
249
310
|
*/
|
|
250
|
-
export const
|
|
251
|
-
return (options.client ?? _heyApiClient).post<
|
|
311
|
+
export const executeBacktest = <ThrowOnError extends boolean = false>(options: Options<ExecuteBacktestData, ThrowOnError>) => {
|
|
312
|
+
return (options.client ?? _heyApiClient).post<ExecuteBacktestResponse, ExecuteBacktestError, ThrowOnError>({
|
|
252
313
|
security: [
|
|
253
314
|
{
|
|
254
315
|
scheme: 'bearer',
|
|
@@ -272,8 +333,8 @@ export const executeBacktesting = <ThrowOnError extends boolean = false>(options
|
|
|
272
333
|
* to confirm the final status.
|
|
273
334
|
*
|
|
274
335
|
*/
|
|
275
|
-
export const
|
|
276
|
-
return (options.client ?? _heyApiClient).delete<
|
|
336
|
+
export const cancelBacktest = <ThrowOnError extends boolean = false>(options: Options<CancelBacktestData, ThrowOnError>) => {
|
|
337
|
+
return (options.client ?? _heyApiClient).delete<CancelBacktestResponse, CancelBacktestError, ThrowOnError>({
|
|
277
338
|
security: [
|
|
278
339
|
{
|
|
279
340
|
scheme: 'bearer',
|
|
@@ -290,9 +351,13 @@ export const cancelExecution = <ThrowOnError extends boolean = false>(options: O
|
|
|
290
351
|
* Retrieves the current state and results of the execute job identified by `jobId`.
|
|
291
352
|
* Poll until `state.status` is `Completed`, `Failed`, or `Aborted`.
|
|
292
353
|
*
|
|
354
|
+
* A `202` means the result is not readable yet — keep polling. It is never a terminal
|
|
355
|
+
* outcome, and it carries no `state`, so a poll loop that stops on a terminal status will
|
|
356
|
+
* not stop on it.
|
|
357
|
+
*
|
|
293
358
|
*/
|
|
294
|
-
export const
|
|
295
|
-
return (options.client ?? _heyApiClient).get<
|
|
359
|
+
export const getBacktestResult = <ThrowOnError extends boolean = false>(options: Options<GetBacktestResultData, ThrowOnError>) => {
|
|
360
|
+
return (options.client ?? _heyApiClient).get<GetBacktestResultResponse, GetBacktestResultError, ThrowOnError>({
|
|
296
361
|
security: [
|
|
297
362
|
{
|
|
298
363
|
scheme: 'bearer',
|