@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/src/generated/sdk.gen.ts
CHANGED
|
@@ -90,6 +90,12 @@ import type {
|
|
|
90
90
|
GetDatasetUploadData,
|
|
91
91
|
GetDatasetUploadResponse,
|
|
92
92
|
GetDatasetUploadError,
|
|
93
|
+
ImportDatasetData,
|
|
94
|
+
ImportDatasetResponse,
|
|
95
|
+
ImportDatasetError,
|
|
96
|
+
GetDatasetImportData,
|
|
97
|
+
GetDatasetImportResponse,
|
|
98
|
+
GetDatasetImportError,
|
|
93
99
|
} from "./types.gen";
|
|
94
100
|
import { client as _heyApiClient } from "./client.gen";
|
|
95
101
|
|
|
@@ -750,15 +756,22 @@ export const getSweepRunEquityCurve = <ThrowOnError extends boolean = false>(
|
|
|
750
756
|
* backtest result with the curve included.
|
|
751
757
|
*
|
|
752
758
|
* The same request (same `prepareJobId`, `strategyId`, `storeSignals`, `equityCurve`,
|
|
753
|
-
* `params`) always returns the same `jobId` (idempotent) — a request that omits
|
|
754
|
-
* or `params` dedupes exactly as it did before those fields
|
|
755
|
-
* vectors over one prepare are two different jobs, and `9`
|
|
759
|
+
* `baseConfig`, `params`) always returns the same `jobId` (idempotent) — a request that omits
|
|
760
|
+
* `equityCurve`, `baseConfig` or `params` dedupes exactly as it did before those fields
|
|
761
|
+
* existed. Two different `params` vectors over one prepare are two different jobs, and `9`
|
|
762
|
+
* and `9.0` are the same one.
|
|
756
763
|
*
|
|
757
764
|
* The re-run is an independent execution rather than a replay of the sweep trial — the two
|
|
758
765
|
* paths do not share a simulator — but they are pinned to agree: one vector run both ways
|
|
759
766
|
* matches on every leaderboard metric, asserted as a regression test. Treat a difference as a
|
|
760
767
|
* bug worth reporting, not as expected behaviour.
|
|
761
768
|
*
|
|
769
|
+
* Optionally takes `baseConfig`, the same `SweepBaseConfig` shape `executeSweep` accepts —
|
|
770
|
+
* `initialFunding`, `feeRate`, `percentAmountToLock`, etc. — so the same object can be reused
|
|
771
|
+
* against either endpoint. This endpoint has one effective fee rate rather than a sweep's
|
|
772
|
+
* independent buy/sell legs: a `baseConfig` that resolves to different buy/sell rates, or sets
|
|
773
|
+
* a non-default `feeLeg`, is rejected with `400` rather than silently collapsed to one side.
|
|
774
|
+
*
|
|
762
775
|
* Works unchanged for a dataset-backed prepare (`exchangeId: user`) — the request body is
|
|
763
776
|
* identical either way, since the instrument and range are recovered from `prepareJobId`.
|
|
764
777
|
*
|
|
@@ -1059,3 +1072,77 @@ export const getDatasetUpload = <ThrowOnError extends boolean = false>(
|
|
|
1059
1072
|
...options,
|
|
1060
1073
|
});
|
|
1061
1074
|
};
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* Create a dataset by importing history instead of uploading it
|
|
1078
|
+
* A second way to get data into a dataset, alongside `POST /datasets`: instead of `PUT`ting a
|
|
1079
|
+
* file yourself, ask the API to go fetch history on your behalf. Creates the dataset and
|
|
1080
|
+
* starts the fetch in the same call — there is no separate upload step, and the result lands
|
|
1081
|
+
* as a dataset version indistinguishable from an uploaded one once it's ready. Poll
|
|
1082
|
+
* `GET /datasets/{datasetId}/imports/{importId}` for progress.
|
|
1083
|
+
*
|
|
1084
|
+
* `type` selects the source. `dex` — history over a pool/pair's own on-chain market — is the
|
|
1085
|
+
* only value today; other source types join this same endpoint later.
|
|
1086
|
+
*
|
|
1087
|
+
* A `dex` import has two data shapes, chosen by the top-level `cadence`:
|
|
1088
|
+
*
|
|
1089
|
+
* * Omitted/blank (default) — on-chain swap history, replayed directly from the pool/pair's
|
|
1090
|
+
* own chain. Cadence is native, not resampled: each swap keeps the timestamp it happened
|
|
1091
|
+
* at rather than being bucketed into candles, so the resulting version's `cadence` is `rt`
|
|
1092
|
+
* unless the swaps happen to sit on a fixed grid (see `DatasetVersion.cadence`).
|
|
1093
|
+
* * One of `1s` / `1m` / `5m` — pre-aggregated candles at that width instead of raw trades.
|
|
1094
|
+
* The resulting dataset's `type` is `klines`, not `ticker`. Not every network supports every
|
|
1095
|
+
* cadence yet — an unsupported combination fails asynchronously, same as an unresolvable
|
|
1096
|
+
* pool (see the `failed` status on the poll endpoint below).
|
|
1097
|
+
*
|
|
1098
|
+
*/
|
|
1099
|
+
export const importDataset = <ThrowOnError extends boolean = false>(
|
|
1100
|
+
options: Options<ImportDatasetData, ThrowOnError>
|
|
1101
|
+
) => {
|
|
1102
|
+
return (options.client ?? _heyApiClient).post<
|
|
1103
|
+
ImportDatasetResponse,
|
|
1104
|
+
ImportDatasetError,
|
|
1105
|
+
ThrowOnError
|
|
1106
|
+
>({
|
|
1107
|
+
security: [
|
|
1108
|
+
{
|
|
1109
|
+
scheme: "bearer",
|
|
1110
|
+
type: "http",
|
|
1111
|
+
},
|
|
1112
|
+
],
|
|
1113
|
+
url: "/datasets/imports",
|
|
1114
|
+
...options,
|
|
1115
|
+
headers: {
|
|
1116
|
+
"Content-Type": "application/json",
|
|
1117
|
+
...options?.headers,
|
|
1118
|
+
},
|
|
1119
|
+
});
|
|
1120
|
+
};
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* Get the state of an import/ingest
|
|
1124
|
+
* Poll after `POST /datasets/imports` until `status` is `ready` or `failed`. An import spends
|
|
1125
|
+
* real time fetching from its source before anything is even staged — `fetching` is the one
|
|
1126
|
+
* status only an import ever reports; `ingesting`/`ready`/`failed` mean exactly what they do
|
|
1127
|
+
* on `GET /datasets/{datasetId}/uploads/{uploadId}`, since an import re-enters that same
|
|
1128
|
+
* ingest chain once it has fetched and staged its data.
|
|
1129
|
+
*
|
|
1130
|
+
*/
|
|
1131
|
+
export const getDatasetImport = <ThrowOnError extends boolean = false>(
|
|
1132
|
+
options: Options<GetDatasetImportData, ThrowOnError>
|
|
1133
|
+
) => {
|
|
1134
|
+
return (options.client ?? _heyApiClient).get<
|
|
1135
|
+
GetDatasetImportResponse,
|
|
1136
|
+
GetDatasetImportError,
|
|
1137
|
+
ThrowOnError
|
|
1138
|
+
>({
|
|
1139
|
+
security: [
|
|
1140
|
+
{
|
|
1141
|
+
scheme: "bearer",
|
|
1142
|
+
type: "http",
|
|
1143
|
+
},
|
|
1144
|
+
],
|
|
1145
|
+
url: "/datasets/{datasetId}/imports/{importId}",
|
|
1146
|
+
...options,
|
|
1147
|
+
});
|
|
1148
|
+
};
|
|
@@ -228,29 +228,22 @@ export type PrepareRequest = {
|
|
|
228
228
|
*/
|
|
229
229
|
to: string;
|
|
230
230
|
/**
|
|
231
|
-
* Output bar cadence for the prepared range.
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
| "2h"
|
|
248
|
-
| "4h"
|
|
249
|
-
| "8h"
|
|
250
|
-
| "12h"
|
|
251
|
-
| "1d"
|
|
252
|
-
| "1w"
|
|
253
|
-
| "1q";
|
|
231
|
+
* Output bar cadence for the prepared range. Coarser cadences are produced on demand by
|
|
232
|
+
* resampling the source and stored alongside the native blob in cache. A target finer
|
|
233
|
+
* than the source, or not an exact multiple of it, returns `400`. What's accepted, and
|
|
234
|
+
* what omitting it means, depends on the source:
|
|
235
|
+
*
|
|
236
|
+
* * Managed exchange — one of `1s`, `5s`, `1m`, `3m`, `5m`, `15m`, `30m`, `1h`, `2h`,
|
|
237
|
+
* `4h`, `8h`, `12h`, `1d`, `1w`, `1q`; any other label returns `400`. Omitted = `1s`,
|
|
238
|
+
* the publisher's native cadence.
|
|
239
|
+
* * Dataset (`exchangeId: user`) — omitted = the dataset version's own discovered
|
|
240
|
+
* `cadence` (see `DatasetVersion.cadence`), served as-is. Any cadence equal to or
|
|
241
|
+
* coarser than it and an exact multiple of it is accepted, including ones outside the
|
|
242
|
+
* managed-exchange list (e.g. `15s`); an `rt` dataset can be resampled to any fixed
|
|
243
|
+
* cadence.
|
|
244
|
+
*
|
|
245
|
+
*/
|
|
246
|
+
cadence?: string;
|
|
254
247
|
};
|
|
255
248
|
|
|
256
249
|
/**
|
|
@@ -265,7 +258,8 @@ export type JobState = {
|
|
|
265
258
|
* Current status of the job. Treat `Completed | Aborted | Failed` as
|
|
266
259
|
* terminal; `New | Started` mean keep polling. A single-instrument prepare
|
|
267
260
|
* is always terminal (`Completed`) — decide from
|
|
268
|
-
* `PrepareJobState.coverageRatio
|
|
261
|
+
* `PrepareJobState.coverageRatio` (or `dataFrom`/`dataTo` against an `rt` dataset,
|
|
262
|
+
* which has no ratio), not by polling.
|
|
269
263
|
*
|
|
270
264
|
*/
|
|
271
265
|
status: "New" | "Started" | "Completed" | "Aborted" | "Failed";
|
|
@@ -303,8 +297,10 @@ export type JobState = {
|
|
|
303
297
|
* dataset-backed prepare (`exchangeId: user`), coverage is reported on the dataset's own
|
|
304
298
|
* cadence grid instead — hour-walking a daily dataset would report `1/24` and read as
|
|
305
299
|
* broken — via `cadence`/`gaps`/`largestGapSteps`; `totalHours`/`hoursWithData`/
|
|
306
|
-
* `hoursWithoutData` are absent in that case. `dataFrom`/`dataTo
|
|
307
|
-
*
|
|
300
|
+
* `hoursWithoutData` are absent in that case. `dataFrom`/`dataTo` are present either way, and
|
|
301
|
+
* `coverageRatio` too, computed accordingly — except against a dataset whose `cadence` is `rt`:
|
|
302
|
+
* with no fixed step there is no expected row count to measure against, so `coverageRatio`
|
|
303
|
+
* is absent and `gaps`/`largestGapSteps` are `0`.
|
|
308
304
|
*
|
|
309
305
|
*/
|
|
310
306
|
export type PrepareJobState = JobState & {
|
|
@@ -321,7 +317,8 @@ export type PrepareJobState = JobState & {
|
|
|
321
317
|
* `totalHours` is 0), the fraction of hours in the requested range that have served
|
|
322
318
|
* data. Against a dataset (`exchangeId: user`): `rows / expectedStepsAtCadence`
|
|
323
319
|
* over the dataset version's own range — echoing what ingest computed once, not
|
|
324
|
-
* recomputed against a narrower prepare request.
|
|
320
|
+
* recomputed against a narrower prepare request. Absent for an `rt` dataset (no
|
|
321
|
+
* fixed step, so no expected row count).
|
|
325
322
|
*
|
|
326
323
|
*/
|
|
327
324
|
coverageRatio?: number;
|
|
@@ -338,20 +335,21 @@ export type PrepareJobState = JobState & {
|
|
|
338
335
|
*/
|
|
339
336
|
hoursWithData?: number;
|
|
340
337
|
/**
|
|
341
|
-
* The dataset version's own discovered cadence (e.g. `1m`, `1h`)
|
|
342
|
-
*
|
|
338
|
+
* The dataset version's own discovered cadence — a fixed grid (e.g. `1m`, `1h`) or
|
|
339
|
+
* `rt` (see `DatasetVersion.cadence`). Only present for a dataset-backed prepare
|
|
340
|
+
* (`exchangeId: user`).
|
|
343
341
|
*
|
|
344
342
|
*/
|
|
345
343
|
cadence?: string;
|
|
346
344
|
/**
|
|
347
345
|
* Number of gaps in the dataset version at its own cadence, as discovered at ingest
|
|
348
|
-
* time. Only present for a dataset-backed prepare.
|
|
346
|
+
* time. `0` for `rt`. Only present for a dataset-backed prepare.
|
|
349
347
|
*
|
|
350
348
|
*/
|
|
351
349
|
gaps?: number;
|
|
352
350
|
/**
|
|
353
|
-
* The largest gap in the dataset version, in units of its own cadence step.
|
|
354
|
-
* present for a dataset-backed prepare.
|
|
351
|
+
* The largest gap in the dataset version, in units of its own cadence step. `0` for
|
|
352
|
+
* `rt`. Only present for a dataset-backed prepare.
|
|
355
353
|
*
|
|
356
354
|
*/
|
|
357
355
|
largestGapSteps?: number;
|
|
@@ -1182,9 +1180,12 @@ export type Dataset = {
|
|
|
1182
1180
|
*/
|
|
1183
1181
|
name: string;
|
|
1184
1182
|
/**
|
|
1185
|
-
*
|
|
1183
|
+
* `ticker` for an upload or a `dex` import with no `cadence` requested (native per-trade
|
|
1184
|
+
* data). `klines` for a `dex` import that requested a candle `cadence` — pre-aggregated
|
|
1185
|
+
* bars rather than raw ticks. Purely informational; both shapes are read the same way.
|
|
1186
|
+
*
|
|
1186
1187
|
*/
|
|
1187
|
-
type: "ticker";
|
|
1188
|
+
type: "ticker" | "klines";
|
|
1188
1189
|
instrument: Instrument;
|
|
1189
1190
|
/**
|
|
1190
1191
|
* When the dataset was created.
|
|
@@ -1213,8 +1214,8 @@ export type Dataset = {
|
|
|
1213
1214
|
*/
|
|
1214
1215
|
to?: string;
|
|
1215
1216
|
/**
|
|
1216
|
-
* `currentVersionId`'s own discovered
|
|
1217
|
-
* version exists.
|
|
1217
|
+
* `currentVersionId`'s own discovered cadence — a fixed grid (e.g. `1s`, `1m`, `1h`) or
|
|
1218
|
+
* `rt` (see `DatasetVersion.cadence`). Absent until a version exists.
|
|
1218
1219
|
*
|
|
1219
1220
|
*/
|
|
1220
1221
|
cadence?: string;
|
|
@@ -1324,7 +1325,13 @@ export type DatasetVersion = {
|
|
|
1324
1325
|
*/
|
|
1325
1326
|
rows?: number;
|
|
1326
1327
|
/**
|
|
1327
|
-
* The discovered
|
|
1328
|
+
* The cadence discovered from the data's own timestamps. Either a fixed grid — `1s`,
|
|
1329
|
+
* `5s`, `15s`, `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1d` — when at least half the
|
|
1330
|
+
* intervals between consecutive rows fall on that step (small clock jitter tolerated), or
|
|
1331
|
+
* `rt`: native data at the rate it was captured, each row at its own timestamp with no
|
|
1332
|
+
* fixed step — per-trade on-chain swaps, block-spaced or sub-second ticks, irregular
|
|
1333
|
+
* intervals. An `rt` dataset can be resampled to any fixed cadence at prepare time.
|
|
1334
|
+
*
|
|
1328
1335
|
*/
|
|
1329
1336
|
cadence?: string;
|
|
1330
1337
|
/**
|
|
@@ -1334,11 +1341,11 @@ export type DatasetVersion = {
|
|
|
1334
1341
|
*/
|
|
1335
1342
|
timestampUnit?: "iso" | "s" | "ms" | "us";
|
|
1336
1343
|
/**
|
|
1337
|
-
* Number of gaps at the discovered cadence.
|
|
1344
|
+
* Number of gaps at the discovered cadence. Always `0` for `rt`.
|
|
1338
1345
|
*/
|
|
1339
1346
|
gaps?: number;
|
|
1340
1347
|
/**
|
|
1341
|
-
* The largest gap, in units of the discovered cadence step.
|
|
1348
|
+
* The largest gap, in units of the discovered cadence step. Always `0` for `rt`.
|
|
1342
1349
|
*/
|
|
1343
1350
|
largestGapSteps?: number;
|
|
1344
1351
|
/**
|
|
@@ -1381,6 +1388,154 @@ export type DatasetUploadState = {
|
|
|
1381
1388
|
* The ingest job id, while `status` is `ingesting`.
|
|
1382
1389
|
*/
|
|
1383
1390
|
jobId?: string;
|
|
1391
|
+
/**
|
|
1392
|
+
* A human-readable reason, present when `status` is `failed` (e.g. bad CSV contract,
|
|
1393
|
+
* mixed timestamp units, a `.zip` with no file inside or more than one). Durably
|
|
1394
|
+
* recorded alongside the failure itself, so it stays available however long after the
|
|
1395
|
+
* fact you poll — not tied to how recently the failure happened.
|
|
1396
|
+
*
|
|
1397
|
+
*/
|
|
1398
|
+
error?: string;
|
|
1399
|
+
/**
|
|
1400
|
+
* Present when `status` is `ready` or `failed`.
|
|
1401
|
+
*/
|
|
1402
|
+
version?: DatasetVersion;
|
|
1403
|
+
};
|
|
1404
|
+
|
|
1405
|
+
/**
|
|
1406
|
+
* `POST /datasets/imports`'s request body. A common block plus one type-specific block,
|
|
1407
|
+
* selected by `type` — `dex` is the only value today.
|
|
1408
|
+
*
|
|
1409
|
+
*/
|
|
1410
|
+
export type DatasetImportRequest = {
|
|
1411
|
+
/**
|
|
1412
|
+
* A name unique among your datasets. `409` if already taken.
|
|
1413
|
+
*/
|
|
1414
|
+
name: string;
|
|
1415
|
+
instrument: Instrument;
|
|
1416
|
+
/**
|
|
1417
|
+
* Start of the range to fetch, inclusive. Must be before `to`.
|
|
1418
|
+
*/
|
|
1419
|
+
from: string;
|
|
1420
|
+
/**
|
|
1421
|
+
* End of the range to fetch, exclusive. The total span is capped by your tier — a
|
|
1422
|
+
* request wider than that ceiling is `400`, regardless of source type.
|
|
1423
|
+
*
|
|
1424
|
+
*/
|
|
1425
|
+
to: string;
|
|
1426
|
+
/**
|
|
1427
|
+
* Optional. Omitted/blank keeps native per-trade event cadence — each swap at its own
|
|
1428
|
+
* timestamp, so the resulting version's `cadence` is `rt` unless the swaps happen to sit
|
|
1429
|
+
* on a fixed grid (see `DatasetVersion.cadence`). Set to `1s`, `1m` or
|
|
1430
|
+
* `5m` instead to get pre-aggregated candles at that width rather than raw trades (the
|
|
1431
|
+
* resulting dataset's `type` becomes `klines`); any other value is `400`. Not every
|
|
1432
|
+
* network supports every cadence — an unsupported combination fails asynchronously, not
|
|
1433
|
+
* at request time (see `DatasetImportState.error`).
|
|
1434
|
+
*
|
|
1435
|
+
*/
|
|
1436
|
+
cadence?: "1s" | "1m" | "5m";
|
|
1437
|
+
/**
|
|
1438
|
+
* The source to fetch from. `dex` is the only value today.
|
|
1439
|
+
*/
|
|
1440
|
+
type: "dex";
|
|
1441
|
+
dex?: DatasetImportDexRequest;
|
|
1442
|
+
};
|
|
1443
|
+
|
|
1444
|
+
/**
|
|
1445
|
+
* The `dex` source's own fields — required when `type` is `dex`. `id`/`version` are required
|
|
1446
|
+
* for a plain (native-cadence) import; both are ignored if the top-level `cadence` requested
|
|
1447
|
+
* pre-aggregated candles instead, since that path needs neither a protocol nor a version
|
|
1448
|
+
* distinction.
|
|
1449
|
+
*
|
|
1450
|
+
*/
|
|
1451
|
+
export type DatasetImportDexRequest = {
|
|
1452
|
+
/**
|
|
1453
|
+
* Which chain the pool/pair lives on.
|
|
1454
|
+
*/
|
|
1455
|
+
network: "ethereum" | "robinhood";
|
|
1456
|
+
/**
|
|
1457
|
+
* Which on-chain DEX protocol `contract` implements. Required unless the top-level
|
|
1458
|
+
* `cadence` requested pre-aggregated candles, in which case it's ignored.
|
|
1459
|
+
*
|
|
1460
|
+
*/
|
|
1461
|
+
id?: "uniswap";
|
|
1462
|
+
/**
|
|
1463
|
+
* Uniswap version the pool/pair contract implements. Required unless the top-level
|
|
1464
|
+
* `cadence` requested pre-aggregated candles, in which case it's ignored.
|
|
1465
|
+
*
|
|
1466
|
+
*/
|
|
1467
|
+
version?: "v2" | "v3";
|
|
1468
|
+
/**
|
|
1469
|
+
* The pool (v3) or pair (v2) contract address.
|
|
1470
|
+
*/
|
|
1471
|
+
contract: string;
|
|
1472
|
+
/**
|
|
1473
|
+
* The factory that deployed `contract`. Optional — when omitted, it is discovered
|
|
1474
|
+
* on-chain from `contract` itself at fetch time. Supply it explicitly only if you
|
|
1475
|
+
* already know it, or the pool/pair belongs to a factory other than the canonical one
|
|
1476
|
+
* for `network`/`version`. Either way, the pool/pair is validated against whichever
|
|
1477
|
+
* factory is used before anything is fetched — a wrong or unrelated factory fails the
|
|
1478
|
+
* import rather than silently fetching from the wrong pool. Ignored if the top-level
|
|
1479
|
+
* `cadence` requested pre-aggregated candles.
|
|
1480
|
+
*
|
|
1481
|
+
*/
|
|
1482
|
+
factory?: string;
|
|
1483
|
+
};
|
|
1484
|
+
|
|
1485
|
+
/**
|
|
1486
|
+
* The response to `POST /datasets/imports` — the dataset now exists, and its fetch has started.
|
|
1487
|
+
*/
|
|
1488
|
+
export type DatasetImportCreated = {
|
|
1489
|
+
/**
|
|
1490
|
+
* Opaque id of the newly created dataset — same id space as `POST /datasets`.
|
|
1491
|
+
*/
|
|
1492
|
+
datasetId: string;
|
|
1493
|
+
/**
|
|
1494
|
+
* Identifies this import. Pass to `GET /datasets/{datasetId}/imports/{importId}` to poll
|
|
1495
|
+
* it — there is no separate "finalize" step the way an upload has.
|
|
1496
|
+
*
|
|
1497
|
+
*/
|
|
1498
|
+
importId: string;
|
|
1499
|
+
/**
|
|
1500
|
+
* The fetch/ingest job id.
|
|
1501
|
+
*/
|
|
1502
|
+
jobId: string;
|
|
1503
|
+
/**
|
|
1504
|
+
* Always `fetching` in this response — the fetch has only just started.
|
|
1505
|
+
*/
|
|
1506
|
+
status: "fetching";
|
|
1507
|
+
};
|
|
1508
|
+
|
|
1509
|
+
/**
|
|
1510
|
+
* Progress of one import, from fetching through ingest. `fetching` is the one status only an
|
|
1511
|
+
* import ever reports — an upload's file already exists by the time you can poll it; an
|
|
1512
|
+
* import's doesn't, until this source finishes fetching it.
|
|
1513
|
+
*
|
|
1514
|
+
*/
|
|
1515
|
+
export type DatasetImportState = {
|
|
1516
|
+
importId: string;
|
|
1517
|
+
/**
|
|
1518
|
+
* * `fetching` — reading from the source; nothing staged yet.
|
|
1519
|
+
* * `ingesting` — fetch complete, staged, and re-entered the same ingest chain an
|
|
1520
|
+
* upload uses; the worker is parsing and validating it.
|
|
1521
|
+
* * `ready` — ingested successfully. `version` carries the result.
|
|
1522
|
+
* * `failed` — the fetch or the ingest that followed it was rejected. `error` names why.
|
|
1523
|
+
*
|
|
1524
|
+
*/
|
|
1525
|
+
status: "fetching" | "ingesting" | "ready" | "failed";
|
|
1526
|
+
/**
|
|
1527
|
+
* The fetch/ingest job id, while `status` is `fetching` or `ingesting`.
|
|
1528
|
+
*/
|
|
1529
|
+
jobId?: string;
|
|
1530
|
+
/**
|
|
1531
|
+
* A human-readable reason, present when `status` is `failed` — an unresolvable
|
|
1532
|
+
* pool/pair, no data in the requested range, a range older than the configured source
|
|
1533
|
+
* retains, the fetch exceeding your tier's time ceiling, or any of
|
|
1534
|
+
* `DatasetUploadState.error`'s own ingest-side reasons once fetching hands off to it.
|
|
1535
|
+
* Durably recorded, same as on the upload path.
|
|
1536
|
+
*
|
|
1537
|
+
*/
|
|
1538
|
+
error?: string;
|
|
1384
1539
|
/**
|
|
1385
1540
|
* Present when `status` is `ready` or `failed`.
|
|
1386
1541
|
*/
|
|
@@ -1907,8 +2062,8 @@ export type PrepareBacktestErrors = {
|
|
|
1907
2062
|
* Invalid request or parameters. Also returned when `from` is older than the configured
|
|
1908
2063
|
* lookback window or `to` is in the future. For `exchangeId: user`, also returned when
|
|
1909
2064
|
* the dataset's current upload has not finished ingesting, or `cadence` asks for a finer
|
|
1910
|
-
* granularity than the dataset's own discovered cadence
|
|
1911
|
-
* your tier's range limit.
|
|
2065
|
+
* granularity than the dataset's own discovered cadence (or one that isn't an exact
|
|
2066
|
+
* multiple of it), or the requested range exceeds your tier's range limit.
|
|
1912
2067
|
*
|
|
1913
2068
|
*/
|
|
1914
2069
|
400: ResponseError;
|
|
@@ -2218,6 +2373,16 @@ export type ExecuteBacktestData = {
|
|
|
2218
2373
|
*/
|
|
2219
2374
|
storeSignals?: boolean;
|
|
2220
2375
|
equityCurve?: EquityCurveOptions;
|
|
2376
|
+
/**
|
|
2377
|
+
* Capital/fee/position-size overrides for this one run — the same shape
|
|
2378
|
+
* `executeSweep`'s `baseConfig` accepts. Omit to run at the platform defaults
|
|
2379
|
+
* (`initialFunding: 100`, `feeRate: 0.001`). `buyFeeRate`/`sellFeeRate`/`feeLeg`
|
|
2380
|
+
* are accepted for shape compatibility with a sweep's `baseConfig`, but this
|
|
2381
|
+
* endpoint has one fee-rate slot: a value that implies asymmetric buy/sell fees,
|
|
2382
|
+
* or a non-default `feeLeg`, is rejected with `400`.
|
|
2383
|
+
*
|
|
2384
|
+
*/
|
|
2385
|
+
baseConfig?: SweepBaseConfig;
|
|
2221
2386
|
/**
|
|
2222
2387
|
* Strategy properties to apply to this run. Omit to run the strategy's declared
|
|
2223
2388
|
* defaults, which is exactly what a request without this field has always done.
|
|
@@ -2628,6 +2793,88 @@ export type GetDatasetUploadResponses = {
|
|
|
2628
2793
|
export type GetDatasetUploadResponse =
|
|
2629
2794
|
GetDatasetUploadResponses[keyof GetDatasetUploadResponses];
|
|
2630
2795
|
|
|
2796
|
+
export type ImportDatasetData = {
|
|
2797
|
+
/**
|
|
2798
|
+
* What to fetch, and where from
|
|
2799
|
+
*/
|
|
2800
|
+
body: DatasetImportRequest;
|
|
2801
|
+
path?: never;
|
|
2802
|
+
query?: never;
|
|
2803
|
+
url: "/datasets/imports";
|
|
2804
|
+
};
|
|
2805
|
+
|
|
2806
|
+
export type ImportDatasetErrors = {
|
|
2807
|
+
/**
|
|
2808
|
+
* Invalid request; `instrument` isn't a plain spot pair; `from >= to`; `cadence` present
|
|
2809
|
+
* but not one of its supported values; the requested range exceeds your tier's import
|
|
2810
|
+
* range ceiling; the requested range's rough size estimate exceeds your tier's row limit;
|
|
2811
|
+
* `dex.network`/`dex.id` not one of their supported values; `dex.contract`/`dex.factory`
|
|
2812
|
+
* fail basic shape validation; or, when `cadence` is omitted, `dex.id`/`dex.version`
|
|
2813
|
+
* missing. Whether the pool/pair actually exists and resolves — and, for a candle
|
|
2814
|
+
* `cadence`, whether that combination is actually servable on the requested `network` —
|
|
2815
|
+
* is checked later, asynchronously — see the `failed` status on the poll endpoint below.
|
|
2816
|
+
*
|
|
2817
|
+
*/
|
|
2818
|
+
400: ResponseError;
|
|
2819
|
+
/**
|
|
2820
|
+
* You already have a dataset with this `name`
|
|
2821
|
+
*/
|
|
2822
|
+
409: ResponseError;
|
|
2823
|
+
/**
|
|
2824
|
+
* Your tier's dataset count limit is reached. Delete one, or upgrade.
|
|
2825
|
+
*/
|
|
2826
|
+
429: ResponseError;
|
|
2827
|
+
};
|
|
2828
|
+
|
|
2829
|
+
export type ImportDatasetError = ImportDatasetErrors[keyof ImportDatasetErrors];
|
|
2830
|
+
|
|
2831
|
+
export type ImportDatasetResponses = {
|
|
2832
|
+
/**
|
|
2833
|
+
* Dataset created, fetch started
|
|
2834
|
+
*/
|
|
2835
|
+
202: DatasetImportCreated;
|
|
2836
|
+
};
|
|
2837
|
+
|
|
2838
|
+
export type ImportDatasetResponse =
|
|
2839
|
+
ImportDatasetResponses[keyof ImportDatasetResponses];
|
|
2840
|
+
|
|
2841
|
+
export type GetDatasetImportData = {
|
|
2842
|
+
body?: never;
|
|
2843
|
+
path: {
|
|
2844
|
+
/**
|
|
2845
|
+
* The id returned by `POST /datasets/imports`
|
|
2846
|
+
*/
|
|
2847
|
+
datasetId: string;
|
|
2848
|
+
/**
|
|
2849
|
+
* The `importId` returned by `POST /datasets/imports`
|
|
2850
|
+
*/
|
|
2851
|
+
importId: string;
|
|
2852
|
+
};
|
|
2853
|
+
query?: never;
|
|
2854
|
+
url: "/datasets/{datasetId}/imports/{importId}";
|
|
2855
|
+
};
|
|
2856
|
+
|
|
2857
|
+
export type GetDatasetImportErrors = {
|
|
2858
|
+
/**
|
|
2859
|
+
* No such dataset for this user, or genuinely nothing is known about this `importId`.
|
|
2860
|
+
*
|
|
2861
|
+
*/
|
|
2862
|
+
404: ResponseError;
|
|
2863
|
+
};
|
|
2864
|
+
|
|
2865
|
+
export type GetDatasetImportError =
|
|
2866
|
+
GetDatasetImportErrors[keyof GetDatasetImportErrors];
|
|
2867
|
+
|
|
2868
|
+
export type GetDatasetImportResponses = {
|
|
2869
|
+
/**
|
|
2870
|
+
* Current fetch/ingest state
|
|
2871
|
+
*/
|
|
2872
|
+
200: DatasetImportState;
|
|
2873
|
+
};
|
|
2874
|
+
|
|
2875
|
+
export type GetDatasetImportResponse =
|
|
2876
|
+
GetDatasetImportResponses[keyof GetDatasetImportResponses];
|
|
2877
|
+
|
|
2631
2878
|
export type ClientOptions = {
|
|
2632
2879
|
baseUrl:
|
|
2633
2880
|
| "https://api.qtsurfer.net/v1"
|