@qtsurfer/api-client 0.14.1 → 0.15.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 +4 -2
- package/dist/index.d.ts +314 -28
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/generated/schemas.gen.ts +250 -41
- package/src/generated/sdk.gen.ts +90 -3
- package/src/generated/types.gen.ts +288 -41
package/README.md
CHANGED
|
@@ -68,8 +68,8 @@ pluggable token stores so callers don't reinvent that plumbing.
|
|
|
68
68
|
|
|
69
69
|
All operations are exported as standalone functions; every operation accepts an `Options` object and returns `{ data, error, response }`.
|
|
70
70
|
|
|
71
|
-
The table is exhaustive: `src/generated/` is produced from the OpenAPI spec, so **all
|
|
72
|
-
the spec declares are exported. The rows below describe **spec version 0.
|
|
71
|
+
The table is exhaustive: `src/generated/` is produced from the OpenAPI spec, so **all 31 operations**
|
|
72
|
+
the spec declares are exported. The rows below describe **spec version 0.119.0**, which is versioned
|
|
73
73
|
independently of this package.
|
|
74
74
|
|
|
75
75
|
| Function | Method | Path | Purpose |
|
|
@@ -103,6 +103,8 @@ independently of this package.
|
|
|
103
103
|
| `openDatasetUpload` | POST | `/datasets/{datasetId}/uploads` | Open an upload session for a later dataset version |
|
|
104
104
|
| `finalizeDatasetUpload` | POST | `/datasets/{datasetId}/uploads/{uploadId}/finalize` | Queue ingest after uploading a file |
|
|
105
105
|
| `getDatasetUpload` | GET | `/datasets/{datasetId}/uploads/{uploadId}` | Get an upload's ingestion state |
|
|
106
|
+
| `importDataset` | POST | `/datasets/imports` | Create a dataset by importing external history |
|
|
107
|
+
| `getDatasetImport` | GET | `/datasets/{datasetId}/imports/{importId}` | Get an import's fetch and ingestion state |
|
|
106
108
|
|
|
107
109
|
All generated types (`Exchange`, `InstrumentDetail`, `BacktestJobResult`, `PrepareJobState`, `ResultMap`, etc.) are re-exported from the root.
|
|
108
110
|
|
package/dist/index.d.ts
CHANGED
|
@@ -216,14 +216,22 @@ type PrepareRequest = {
|
|
|
216
216
|
*/
|
|
217
217
|
to: string;
|
|
218
218
|
/**
|
|
219
|
-
* Output bar cadence for the prepared range.
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
219
|
+
* Output bar cadence for the prepared range. Coarser cadences are produced on demand by
|
|
220
|
+
* resampling the source and stored alongside the native blob in cache. A target finer
|
|
221
|
+
* than the source, or not an exact multiple of it, returns `400`. What's accepted, and
|
|
222
|
+
* what omitting it means, depends on the source:
|
|
223
|
+
*
|
|
224
|
+
* * Managed exchange — one of `1s`, `5s`, `1m`, `3m`, `5m`, `15m`, `30m`, `1h`, `2h`,
|
|
225
|
+
* `4h`, `8h`, `12h`, `1d`, `1w`, `1q`; any other label returns `400`. Omitted = `1s`,
|
|
226
|
+
* the publisher's native cadence.
|
|
227
|
+
* * Dataset (`exchangeId: user`) — omitted = the dataset version's own discovered
|
|
228
|
+
* `cadence` (see `DatasetVersion.cadence`), served as-is. Any cadence equal to or
|
|
229
|
+
* coarser than it and an exact multiple of it is accepted, including ones outside the
|
|
230
|
+
* managed-exchange list (e.g. `15s`); an `rt` dataset can be resampled to any fixed
|
|
231
|
+
* cadence.
|
|
224
232
|
*
|
|
225
233
|
*/
|
|
226
|
-
cadence?:
|
|
234
|
+
cadence?: string;
|
|
227
235
|
};
|
|
228
236
|
/**
|
|
229
237
|
* Information about a single job
|
|
@@ -237,7 +245,8 @@ type JobState = {
|
|
|
237
245
|
* Current status of the job. Treat `Completed | Aborted | Failed` as
|
|
238
246
|
* terminal; `New | Started` mean keep polling. A single-instrument prepare
|
|
239
247
|
* is always terminal (`Completed`) — decide from
|
|
240
|
-
* `PrepareJobState.coverageRatio
|
|
248
|
+
* `PrepareJobState.coverageRatio` (or `dataFrom`/`dataTo` against an `rt` dataset,
|
|
249
|
+
* which has no ratio), not by polling.
|
|
241
250
|
*
|
|
242
251
|
*/
|
|
243
252
|
status: "New" | "Started" | "Completed" | "Aborted" | "Failed";
|
|
@@ -274,8 +283,10 @@ type JobState = {
|
|
|
274
283
|
* dataset-backed prepare (`exchangeId: user`), coverage is reported on the dataset's own
|
|
275
284
|
* cadence grid instead — hour-walking a daily dataset would report `1/24` and read as
|
|
276
285
|
* broken — via `cadence`/`gaps`/`largestGapSteps`; `totalHours`/`hoursWithData`/
|
|
277
|
-
* `hoursWithoutData` are absent in that case. `dataFrom`/`dataTo
|
|
278
|
-
*
|
|
286
|
+
* `hoursWithoutData` are absent in that case. `dataFrom`/`dataTo` are present either way, and
|
|
287
|
+
* `coverageRatio` too, computed accordingly — except against a dataset whose `cadence` is `rt`:
|
|
288
|
+
* with no fixed step there is no expected row count to measure against, so `coverageRatio`
|
|
289
|
+
* is absent and `gaps`/`largestGapSteps` are `0`.
|
|
279
290
|
*
|
|
280
291
|
*/
|
|
281
292
|
type PrepareJobState = JobState & {
|
|
@@ -292,7 +303,8 @@ type PrepareJobState = JobState & {
|
|
|
292
303
|
* `totalHours` is 0), the fraction of hours in the requested range that have served
|
|
293
304
|
* data. Against a dataset (`exchangeId: user`): `rows / expectedStepsAtCadence`
|
|
294
305
|
* over the dataset version's own range — echoing what ingest computed once, not
|
|
295
|
-
* recomputed against a narrower prepare request.
|
|
306
|
+
* recomputed against a narrower prepare request. Absent for an `rt` dataset (no
|
|
307
|
+
* fixed step, so no expected row count).
|
|
296
308
|
*
|
|
297
309
|
*/
|
|
298
310
|
coverageRatio?: number;
|
|
@@ -309,20 +321,21 @@ type PrepareJobState = JobState & {
|
|
|
309
321
|
*/
|
|
310
322
|
hoursWithData?: number;
|
|
311
323
|
/**
|
|
312
|
-
* The dataset version's own discovered cadence (e.g. `1m`, `1h`)
|
|
313
|
-
*
|
|
324
|
+
* The dataset version's own discovered cadence — a fixed grid (e.g. `1m`, `1h`) or
|
|
325
|
+
* `rt` (see `DatasetVersion.cadence`). Only present for a dataset-backed prepare
|
|
326
|
+
* (`exchangeId: user`).
|
|
314
327
|
*
|
|
315
328
|
*/
|
|
316
329
|
cadence?: string;
|
|
317
330
|
/**
|
|
318
331
|
* Number of gaps in the dataset version at its own cadence, as discovered at ingest
|
|
319
|
-
* time. Only present for a dataset-backed prepare.
|
|
332
|
+
* time. `0` for `rt`. Only present for a dataset-backed prepare.
|
|
320
333
|
*
|
|
321
334
|
*/
|
|
322
335
|
gaps?: number;
|
|
323
336
|
/**
|
|
324
|
-
* The largest gap in the dataset version, in units of its own cadence step.
|
|
325
|
-
* present for a dataset-backed prepare.
|
|
337
|
+
* The largest gap in the dataset version, in units of its own cadence step. `0` for
|
|
338
|
+
* `rt`. Only present for a dataset-backed prepare.
|
|
326
339
|
*
|
|
327
340
|
*/
|
|
328
341
|
largestGapSteps?: number;
|
|
@@ -1119,9 +1132,12 @@ type Dataset = {
|
|
|
1119
1132
|
*/
|
|
1120
1133
|
name: string;
|
|
1121
1134
|
/**
|
|
1122
|
-
*
|
|
1135
|
+
* `ticker` for an upload or a `dex` import with no `cadence` requested (native per-trade
|
|
1136
|
+
* data). `klines` for a `dex` import that requested a candle `cadence` — pre-aggregated
|
|
1137
|
+
* bars rather than raw ticks. Purely informational; both shapes are read the same way.
|
|
1138
|
+
*
|
|
1123
1139
|
*/
|
|
1124
|
-
type: "ticker";
|
|
1140
|
+
type: "ticker" | "klines";
|
|
1125
1141
|
instrument: Instrument;
|
|
1126
1142
|
/**
|
|
1127
1143
|
* When the dataset was created.
|
|
@@ -1150,8 +1166,8 @@ type Dataset = {
|
|
|
1150
1166
|
*/
|
|
1151
1167
|
to?: string;
|
|
1152
1168
|
/**
|
|
1153
|
-
* `currentVersionId`'s own discovered
|
|
1154
|
-
* version exists.
|
|
1169
|
+
* `currentVersionId`'s own discovered cadence — a fixed grid (e.g. `1s`, `1m`, `1h`) or
|
|
1170
|
+
* `rt` (see `DatasetVersion.cadence`). Absent until a version exists.
|
|
1155
1171
|
*
|
|
1156
1172
|
*/
|
|
1157
1173
|
cadence?: string;
|
|
@@ -1256,7 +1272,13 @@ type DatasetVersion = {
|
|
|
1256
1272
|
*/
|
|
1257
1273
|
rows?: number;
|
|
1258
1274
|
/**
|
|
1259
|
-
* The discovered
|
|
1275
|
+
* The cadence discovered from the data's own timestamps. Either a fixed grid — `1s`,
|
|
1276
|
+
* `5s`, `15s`, `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1d` — when at least half the
|
|
1277
|
+
* intervals between consecutive rows fall on that step (small clock jitter tolerated), or
|
|
1278
|
+
* `rt`: native data at the rate it was captured, each row at its own timestamp with no
|
|
1279
|
+
* fixed step — per-trade on-chain swaps, block-spaced or sub-second ticks, irregular
|
|
1280
|
+
* intervals. An `rt` dataset can be resampled to any fixed cadence at prepare time.
|
|
1281
|
+
*
|
|
1260
1282
|
*/
|
|
1261
1283
|
cadence?: string;
|
|
1262
1284
|
/**
|
|
@@ -1266,11 +1288,11 @@ type DatasetVersion = {
|
|
|
1266
1288
|
*/
|
|
1267
1289
|
timestampUnit?: "iso" | "s" | "ms" | "us";
|
|
1268
1290
|
/**
|
|
1269
|
-
* Number of gaps at the discovered cadence.
|
|
1291
|
+
* Number of gaps at the discovered cadence. Always `0` for `rt`.
|
|
1270
1292
|
*/
|
|
1271
1293
|
gaps?: number;
|
|
1272
1294
|
/**
|
|
1273
|
-
* The largest gap, in units of the discovered cadence step.
|
|
1295
|
+
* The largest gap, in units of the discovered cadence step. Always `0` for `rt`.
|
|
1274
1296
|
*/
|
|
1275
1297
|
largestGapSteps?: number;
|
|
1276
1298
|
/**
|
|
@@ -1312,6 +1334,150 @@ type DatasetUploadState = {
|
|
|
1312
1334
|
* The ingest job id, while `status` is `ingesting`.
|
|
1313
1335
|
*/
|
|
1314
1336
|
jobId?: string;
|
|
1337
|
+
/**
|
|
1338
|
+
* A human-readable reason, present when `status` is `failed` (e.g. bad CSV contract,
|
|
1339
|
+
* mixed timestamp units, a `.zip` with no file inside or more than one). Durably
|
|
1340
|
+
* recorded alongside the failure itself, so it stays available however long after the
|
|
1341
|
+
* fact you poll — not tied to how recently the failure happened.
|
|
1342
|
+
*
|
|
1343
|
+
*/
|
|
1344
|
+
error?: string;
|
|
1345
|
+
/**
|
|
1346
|
+
* Present when `status` is `ready` or `failed`.
|
|
1347
|
+
*/
|
|
1348
|
+
version?: DatasetVersion;
|
|
1349
|
+
};
|
|
1350
|
+
/**
|
|
1351
|
+
* `POST /datasets/imports`'s request body. A common block plus one type-specific block,
|
|
1352
|
+
* selected by `type` — `dex` is the only value today.
|
|
1353
|
+
*
|
|
1354
|
+
*/
|
|
1355
|
+
type DatasetImportRequest = {
|
|
1356
|
+
/**
|
|
1357
|
+
* A name unique among your datasets. `409` if already taken.
|
|
1358
|
+
*/
|
|
1359
|
+
name: string;
|
|
1360
|
+
instrument: Instrument;
|
|
1361
|
+
/**
|
|
1362
|
+
* Start of the range to fetch, inclusive. Must be before `to`.
|
|
1363
|
+
*/
|
|
1364
|
+
from: string;
|
|
1365
|
+
/**
|
|
1366
|
+
* End of the range to fetch, exclusive. The total span is capped by your tier — a
|
|
1367
|
+
* request wider than that ceiling is `400`, regardless of source type.
|
|
1368
|
+
*
|
|
1369
|
+
*/
|
|
1370
|
+
to: string;
|
|
1371
|
+
/**
|
|
1372
|
+
* Optional. Omitted/blank keeps native per-trade event cadence — each swap at its own
|
|
1373
|
+
* timestamp, so the resulting version's `cadence` is `rt` unless the swaps happen to sit
|
|
1374
|
+
* on a fixed grid (see `DatasetVersion.cadence`). Set to `1s`, `1m` or
|
|
1375
|
+
* `5m` instead to get pre-aggregated candles at that width rather than raw trades (the
|
|
1376
|
+
* resulting dataset's `type` becomes `klines`); any other value is `400`. Not every
|
|
1377
|
+
* network supports every cadence — an unsupported combination fails asynchronously, not
|
|
1378
|
+
* at request time (see `DatasetImportState.error`).
|
|
1379
|
+
*
|
|
1380
|
+
*/
|
|
1381
|
+
cadence?: "1s" | "1m" | "5m";
|
|
1382
|
+
/**
|
|
1383
|
+
* The source to fetch from. `dex` is the only value today.
|
|
1384
|
+
*/
|
|
1385
|
+
type: "dex";
|
|
1386
|
+
dex?: DatasetImportDexRequest;
|
|
1387
|
+
};
|
|
1388
|
+
/**
|
|
1389
|
+
* The `dex` source's own fields — required when `type` is `dex`. `id`/`version` are required
|
|
1390
|
+
* for a plain (native-cadence) import; both are ignored if the top-level `cadence` requested
|
|
1391
|
+
* pre-aggregated candles instead, since that path needs neither a protocol nor a version
|
|
1392
|
+
* distinction.
|
|
1393
|
+
*
|
|
1394
|
+
*/
|
|
1395
|
+
type DatasetImportDexRequest = {
|
|
1396
|
+
/**
|
|
1397
|
+
* Which chain the pool/pair lives on.
|
|
1398
|
+
*/
|
|
1399
|
+
network: "ethereum" | "robinhood";
|
|
1400
|
+
/**
|
|
1401
|
+
* Which on-chain DEX protocol `contract` implements. Required unless the top-level
|
|
1402
|
+
* `cadence` requested pre-aggregated candles, in which case it's ignored.
|
|
1403
|
+
*
|
|
1404
|
+
*/
|
|
1405
|
+
id?: "uniswap";
|
|
1406
|
+
/**
|
|
1407
|
+
* Uniswap version the pool/pair contract implements. Required unless the top-level
|
|
1408
|
+
* `cadence` requested pre-aggregated candles, in which case it's ignored.
|
|
1409
|
+
*
|
|
1410
|
+
*/
|
|
1411
|
+
version?: "v2" | "v3";
|
|
1412
|
+
/**
|
|
1413
|
+
* The pool (v3) or pair (v2) contract address.
|
|
1414
|
+
*/
|
|
1415
|
+
contract: string;
|
|
1416
|
+
/**
|
|
1417
|
+
* The factory that deployed `contract`. Optional — when omitted, it is discovered
|
|
1418
|
+
* on-chain from `contract` itself at fetch time. Supply it explicitly only if you
|
|
1419
|
+
* already know it, or the pool/pair belongs to a factory other than the canonical one
|
|
1420
|
+
* for `network`/`version`. Either way, the pool/pair is validated against whichever
|
|
1421
|
+
* factory is used before anything is fetched — a wrong or unrelated factory fails the
|
|
1422
|
+
* import rather than silently fetching from the wrong pool. Ignored if the top-level
|
|
1423
|
+
* `cadence` requested pre-aggregated candles.
|
|
1424
|
+
*
|
|
1425
|
+
*/
|
|
1426
|
+
factory?: string;
|
|
1427
|
+
};
|
|
1428
|
+
/**
|
|
1429
|
+
* The response to `POST /datasets/imports` — the dataset now exists, and its fetch has started.
|
|
1430
|
+
*/
|
|
1431
|
+
type DatasetImportCreated = {
|
|
1432
|
+
/**
|
|
1433
|
+
* Opaque id of the newly created dataset — same id space as `POST /datasets`.
|
|
1434
|
+
*/
|
|
1435
|
+
datasetId: string;
|
|
1436
|
+
/**
|
|
1437
|
+
* Identifies this import. Pass to `GET /datasets/{datasetId}/imports/{importId}` to poll
|
|
1438
|
+
* it — there is no separate "finalize" step the way an upload has.
|
|
1439
|
+
*
|
|
1440
|
+
*/
|
|
1441
|
+
importId: string;
|
|
1442
|
+
/**
|
|
1443
|
+
* The fetch/ingest job id.
|
|
1444
|
+
*/
|
|
1445
|
+
jobId: string;
|
|
1446
|
+
/**
|
|
1447
|
+
* Always `fetching` in this response — the fetch has only just started.
|
|
1448
|
+
*/
|
|
1449
|
+
status: "fetching";
|
|
1450
|
+
};
|
|
1451
|
+
/**
|
|
1452
|
+
* Progress of one import, from fetching through ingest. `fetching` is the one status only an
|
|
1453
|
+
* import ever reports — an upload's file already exists by the time you can poll it; an
|
|
1454
|
+
* import's doesn't, until this source finishes fetching it.
|
|
1455
|
+
*
|
|
1456
|
+
*/
|
|
1457
|
+
type DatasetImportState = {
|
|
1458
|
+
importId: string;
|
|
1459
|
+
/**
|
|
1460
|
+
* * `fetching` — reading from the source; nothing staged yet.
|
|
1461
|
+
* * `ingesting` — fetch complete, staged, and re-entered the same ingest chain an
|
|
1462
|
+
* upload uses; the worker is parsing and validating it.
|
|
1463
|
+
* * `ready` — ingested successfully. `version` carries the result.
|
|
1464
|
+
* * `failed` — the fetch or the ingest that followed it was rejected. `error` names why.
|
|
1465
|
+
*
|
|
1466
|
+
*/
|
|
1467
|
+
status: "fetching" | "ingesting" | "ready" | "failed";
|
|
1468
|
+
/**
|
|
1469
|
+
* The fetch/ingest job id, while `status` is `fetching` or `ingesting`.
|
|
1470
|
+
*/
|
|
1471
|
+
jobId?: string;
|
|
1472
|
+
/**
|
|
1473
|
+
* A human-readable reason, present when `status` is `failed` — an unresolvable
|
|
1474
|
+
* pool/pair, no data in the requested range, a range older than the configured source
|
|
1475
|
+
* retains, the fetch exceeding your tier's time ceiling, or any of
|
|
1476
|
+
* `DatasetUploadState.error`'s own ingest-side reasons once fetching hands off to it.
|
|
1477
|
+
* Durably recorded, same as on the upload path.
|
|
1478
|
+
*
|
|
1479
|
+
*/
|
|
1480
|
+
error?: string;
|
|
1315
1481
|
/**
|
|
1316
1482
|
* Present when `status` is `ready` or `failed`.
|
|
1317
1483
|
*/
|
|
@@ -1758,8 +1924,8 @@ type PrepareBacktestErrors = {
|
|
|
1758
1924
|
* Invalid request or parameters. Also returned when `from` is older than the configured
|
|
1759
1925
|
* lookback window or `to` is in the future. For `exchangeId: user`, also returned when
|
|
1760
1926
|
* the dataset's current upload has not finished ingesting, or `cadence` asks for a finer
|
|
1761
|
-
* granularity than the dataset's own discovered cadence
|
|
1762
|
-
* your tier's range limit.
|
|
1927
|
+
* granularity than the dataset's own discovered cadence (or one that isn't an exact
|
|
1928
|
+
* multiple of it), or the requested range exceeds your tier's range limit.
|
|
1763
1929
|
*
|
|
1764
1930
|
*/
|
|
1765
1931
|
400: ResponseError;
|
|
@@ -2023,6 +2189,16 @@ type ExecuteBacktestData = {
|
|
|
2023
2189
|
*/
|
|
2024
2190
|
storeSignals?: boolean;
|
|
2025
2191
|
equityCurve?: EquityCurveOptions;
|
|
2192
|
+
/**
|
|
2193
|
+
* Capital/fee/position-size overrides for this one run — the same shape
|
|
2194
|
+
* `executeSweep`'s `baseConfig` accepts. Omit to run at the platform defaults
|
|
2195
|
+
* (`initialFunding: 100`, `feeRate: 0.001`). `buyFeeRate`/`sellFeeRate`/`feeLeg`
|
|
2196
|
+
* are accepted for shape compatibility with a sweep's `baseConfig`, but this
|
|
2197
|
+
* endpoint has one fee-rate slot: a value that implies asymmetric buy/sell fees,
|
|
2198
|
+
* or a non-default `feeLeg`, is rejected with `400`.
|
|
2199
|
+
*
|
|
2200
|
+
*/
|
|
2201
|
+
baseConfig?: SweepBaseConfig;
|
|
2026
2202
|
/**
|
|
2027
2203
|
* Strategy properties to apply to this run. Omit to run the strategy's declared
|
|
2028
2204
|
* defaults, which is exactly what a request without this field has always done.
|
|
@@ -2370,6 +2546,75 @@ type GetDatasetUploadResponses = {
|
|
|
2370
2546
|
200: DatasetUploadState;
|
|
2371
2547
|
};
|
|
2372
2548
|
type GetDatasetUploadResponse = GetDatasetUploadResponses[keyof GetDatasetUploadResponses];
|
|
2549
|
+
type ImportDatasetData = {
|
|
2550
|
+
/**
|
|
2551
|
+
* What to fetch, and where from
|
|
2552
|
+
*/
|
|
2553
|
+
body: DatasetImportRequest;
|
|
2554
|
+
path?: never;
|
|
2555
|
+
query?: never;
|
|
2556
|
+
url: "/datasets/imports";
|
|
2557
|
+
};
|
|
2558
|
+
type ImportDatasetErrors = {
|
|
2559
|
+
/**
|
|
2560
|
+
* Invalid request; `instrument` isn't a plain spot pair; `from >= to`; `cadence` present
|
|
2561
|
+
* but not one of its supported values; the requested range exceeds your tier's import
|
|
2562
|
+
* range ceiling; the requested range's rough size estimate exceeds your tier's row limit;
|
|
2563
|
+
* `dex.network`/`dex.id` not one of their supported values; `dex.contract`/`dex.factory`
|
|
2564
|
+
* fail basic shape validation; or, when `cadence` is omitted, `dex.id`/`dex.version`
|
|
2565
|
+
* missing. Whether the pool/pair actually exists and resolves — and, for a candle
|
|
2566
|
+
* `cadence`, whether that combination is actually servable on the requested `network` —
|
|
2567
|
+
* is checked later, asynchronously — see the `failed` status on the poll endpoint below.
|
|
2568
|
+
*
|
|
2569
|
+
*/
|
|
2570
|
+
400: ResponseError;
|
|
2571
|
+
/**
|
|
2572
|
+
* You already have a dataset with this `name`
|
|
2573
|
+
*/
|
|
2574
|
+
409: ResponseError;
|
|
2575
|
+
/**
|
|
2576
|
+
* Your tier's dataset count limit is reached. Delete one, or upgrade.
|
|
2577
|
+
*/
|
|
2578
|
+
429: ResponseError;
|
|
2579
|
+
};
|
|
2580
|
+
type ImportDatasetError = ImportDatasetErrors[keyof ImportDatasetErrors];
|
|
2581
|
+
type ImportDatasetResponses = {
|
|
2582
|
+
/**
|
|
2583
|
+
* Dataset created, fetch started
|
|
2584
|
+
*/
|
|
2585
|
+
202: DatasetImportCreated;
|
|
2586
|
+
};
|
|
2587
|
+
type ImportDatasetResponse = ImportDatasetResponses[keyof ImportDatasetResponses];
|
|
2588
|
+
type GetDatasetImportData = {
|
|
2589
|
+
body?: never;
|
|
2590
|
+
path: {
|
|
2591
|
+
/**
|
|
2592
|
+
* The id returned by `POST /datasets/imports`
|
|
2593
|
+
*/
|
|
2594
|
+
datasetId: string;
|
|
2595
|
+
/**
|
|
2596
|
+
* The `importId` returned by `POST /datasets/imports`
|
|
2597
|
+
*/
|
|
2598
|
+
importId: string;
|
|
2599
|
+
};
|
|
2600
|
+
query?: never;
|
|
2601
|
+
url: "/datasets/{datasetId}/imports/{importId}";
|
|
2602
|
+
};
|
|
2603
|
+
type GetDatasetImportErrors = {
|
|
2604
|
+
/**
|
|
2605
|
+
* No such dataset for this user, or genuinely nothing is known about this `importId`.
|
|
2606
|
+
*
|
|
2607
|
+
*/
|
|
2608
|
+
404: ResponseError;
|
|
2609
|
+
};
|
|
2610
|
+
type GetDatasetImportError = GetDatasetImportErrors[keyof GetDatasetImportErrors];
|
|
2611
|
+
type GetDatasetImportResponses = {
|
|
2612
|
+
/**
|
|
2613
|
+
* Current fetch/ingest state
|
|
2614
|
+
*/
|
|
2615
|
+
200: DatasetImportState;
|
|
2616
|
+
};
|
|
2617
|
+
type GetDatasetImportResponse = GetDatasetImportResponses[keyof GetDatasetImportResponses];
|
|
2373
2618
|
type ClientOptions = {
|
|
2374
2619
|
baseUrl: "https://api.qtsurfer.net/v1" | "https://api.qtsurfer.com/v1" | (string & {});
|
|
2375
2620
|
};
|
|
@@ -2716,15 +2961,22 @@ declare const getSweepRunEquityCurve: <ThrowOnError extends boolean = false>(opt
|
|
|
2716
2961
|
* backtest result with the curve included.
|
|
2717
2962
|
*
|
|
2718
2963
|
* The same request (same `prepareJobId`, `strategyId`, `storeSignals`, `equityCurve`,
|
|
2719
|
-
* `params`) always returns the same `jobId` (idempotent) — a request that omits
|
|
2720
|
-
* or `params` dedupes exactly as it did before those fields
|
|
2721
|
-
* vectors over one prepare are two different jobs, and `9`
|
|
2964
|
+
* `baseConfig`, `params`) always returns the same `jobId` (idempotent) — a request that omits
|
|
2965
|
+
* `equityCurve`, `baseConfig` or `params` dedupes exactly as it did before those fields
|
|
2966
|
+
* existed. Two different `params` vectors over one prepare are two different jobs, and `9`
|
|
2967
|
+
* and `9.0` are the same one.
|
|
2722
2968
|
*
|
|
2723
2969
|
* The re-run is an independent execution rather than a replay of the sweep trial — the two
|
|
2724
2970
|
* paths do not share a simulator — but they are pinned to agree: one vector run both ways
|
|
2725
2971
|
* matches on every leaderboard metric, asserted as a regression test. Treat a difference as a
|
|
2726
2972
|
* bug worth reporting, not as expected behaviour.
|
|
2727
2973
|
*
|
|
2974
|
+
* Optionally takes `baseConfig`, the same `SweepBaseConfig` shape `executeSweep` accepts —
|
|
2975
|
+
* `initialFunding`, `feeRate`, `percentAmountToLock`, etc. — so the same object can be reused
|
|
2976
|
+
* against either endpoint. This endpoint has one effective fee rate rather than a sweep's
|
|
2977
|
+
* independent buy/sell legs: a `baseConfig` that resolves to different buy/sell rates, or sets
|
|
2978
|
+
* a non-default `feeLeg`, is rejected with `400` rather than silently collapsed to one side.
|
|
2979
|
+
*
|
|
2728
2980
|
* Works unchanged for a dataset-backed prepare (`exchangeId: user`) — the request body is
|
|
2729
2981
|
* identical either way, since the instrument and range are recovered from `prepareJobId`.
|
|
2730
2982
|
*
|
|
@@ -2848,7 +3100,41 @@ declare const finalizeDatasetUpload: <ThrowOnError extends boolean = false>(opti
|
|
|
2848
3100
|
*
|
|
2849
3101
|
*/
|
|
2850
3102
|
declare const getDatasetUpload: <ThrowOnError extends boolean = false>(options: Options<GetDatasetUploadData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<DatasetUploadState, ResponseError, ThrowOnError>;
|
|
3103
|
+
/**
|
|
3104
|
+
* Create a dataset by importing history instead of uploading it
|
|
3105
|
+
* A second way to get data into a dataset, alongside `POST /datasets`: instead of `PUT`ting a
|
|
3106
|
+
* file yourself, ask the API to go fetch history on your behalf. Creates the dataset and
|
|
3107
|
+
* starts the fetch in the same call — there is no separate upload step, and the result lands
|
|
3108
|
+
* as a dataset version indistinguishable from an uploaded one once it's ready. Poll
|
|
3109
|
+
* `GET /datasets/{datasetId}/imports/{importId}` for progress.
|
|
3110
|
+
*
|
|
3111
|
+
* `type` selects the source. `dex` — history over a pool/pair's own on-chain market — is the
|
|
3112
|
+
* only value today; other source types join this same endpoint later.
|
|
3113
|
+
*
|
|
3114
|
+
* A `dex` import has two data shapes, chosen by the top-level `cadence`:
|
|
3115
|
+
*
|
|
3116
|
+
* * Omitted/blank (default) — on-chain swap history, replayed directly from the pool/pair's
|
|
3117
|
+
* own chain. Cadence is native, not resampled: each swap keeps the timestamp it happened
|
|
3118
|
+
* at rather than being bucketed into candles, so the resulting version's `cadence` is `rt`
|
|
3119
|
+
* unless the swaps happen to sit on a fixed grid (see `DatasetVersion.cadence`).
|
|
3120
|
+
* * One of `1s` / `1m` / `5m` — pre-aggregated candles at that width instead of raw trades.
|
|
3121
|
+
* The resulting dataset's `type` is `klines`, not `ticker`. Not every network supports every
|
|
3122
|
+
* cadence yet — an unsupported combination fails asynchronously, same as an unresolvable
|
|
3123
|
+
* pool (see the `failed` status on the poll endpoint below).
|
|
3124
|
+
*
|
|
3125
|
+
*/
|
|
3126
|
+
declare const importDataset: <ThrowOnError extends boolean = false>(options: Options<ImportDatasetData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<DatasetImportCreated, ResponseError, ThrowOnError>;
|
|
3127
|
+
/**
|
|
3128
|
+
* Get the state of an import/ingest
|
|
3129
|
+
* Poll after `POST /datasets/imports` until `status` is `ready` or `failed`. An import spends
|
|
3130
|
+
* real time fetching from its source before anything is even staged — `fetching` is the one
|
|
3131
|
+
* status only an import ever reports; `ingesting`/`ready`/`failed` mean exactly what they do
|
|
3132
|
+
* on `GET /datasets/{datasetId}/uploads/{uploadId}`, since an import re-enters that same
|
|
3133
|
+
* ingest chain once it has fetched and staged its data.
|
|
3134
|
+
*
|
|
3135
|
+
*/
|
|
3136
|
+
declare const getDatasetImport: <ThrowOnError extends boolean = false>(options: Options<GetDatasetImportData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<DatasetImportState, ResponseError, ThrowOnError>;
|
|
2851
3137
|
|
|
2852
3138
|
declare const client: _hey_api_client_fetch.Client;
|
|
2853
3139
|
|
|
2854
|
-
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 CreateDatasetData, type CreateDatasetError, type CreateDatasetErrors, type CreateDatasetResponse, type CreateDatasetResponses, type DataSourceType, type Dataset, type DatasetCreated, type DatasetUploadSession, type DatasetUploadState, type DatasetUploadTarget, type DatasetVersion, type DatasetWithLinks, type DeclaredProperty, type DeleteDatasetData, type DeleteDatasetError, type DeleteDatasetErrors, type DeleteDatasetResponse, type DeleteDatasetResponses, type DeleteStrategyData, type DeleteStrategyError, type DeleteStrategyErrors, type DeleteStrategyResponse, type DeleteStrategyResponses, type DownloadKlinesData, type DownloadKlinesError, type DownloadKlinesErrors, type DownloadKlinesResponse, type DownloadKlinesResponses, type DownloadTickersData, type DownloadTickersError, type DownloadTickersErrors, type DownloadTickersResponse, type DownloadTickersResponses, type EquityCurveMeta, type EquityCurveOptions, type EquityCurveOutMode, type EquityCurveRequest, type EquityCurveResult, 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 FinalizeDatasetUploadData, type FinalizeDatasetUploadError, type FinalizeDatasetUploadErrors, type FinalizeDatasetUploadResponse, type FinalizeDatasetUploadResponses, type GetBacktestResultData, type GetBacktestResultError, type GetBacktestResultErrors, type GetBacktestResultResponse, type GetBacktestResultResponses, type GetDatasetData, type GetDatasetError, type GetDatasetErrors, type GetDatasetResponse, type GetDatasetResponses, type GetDatasetUploadData, type GetDatasetUploadError, type GetDatasetUploadErrors, type GetDatasetUploadResponse, type GetDatasetUploadResponses, type GetPrepareStatusData, type GetPrepareStatusError, type GetPrepareStatusErrors, type GetPrepareStatusResponse, type GetPrepareStatusResponses, type GetStrategyCodeData, type GetStrategyCodeError, type GetStrategyCodeErrors, type GetStrategyCodeResponse, type GetStrategyCodeResponses, type GetStrategyData, type GetStrategyError, type GetStrategyErrors, type GetStrategyResponse, type GetStrategyResponses, type GetSweepResultData, type GetSweepResultError, type GetSweepResultErrors, type GetSweepResultResponse, type GetSweepResultResponses, type GetSweepRunEquityCurveData, type GetSweepRunEquityCurveError, type GetSweepRunEquityCurveErrors, type GetSweepRunEquityCurveResponse, type GetSweepRunEquityCurveResponses, type GetSweepSensitivityData, type GetSweepSensitivityError, type GetSweepSensitivityErrors, type GetSweepSensitivityResponse, type GetSweepSensitivityResponses, type HalLink, type Instrument, type InstrumentCoverage, type InstrumentDetail, type InstrumentLinks, type InstrumentListMeta, type InstrumentListResponse, type JobState, type ListDatasetsData, type ListDatasetsResponse, type ListDatasetsResponses, 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 ListStrategiesData, type ListStrategiesResponse, type ListStrategiesResponses, type Notice, type OpenDatasetUploadData, type OpenDatasetUploadError, type OpenDatasetUploadErrors, type OpenDatasetUploadResponse, type OpenDatasetUploadResponses, type Options, type PrepareBacktestData, type PrepareBacktestError, type PrepareBacktestErrors, type PrepareBacktestResponse, type PrepareBacktestResponses, type PrepareJobState, type PrepareRequest, type ResponseError, type ResultMap, type ScalarStrategyParamValue, type StrategyId, type StrategyLinks, type StrategyState, type StrategySummary, type SweepAxis, type SweepBaseConfig, type SweepHeatmap, type SweepHeatmapCell, type SweepMarginal, type SweepMarginalPoint, type SweepProgress, type SweepRunRow, type SweepSensitivity, type SweepSpecRequest, type ValidateStrategyData, type ValidateStrategyError, type ValidateStrategyErrors, type ValidateStrategyResponse, type ValidateStrategyResponses, type WalkForwardAccepted, type WalkForwardFold, type WalkForwardRequest, type WalkForwardResult, authenticate, cancelBacktest, cancelSweep, client, compileStrategy, createDataset, deleteDataset, deleteStrategy, downloadKlines, downloadTickers, executeBacktest, executeSweep, finalizeDatasetUpload, getBacktestResult, getDataset, getDatasetUpload, getPrepareStatus, getStrategy, getStrategyCode, getSweepResult, getSweepRunEquityCurve, getSweepSensitivity, listDatasets, listExchanges, listInstruments, listSegmentInstruments, listStrategies, openDatasetUpload, prepareBacktest, validateStrategy };
|
|
3140
|
+
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 CreateDatasetData, type CreateDatasetError, type CreateDatasetErrors, type CreateDatasetResponse, type CreateDatasetResponses, type DataSourceType, type Dataset, type DatasetCreated, type DatasetImportCreated, type DatasetImportDexRequest, type DatasetImportRequest, type DatasetImportState, type DatasetUploadSession, type DatasetUploadState, type DatasetUploadTarget, type DatasetVersion, type DatasetWithLinks, type DeclaredProperty, type DeleteDatasetData, type DeleteDatasetError, type DeleteDatasetErrors, type DeleteDatasetResponse, type DeleteDatasetResponses, type DeleteStrategyData, type DeleteStrategyError, type DeleteStrategyErrors, type DeleteStrategyResponse, type DeleteStrategyResponses, type DownloadKlinesData, type DownloadKlinesError, type DownloadKlinesErrors, type DownloadKlinesResponse, type DownloadKlinesResponses, type DownloadTickersData, type DownloadTickersError, type DownloadTickersErrors, type DownloadTickersResponse, type DownloadTickersResponses, type EquityCurveMeta, type EquityCurveOptions, type EquityCurveOutMode, type EquityCurveRequest, type EquityCurveResult, 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 FinalizeDatasetUploadData, type FinalizeDatasetUploadError, type FinalizeDatasetUploadErrors, type FinalizeDatasetUploadResponse, type FinalizeDatasetUploadResponses, type GetBacktestResultData, type GetBacktestResultError, type GetBacktestResultErrors, type GetBacktestResultResponse, type GetBacktestResultResponses, type GetDatasetData, type GetDatasetError, type GetDatasetErrors, type GetDatasetImportData, type GetDatasetImportError, type GetDatasetImportErrors, type GetDatasetImportResponse, type GetDatasetImportResponses, type GetDatasetResponse, type GetDatasetResponses, type GetDatasetUploadData, type GetDatasetUploadError, type GetDatasetUploadErrors, type GetDatasetUploadResponse, type GetDatasetUploadResponses, type GetPrepareStatusData, type GetPrepareStatusError, type GetPrepareStatusErrors, type GetPrepareStatusResponse, type GetPrepareStatusResponses, type GetStrategyCodeData, type GetStrategyCodeError, type GetStrategyCodeErrors, type GetStrategyCodeResponse, type GetStrategyCodeResponses, type GetStrategyData, type GetStrategyError, type GetStrategyErrors, type GetStrategyResponse, type GetStrategyResponses, type GetSweepResultData, type GetSweepResultError, type GetSweepResultErrors, type GetSweepResultResponse, type GetSweepResultResponses, type GetSweepRunEquityCurveData, type GetSweepRunEquityCurveError, type GetSweepRunEquityCurveErrors, type GetSweepRunEquityCurveResponse, type GetSweepRunEquityCurveResponses, type GetSweepSensitivityData, type GetSweepSensitivityError, type GetSweepSensitivityErrors, type GetSweepSensitivityResponse, type GetSweepSensitivityResponses, type HalLink, type ImportDatasetData, type ImportDatasetError, type ImportDatasetErrors, type ImportDatasetResponse, type ImportDatasetResponses, type Instrument, type InstrumentCoverage, type InstrumentDetail, type InstrumentLinks, type InstrumentListMeta, type InstrumentListResponse, type JobState, type ListDatasetsData, type ListDatasetsResponse, type ListDatasetsResponses, 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 ListStrategiesData, type ListStrategiesResponse, type ListStrategiesResponses, type Notice, type OpenDatasetUploadData, type OpenDatasetUploadError, type OpenDatasetUploadErrors, type OpenDatasetUploadResponse, type OpenDatasetUploadResponses, type Options, type PrepareBacktestData, type PrepareBacktestError, type PrepareBacktestErrors, type PrepareBacktestResponse, type PrepareBacktestResponses, type PrepareJobState, type PrepareRequest, type ResponseError, type ResultMap, type ScalarStrategyParamValue, type StrategyId, type StrategyLinks, type StrategyState, type StrategySummary, type SweepAxis, type SweepBaseConfig, type SweepHeatmap, type SweepHeatmapCell, type SweepMarginal, type SweepMarginalPoint, type SweepProgress, type SweepRunRow, type SweepSensitivity, type SweepSpecRequest, type ValidateStrategyData, type ValidateStrategyError, type ValidateStrategyErrors, type ValidateStrategyResponse, type ValidateStrategyResponses, type WalkForwardAccepted, type WalkForwardFold, type WalkForwardRequest, type WalkForwardResult, authenticate, cancelBacktest, cancelSweep, client, compileStrategy, createDataset, deleteDataset, deleteStrategy, downloadKlines, downloadTickers, executeBacktest, executeSweep, finalizeDatasetUpload, getBacktestResult, getDataset, getDatasetImport, getDatasetUpload, getPrepareStatus, getStrategy, getStrategyCode, getSweepResult, getSweepRunEquityCurve, getSweepSensitivity, importDataset, listDatasets, listExchanges, listInstruments, listSegmentInstruments, listStrategies, openDatasetUpload, prepareBacktest, validateStrategy };
|
package/dist/index.js
CHANGED
|
@@ -349,6 +349,34 @@ var getDatasetUpload = (options) => {
|
|
|
349
349
|
...options
|
|
350
350
|
});
|
|
351
351
|
};
|
|
352
|
+
var importDataset = (options) => {
|
|
353
|
+
return (options.client ?? client).post({
|
|
354
|
+
security: [
|
|
355
|
+
{
|
|
356
|
+
scheme: "bearer",
|
|
357
|
+
type: "http"
|
|
358
|
+
}
|
|
359
|
+
],
|
|
360
|
+
url: "/datasets/imports",
|
|
361
|
+
...options,
|
|
362
|
+
headers: {
|
|
363
|
+
"Content-Type": "application/json",
|
|
364
|
+
...options?.headers
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
};
|
|
368
|
+
var getDatasetImport = (options) => {
|
|
369
|
+
return (options.client ?? client).get({
|
|
370
|
+
security: [
|
|
371
|
+
{
|
|
372
|
+
scheme: "bearer",
|
|
373
|
+
type: "http"
|
|
374
|
+
}
|
|
375
|
+
],
|
|
376
|
+
url: "/datasets/{datasetId}/imports/{importId}",
|
|
377
|
+
...options
|
|
378
|
+
});
|
|
379
|
+
};
|
|
352
380
|
export {
|
|
353
381
|
authenticate,
|
|
354
382
|
cancelBacktest,
|
|
@@ -365,6 +393,7 @@ export {
|
|
|
365
393
|
finalizeDatasetUpload,
|
|
366
394
|
getBacktestResult,
|
|
367
395
|
getDataset,
|
|
396
|
+
getDatasetImport,
|
|
368
397
|
getDatasetUpload,
|
|
369
398
|
getPrepareStatus,
|
|
370
399
|
getStrategy,
|
|
@@ -372,6 +401,7 @@ export {
|
|
|
372
401
|
getSweepResult,
|
|
373
402
|
getSweepRunEquityCurve,
|
|
374
403
|
getSweepSensitivity,
|
|
404
|
+
importDataset,
|
|
375
405
|
listDatasets,
|
|
376
406
|
listExchanges,
|
|
377
407
|
listInstruments,
|