@qtsurfer/api-client 0.14.1 → 0.16.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 +531 -42
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/generated/schemas.gen.ts +480 -50
- package/src/generated/sdk.gen.ts +160 -10
- package/src/generated/types.gen.ts +486 -48
|
@@ -103,6 +103,111 @@ export type HalLink = {
|
|
|
103
103
|
templated?: boolean;
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Your identity and tier limits. No database call behind this one — safe to fetch on every
|
|
108
|
+
* page load. Live usage against these limits is a separate resource, `GET /account/usage`,
|
|
109
|
+
* deliberately: usage changes on every upload/execution and costs a query to compute, this
|
|
110
|
+
* one doesn't.
|
|
111
|
+
*
|
|
112
|
+
*/
|
|
113
|
+
export type Account = {
|
|
114
|
+
/**
|
|
115
|
+
* Your account id — the JWT `sub` claim.
|
|
116
|
+
*/
|
|
117
|
+
userId: string;
|
|
118
|
+
/**
|
|
119
|
+
* Your current subscription tier.
|
|
120
|
+
*/
|
|
121
|
+
tier: string;
|
|
122
|
+
/**
|
|
123
|
+
* Maximum number of active datasets your tier allows.
|
|
124
|
+
*/
|
|
125
|
+
maxDatasets: number;
|
|
126
|
+
/**
|
|
127
|
+
* Maximum size, in bytes, of a single dataset version.
|
|
128
|
+
*/
|
|
129
|
+
maxDatasetBytes: number;
|
|
130
|
+
/**
|
|
131
|
+
* Maximum combined storage, in bytes, across every dataset, strategy-execution signal,
|
|
132
|
+
* and registered strategy on your account — one shared pool, not a separate cap per
|
|
133
|
+
* resource type, since they all compete for the same underlying storage. See `GET
|
|
134
|
+
* /account/usage`'s `storageBytesUsed` for your current usage against this number.
|
|
135
|
+
*
|
|
136
|
+
*/
|
|
137
|
+
maxTotalStorageBytes: number;
|
|
138
|
+
_links: AccountLinks;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* HAL `_links` for `GET /account`
|
|
143
|
+
*/
|
|
144
|
+
export type AccountLinks = {
|
|
145
|
+
/**
|
|
146
|
+
* Link to this resource.
|
|
147
|
+
*/
|
|
148
|
+
self: HalLink;
|
|
149
|
+
/**
|
|
150
|
+
* Link to your live usage, `GET /account/usage`.
|
|
151
|
+
*/
|
|
152
|
+
usage: HalLink;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Your live usage of the shared storage pool `GET /account`'s `maxTotalStorageBytes` caps.
|
|
157
|
+
* Not guaranteed real-time — a just-completed upload or strategy execution may take a short
|
|
158
|
+
* moment to be reflected here.
|
|
159
|
+
*
|
|
160
|
+
*/
|
|
161
|
+
export type AccountUsage = {
|
|
162
|
+
/**
|
|
163
|
+
* Active datasets counted — the same set `GET /account`'s `maxDatasets` limits.
|
|
164
|
+
*/
|
|
165
|
+
datasetsUsed: number;
|
|
166
|
+
/**
|
|
167
|
+
* Combined bytes of every active dataset's current version.
|
|
168
|
+
*/
|
|
169
|
+
datasetBytesUsed: number;
|
|
170
|
+
/**
|
|
171
|
+
* Recorded strategy-execution signal uploads.
|
|
172
|
+
*/
|
|
173
|
+
signalsUsed: number;
|
|
174
|
+
/**
|
|
175
|
+
* Combined bytes of every recorded signal upload.
|
|
176
|
+
*/
|
|
177
|
+
signalBytesUsed: number;
|
|
178
|
+
/**
|
|
179
|
+
* Registered strategies (see `GET /strategies`).
|
|
180
|
+
*/
|
|
181
|
+
strategiesUsed: number;
|
|
182
|
+
/**
|
|
183
|
+
* Combined bytes of each registered strategy's source plus its latest compiled
|
|
184
|
+
* bytecode. Superseded (non-latest) compilations aren't counted.
|
|
185
|
+
*
|
|
186
|
+
*/
|
|
187
|
+
strategyBytesUsed: number;
|
|
188
|
+
/**
|
|
189
|
+
* `datasetBytesUsed + signalBytesUsed + strategyBytesUsed` — the number checked
|
|
190
|
+
* against `GET /account`'s `maxTotalStorageBytes`.
|
|
191
|
+
*
|
|
192
|
+
*/
|
|
193
|
+
storageBytesUsed: number;
|
|
194
|
+
_links: AccountUsageLinks;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* HAL `_links` for `GET /account/usage`
|
|
199
|
+
*/
|
|
200
|
+
export type AccountUsageLinks = {
|
|
201
|
+
/**
|
|
202
|
+
* Link to this resource.
|
|
203
|
+
*/
|
|
204
|
+
self: HalLink;
|
|
205
|
+
/**
|
|
206
|
+
* Link to your tier limits, `GET /account`.
|
|
207
|
+
*/
|
|
208
|
+
account: HalLink;
|
|
209
|
+
};
|
|
210
|
+
|
|
106
211
|
/**
|
|
107
212
|
* Exchange instrument with per-data-type coverage and market info
|
|
108
213
|
*/
|
|
@@ -228,29 +333,22 @@ export type PrepareRequest = {
|
|
|
228
333
|
*/
|
|
229
334
|
to: string;
|
|
230
335
|
/**
|
|
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";
|
|
336
|
+
* Output bar cadence for the prepared range. Coarser cadences are produced on demand by
|
|
337
|
+
* resampling the source and stored alongside the native blob in cache. A target finer
|
|
338
|
+
* than the source, or not an exact multiple of it, returns `400`. What's accepted, and
|
|
339
|
+
* what omitting it means, depends on the source:
|
|
340
|
+
*
|
|
341
|
+
* * Managed exchange — one of `1s`, `5s`, `1m`, `3m`, `5m`, `15m`, `30m`, `1h`, `2h`,
|
|
342
|
+
* `4h`, `8h`, `12h`, `1d`, `1w`, `1q`; any other label returns `400`. Omitted = `1s`,
|
|
343
|
+
* the publisher's native cadence.
|
|
344
|
+
* * Dataset (`exchangeId: user`) — omitted = the dataset version's own discovered
|
|
345
|
+
* `cadence` (see `DatasetVersion.cadence`), served as-is. Any cadence equal to or
|
|
346
|
+
* coarser than it and an exact multiple of it is accepted, including ones outside the
|
|
347
|
+
* managed-exchange list (e.g. `15s`); an `rt` dataset can be resampled to any fixed
|
|
348
|
+
* cadence.
|
|
349
|
+
*
|
|
350
|
+
*/
|
|
351
|
+
cadence?: string;
|
|
254
352
|
};
|
|
255
353
|
|
|
256
354
|
/**
|
|
@@ -265,7 +363,8 @@ export type JobState = {
|
|
|
265
363
|
* Current status of the job. Treat `Completed | Aborted | Failed` as
|
|
266
364
|
* terminal; `New | Started` mean keep polling. A single-instrument prepare
|
|
267
365
|
* is always terminal (`Completed`) — decide from
|
|
268
|
-
* `PrepareJobState.coverageRatio
|
|
366
|
+
* `PrepareJobState.coverageRatio` (or `dataFrom`/`dataTo` against an `rt` dataset,
|
|
367
|
+
* which has no ratio), not by polling.
|
|
269
368
|
*
|
|
270
369
|
*/
|
|
271
370
|
status: "New" | "Started" | "Completed" | "Aborted" | "Failed";
|
|
@@ -303,8 +402,10 @@ export type JobState = {
|
|
|
303
402
|
* dataset-backed prepare (`exchangeId: user`), coverage is reported on the dataset's own
|
|
304
403
|
* cadence grid instead — hour-walking a daily dataset would report `1/24` and read as
|
|
305
404
|
* broken — via `cadence`/`gaps`/`largestGapSteps`; `totalHours`/`hoursWithData`/
|
|
306
|
-
* `hoursWithoutData` are absent in that case. `dataFrom`/`dataTo
|
|
307
|
-
*
|
|
405
|
+
* `hoursWithoutData` are absent in that case. `dataFrom`/`dataTo` are present either way, and
|
|
406
|
+
* `coverageRatio` too, computed accordingly — except against a dataset whose `cadence` is `rt`:
|
|
407
|
+
* with no fixed step there is no expected row count to measure against, so `coverageRatio`
|
|
408
|
+
* is absent and `gaps`/`largestGapSteps` are `0`.
|
|
308
409
|
*
|
|
309
410
|
*/
|
|
310
411
|
export type PrepareJobState = JobState & {
|
|
@@ -321,7 +422,8 @@ export type PrepareJobState = JobState & {
|
|
|
321
422
|
* `totalHours` is 0), the fraction of hours in the requested range that have served
|
|
322
423
|
* data. Against a dataset (`exchangeId: user`): `rows / expectedStepsAtCadence`
|
|
323
424
|
* over the dataset version's own range — echoing what ingest computed once, not
|
|
324
|
-
* recomputed against a narrower prepare request.
|
|
425
|
+
* recomputed against a narrower prepare request. Absent for an `rt` dataset (no
|
|
426
|
+
* fixed step, so no expected row count).
|
|
325
427
|
*
|
|
326
428
|
*/
|
|
327
429
|
coverageRatio?: number;
|
|
@@ -338,20 +440,21 @@ export type PrepareJobState = JobState & {
|
|
|
338
440
|
*/
|
|
339
441
|
hoursWithData?: number;
|
|
340
442
|
/**
|
|
341
|
-
* The dataset version's own discovered cadence (e.g. `1m`, `1h`)
|
|
342
|
-
*
|
|
443
|
+
* The dataset version's own discovered cadence — a fixed grid (e.g. `1m`, `1h`) or
|
|
444
|
+
* `rt` (see `DatasetVersion.cadence`). Only present for a dataset-backed prepare
|
|
445
|
+
* (`exchangeId: user`).
|
|
343
446
|
*
|
|
344
447
|
*/
|
|
345
448
|
cadence?: string;
|
|
346
449
|
/**
|
|
347
450
|
* Number of gaps in the dataset version at its own cadence, as discovered at ingest
|
|
348
|
-
* time. Only present for a dataset-backed prepare.
|
|
451
|
+
* time. `0` for `rt`. Only present for a dataset-backed prepare.
|
|
349
452
|
*
|
|
350
453
|
*/
|
|
351
454
|
gaps?: number;
|
|
352
455
|
/**
|
|
353
|
-
* The largest gap in the dataset version, in units of its own cadence step.
|
|
354
|
-
* present for a dataset-backed prepare.
|
|
456
|
+
* The largest gap in the dataset version, in units of its own cadence step. `0` for
|
|
457
|
+
* `rt`. Only present for a dataset-backed prepare.
|
|
355
458
|
*
|
|
356
459
|
*/
|
|
357
460
|
largestGapSteps?: number;
|
|
@@ -1167,9 +1270,10 @@ export type StrategyState = {
|
|
|
1167
1270
|
* A dataset's own metadata — not its data. `currentVersionId` is what a prepare against
|
|
1168
1271
|
* `exchangeId: user` reads by default; see `DatasetVersion` for what a version carries.
|
|
1169
1272
|
*
|
|
1170
|
-
* `from`/`to`/`cadence` mirror that
|
|
1171
|
-
*
|
|
1172
|
-
*
|
|
1273
|
+
* `from`/`to`/`cadence`/`timestampUnit`/`bytes`/`rows`/`gaps`/`largestGapSteps` mirror that
|
|
1274
|
+
* current version's own discovered range, cadence, timestamp unit and metrics, so you don't
|
|
1275
|
+
* need a second call to `GET /datasets/{datasetId}/uploads/{uploadId}` just to see what a
|
|
1276
|
+
* dataset covers.
|
|
1173
1277
|
*
|
|
1174
1278
|
*/
|
|
1175
1279
|
export type Dataset = {
|
|
@@ -1182,9 +1286,12 @@ export type Dataset = {
|
|
|
1182
1286
|
*/
|
|
1183
1287
|
name: string;
|
|
1184
1288
|
/**
|
|
1185
|
-
*
|
|
1289
|
+
* `ticker` for an upload or a `dex` import with no `cadence` requested (native per-trade
|
|
1290
|
+
* data). `klines` for a `dex` import that requested a candle `cadence` — pre-aggregated
|
|
1291
|
+
* bars rather than raw ticks. Purely informational; both shapes are read the same way.
|
|
1292
|
+
*
|
|
1186
1293
|
*/
|
|
1187
|
-
type: "ticker";
|
|
1294
|
+
type: "ticker" | "klines";
|
|
1188
1295
|
instrument: Instrument;
|
|
1189
1296
|
/**
|
|
1190
1297
|
* When the dataset was created.
|
|
@@ -1213,11 +1320,52 @@ export type Dataset = {
|
|
|
1213
1320
|
*/
|
|
1214
1321
|
to?: string;
|
|
1215
1322
|
/**
|
|
1216
|
-
* `currentVersionId`'s own discovered
|
|
1217
|
-
* version exists.
|
|
1323
|
+
* `currentVersionId`'s own discovered cadence — a fixed grid (e.g. `1s`, `1m`, `1h`) or
|
|
1324
|
+
* `rt` (see `DatasetVersion.cadence`). Absent until a version exists.
|
|
1218
1325
|
*
|
|
1219
1326
|
*/
|
|
1220
1327
|
cadence?: string;
|
|
1328
|
+
/**
|
|
1329
|
+
* `currentVersionId`'s own timestamp unit (see `DatasetVersion.timestampUnit`) — decode
|
|
1330
|
+
* the `timestamp` column of `dataUrl`'s file accordingly. Present only when `status` is
|
|
1331
|
+
* `ready`.
|
|
1332
|
+
*
|
|
1333
|
+
*/
|
|
1334
|
+
timestampUnit?: "iso" | "s" | "ms" | "us";
|
|
1335
|
+
/**
|
|
1336
|
+
* * `ready` — `currentVersionId` is set; `from`/`to`/`cadence`/`bytes`/`rows`/`gaps`/
|
|
1337
|
+
* `largestGapSteps` describe it.
|
|
1338
|
+
* * `failed` — the most recent upload/import attempt failed. `currentVersionId` and the
|
|
1339
|
+
* fields above are absent — there is nothing to read yet. See `error`.
|
|
1340
|
+
* * `pending` — nothing has ever been attempted (just created, or an upload was never
|
|
1341
|
+
* finalized).
|
|
1342
|
+
*
|
|
1343
|
+
*/
|
|
1344
|
+
status: "ready" | "failed" | "pending";
|
|
1345
|
+
/**
|
|
1346
|
+
* Size of `currentVersionId`'s own stored file. Present only when `status` is `ready` —
|
|
1347
|
+
* see `DatasetVersion.bytes` for what it measures exactly.
|
|
1348
|
+
*
|
|
1349
|
+
*/
|
|
1350
|
+
bytes?: number;
|
|
1351
|
+
/**
|
|
1352
|
+
* `currentVersionId`'s own row count. Present only when `status` is `ready`.
|
|
1353
|
+
*/
|
|
1354
|
+
rows?: number;
|
|
1355
|
+
/**
|
|
1356
|
+
* `currentVersionId`'s own gap count at its discovered cadence. Present only when `status` is `ready`.
|
|
1357
|
+
*/
|
|
1358
|
+
gaps?: number;
|
|
1359
|
+
/**
|
|
1360
|
+
* `currentVersionId`'s own largest gap, in units of its discovered cadence step. Present only when `status` is `ready`.
|
|
1361
|
+
*/
|
|
1362
|
+
largestGapSteps?: number;
|
|
1363
|
+
/**
|
|
1364
|
+
* A human-readable reason the most recent upload/import attempt failed. Present only
|
|
1365
|
+
* when `status` is `failed`.
|
|
1366
|
+
*
|
|
1367
|
+
*/
|
|
1368
|
+
error?: string;
|
|
1221
1369
|
};
|
|
1222
1370
|
|
|
1223
1371
|
/**
|
|
@@ -1236,8 +1384,9 @@ export type DatasetWithLinks = Dataset & {
|
|
|
1236
1384
|
/**
|
|
1237
1385
|
* Which format `dataUrl` is actually in — check this rather than assuming it
|
|
1238
1386
|
* matches how you uploaded it. `lastra` — our native columnar format — for a CSV (or
|
|
1239
|
-
* gzip/zip of one) upload, always converted on ingest
|
|
1240
|
-
*
|
|
1387
|
+
* gzip/zip of one) upload, always converted on ingest, or for a lastra upload,
|
|
1388
|
+
* stored as-is (the value alone doesn't tell you which). `parquet` for a parquet
|
|
1389
|
+
* upload, also stored as-is today.
|
|
1241
1390
|
*
|
|
1242
1391
|
*/
|
|
1243
1392
|
dataFormat?: "lastra" | "parquet";
|
|
@@ -1324,7 +1473,13 @@ export type DatasetVersion = {
|
|
|
1324
1473
|
*/
|
|
1325
1474
|
rows?: number;
|
|
1326
1475
|
/**
|
|
1327
|
-
* The discovered
|
|
1476
|
+
* The cadence discovered from the data's own timestamps. Either a fixed grid — `1s`,
|
|
1477
|
+
* `5s`, `15s`, `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1d` — when at least half the
|
|
1478
|
+
* intervals between consecutive rows fall on that step (small clock jitter tolerated), or
|
|
1479
|
+
* `rt`: native data at the rate it was captured, each row at its own timestamp with no
|
|
1480
|
+
* fixed step — per-trade on-chain swaps, block-spaced or sub-second ticks, irregular
|
|
1481
|
+
* intervals. An `rt` dataset can be resampled to any fixed cadence at prepare time.
|
|
1482
|
+
*
|
|
1328
1483
|
*/
|
|
1329
1484
|
cadence?: string;
|
|
1330
1485
|
/**
|
|
@@ -1334,11 +1489,11 @@ export type DatasetVersion = {
|
|
|
1334
1489
|
*/
|
|
1335
1490
|
timestampUnit?: "iso" | "s" | "ms" | "us";
|
|
1336
1491
|
/**
|
|
1337
|
-
* Number of gaps at the discovered cadence.
|
|
1492
|
+
* Number of gaps at the discovered cadence. Always `0` for `rt`.
|
|
1338
1493
|
*/
|
|
1339
1494
|
gaps?: number;
|
|
1340
1495
|
/**
|
|
1341
|
-
* The largest gap, in units of the discovered cadence step.
|
|
1496
|
+
* The largest gap, in units of the discovered cadence step. Always `0` for `rt`.
|
|
1342
1497
|
*/
|
|
1343
1498
|
largestGapSteps?: number;
|
|
1344
1499
|
/**
|
|
@@ -1352,8 +1507,9 @@ export type DatasetVersion = {
|
|
|
1352
1507
|
/**
|
|
1353
1508
|
* Which format `dataUrl` is actually in — check this rather than assuming it matches
|
|
1354
1509
|
* how you uploaded it. `lastra` — our native columnar format — for a CSV (or gzip/zip
|
|
1355
|
-
* of one) upload, always converted on ingest
|
|
1356
|
-
*
|
|
1510
|
+
* of one) upload, always converted on ingest, or for a lastra upload, stored as-is
|
|
1511
|
+
* (the value alone doesn't tell you which). `parquet` for a parquet upload, also
|
|
1512
|
+
* stored as-is today.
|
|
1357
1513
|
*
|
|
1358
1514
|
*/
|
|
1359
1515
|
dataFormat?: "lastra" | "parquet";
|
|
@@ -1381,6 +1537,154 @@ export type DatasetUploadState = {
|
|
|
1381
1537
|
* The ingest job id, while `status` is `ingesting`.
|
|
1382
1538
|
*/
|
|
1383
1539
|
jobId?: string;
|
|
1540
|
+
/**
|
|
1541
|
+
* A human-readable reason, present when `status` is `failed` (e.g. bad CSV contract,
|
|
1542
|
+
* mixed timestamp units, a `.zip` with no file inside or more than one). Durably
|
|
1543
|
+
* recorded alongside the failure itself, so it stays available however long after the
|
|
1544
|
+
* fact you poll — not tied to how recently the failure happened.
|
|
1545
|
+
*
|
|
1546
|
+
*/
|
|
1547
|
+
error?: string;
|
|
1548
|
+
/**
|
|
1549
|
+
* Present when `status` is `ready` or `failed`.
|
|
1550
|
+
*/
|
|
1551
|
+
version?: DatasetVersion;
|
|
1552
|
+
};
|
|
1553
|
+
|
|
1554
|
+
/**
|
|
1555
|
+
* `POST /datasets/imports`'s request body. A common block plus one type-specific block,
|
|
1556
|
+
* selected by `type` — `dex` is the only value today.
|
|
1557
|
+
*
|
|
1558
|
+
*/
|
|
1559
|
+
export type DatasetImportRequest = {
|
|
1560
|
+
/**
|
|
1561
|
+
* A name unique among your datasets. `409` if already taken.
|
|
1562
|
+
*/
|
|
1563
|
+
name: string;
|
|
1564
|
+
instrument: Instrument;
|
|
1565
|
+
/**
|
|
1566
|
+
* Start of the range to fetch, inclusive. Must be before `to`.
|
|
1567
|
+
*/
|
|
1568
|
+
from: string;
|
|
1569
|
+
/**
|
|
1570
|
+
* End of the range to fetch, exclusive. The total span is capped by your tier — a
|
|
1571
|
+
* request wider than that ceiling is `400`, regardless of source type.
|
|
1572
|
+
*
|
|
1573
|
+
*/
|
|
1574
|
+
to: string;
|
|
1575
|
+
/**
|
|
1576
|
+
* Optional. Omitted/blank keeps native per-trade event cadence — each swap at its own
|
|
1577
|
+
* timestamp, so the resulting version's `cadence` is `rt` unless the swaps happen to sit
|
|
1578
|
+
* on a fixed grid (see `DatasetVersion.cadence`). Set to `1s`, `1m` or
|
|
1579
|
+
* `5m` instead to get pre-aggregated candles at that width rather than raw trades (the
|
|
1580
|
+
* resulting dataset's `type` becomes `klines`); any other value is `400`. Not every
|
|
1581
|
+
* network supports every cadence — an unsupported combination fails asynchronously, not
|
|
1582
|
+
* at request time (see `DatasetImportState.error`).
|
|
1583
|
+
*
|
|
1584
|
+
*/
|
|
1585
|
+
cadence?: "1s" | "1m" | "5m";
|
|
1586
|
+
/**
|
|
1587
|
+
* The source to fetch from. `dex` is the only value today.
|
|
1588
|
+
*/
|
|
1589
|
+
type: "dex";
|
|
1590
|
+
dex?: DatasetImportDexRequest;
|
|
1591
|
+
};
|
|
1592
|
+
|
|
1593
|
+
/**
|
|
1594
|
+
* The `dex` source's own fields — required when `type` is `dex`. `id`/`version` are required
|
|
1595
|
+
* for a plain (native-cadence) import; both are ignored if the top-level `cadence` requested
|
|
1596
|
+
* pre-aggregated candles instead, since that path needs neither a protocol nor a version
|
|
1597
|
+
* distinction.
|
|
1598
|
+
*
|
|
1599
|
+
*/
|
|
1600
|
+
export type DatasetImportDexRequest = {
|
|
1601
|
+
/**
|
|
1602
|
+
* Which chain the pool/pair lives on.
|
|
1603
|
+
*/
|
|
1604
|
+
network: "ethereum" | "robinhood";
|
|
1605
|
+
/**
|
|
1606
|
+
* Which on-chain DEX protocol `contract` implements. Required unless the top-level
|
|
1607
|
+
* `cadence` requested pre-aggregated candles, in which case it's ignored.
|
|
1608
|
+
*
|
|
1609
|
+
*/
|
|
1610
|
+
id?: "uniswap";
|
|
1611
|
+
/**
|
|
1612
|
+
* Uniswap version the pool/pair contract implements. Required unless the top-level
|
|
1613
|
+
* `cadence` requested pre-aggregated candles, in which case it's ignored.
|
|
1614
|
+
*
|
|
1615
|
+
*/
|
|
1616
|
+
version?: "v2" | "v3";
|
|
1617
|
+
/**
|
|
1618
|
+
* The pool (v3) or pair (v2) contract address.
|
|
1619
|
+
*/
|
|
1620
|
+
contract: string;
|
|
1621
|
+
/**
|
|
1622
|
+
* The factory that deployed `contract`. Optional — when omitted, it is discovered
|
|
1623
|
+
* on-chain from `contract` itself at fetch time. Supply it explicitly only if you
|
|
1624
|
+
* already know it, or the pool/pair belongs to a factory other than the canonical one
|
|
1625
|
+
* for `network`/`version`. Either way, the pool/pair is validated against whichever
|
|
1626
|
+
* factory is used before anything is fetched — a wrong or unrelated factory fails the
|
|
1627
|
+
* import rather than silently fetching from the wrong pool. Ignored if the top-level
|
|
1628
|
+
* `cadence` requested pre-aggregated candles.
|
|
1629
|
+
*
|
|
1630
|
+
*/
|
|
1631
|
+
factory?: string;
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1634
|
+
/**
|
|
1635
|
+
* The response to `POST /datasets/imports` — the dataset now exists, and its fetch has started.
|
|
1636
|
+
*/
|
|
1637
|
+
export type DatasetImportCreated = {
|
|
1638
|
+
/**
|
|
1639
|
+
* Opaque id of the newly created dataset — same id space as `POST /datasets`.
|
|
1640
|
+
*/
|
|
1641
|
+
datasetId: string;
|
|
1642
|
+
/**
|
|
1643
|
+
* Identifies this import. Pass to `GET /datasets/{datasetId}/imports/{importId}` to poll
|
|
1644
|
+
* it — there is no separate "finalize" step the way an upload has.
|
|
1645
|
+
*
|
|
1646
|
+
*/
|
|
1647
|
+
importId: string;
|
|
1648
|
+
/**
|
|
1649
|
+
* The fetch/ingest job id.
|
|
1650
|
+
*/
|
|
1651
|
+
jobId: string;
|
|
1652
|
+
/**
|
|
1653
|
+
* Always `fetching` in this response — the fetch has only just started.
|
|
1654
|
+
*/
|
|
1655
|
+
status: "fetching";
|
|
1656
|
+
};
|
|
1657
|
+
|
|
1658
|
+
/**
|
|
1659
|
+
* Progress of one import, from fetching through ingest. `fetching` is the one status only an
|
|
1660
|
+
* import ever reports — an upload's file already exists by the time you can poll it; an
|
|
1661
|
+
* import's doesn't, until this source finishes fetching it.
|
|
1662
|
+
*
|
|
1663
|
+
*/
|
|
1664
|
+
export type DatasetImportState = {
|
|
1665
|
+
importId: string;
|
|
1666
|
+
/**
|
|
1667
|
+
* * `fetching` — reading from the source; nothing staged yet.
|
|
1668
|
+
* * `ingesting` — fetch complete, staged, and re-entered the same ingest chain an
|
|
1669
|
+
* upload uses; the worker is parsing and validating it.
|
|
1670
|
+
* * `ready` — ingested successfully. `version` carries the result.
|
|
1671
|
+
* * `failed` — the fetch or the ingest that followed it was rejected. `error` names why.
|
|
1672
|
+
*
|
|
1673
|
+
*/
|
|
1674
|
+
status: "fetching" | "ingesting" | "ready" | "failed";
|
|
1675
|
+
/**
|
|
1676
|
+
* The fetch/ingest job id, while `status` is `fetching` or `ingesting`.
|
|
1677
|
+
*/
|
|
1678
|
+
jobId?: string;
|
|
1679
|
+
/**
|
|
1680
|
+
* A human-readable reason, present when `status` is `failed` — an unresolvable
|
|
1681
|
+
* pool/pair, no data in the requested range, a range older than the configured source
|
|
1682
|
+
* retains, the fetch exceeding your tier's time ceiling, or any of
|
|
1683
|
+
* `DatasetUploadState.error`'s own ingest-side reasons once fetching hands off to it.
|
|
1684
|
+
* Durably recorded, same as on the upload path.
|
|
1685
|
+
*
|
|
1686
|
+
*/
|
|
1687
|
+
error?: string;
|
|
1384
1688
|
/**
|
|
1385
1689
|
* Present when `status` is `ready` or `failed`.
|
|
1386
1690
|
*/
|
|
@@ -1454,6 +1758,39 @@ export type AuthenticateResponses = {
|
|
|
1454
1758
|
export type AuthenticateResponse =
|
|
1455
1759
|
AuthenticateResponses[keyof AuthenticateResponses];
|
|
1456
1760
|
|
|
1761
|
+
export type GetAccountData = {
|
|
1762
|
+
body?: never;
|
|
1763
|
+
path?: never;
|
|
1764
|
+
query?: never;
|
|
1765
|
+
url: "/account";
|
|
1766
|
+
};
|
|
1767
|
+
|
|
1768
|
+
export type GetAccountResponses = {
|
|
1769
|
+
/**
|
|
1770
|
+
* Your account
|
|
1771
|
+
*/
|
|
1772
|
+
200: Account;
|
|
1773
|
+
};
|
|
1774
|
+
|
|
1775
|
+
export type GetAccountResponse = GetAccountResponses[keyof GetAccountResponses];
|
|
1776
|
+
|
|
1777
|
+
export type GetAccountUsageData = {
|
|
1778
|
+
body?: never;
|
|
1779
|
+
path?: never;
|
|
1780
|
+
query?: never;
|
|
1781
|
+
url: "/account/usage";
|
|
1782
|
+
};
|
|
1783
|
+
|
|
1784
|
+
export type GetAccountUsageResponses = {
|
|
1785
|
+
/**
|
|
1786
|
+
* Your current usage
|
|
1787
|
+
*/
|
|
1788
|
+
200: AccountUsage;
|
|
1789
|
+
};
|
|
1790
|
+
|
|
1791
|
+
export type GetAccountUsageResponse =
|
|
1792
|
+
GetAccountUsageResponses[keyof GetAccountUsageResponses];
|
|
1793
|
+
|
|
1457
1794
|
export type ListExchangesData = {
|
|
1458
1795
|
body?: never;
|
|
1459
1796
|
path?: never;
|
|
@@ -1907,8 +2244,8 @@ export type PrepareBacktestErrors = {
|
|
|
1907
2244
|
* Invalid request or parameters. Also returned when `from` is older than the configured
|
|
1908
2245
|
* lookback window or `to` is in the future. For `exchangeId: user`, also returned when
|
|
1909
2246
|
* 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.
|
|
2247
|
+
* granularity than the dataset's own discovered cadence (or one that isn't an exact
|
|
2248
|
+
* multiple of it), or the requested range exceeds your tier's range limit.
|
|
1912
2249
|
*
|
|
1913
2250
|
*/
|
|
1914
2251
|
400: ResponseError;
|
|
@@ -2218,6 +2555,16 @@ export type ExecuteBacktestData = {
|
|
|
2218
2555
|
*/
|
|
2219
2556
|
storeSignals?: boolean;
|
|
2220
2557
|
equityCurve?: EquityCurveOptions;
|
|
2558
|
+
/**
|
|
2559
|
+
* Capital/fee/position-size overrides for this one run — the same shape
|
|
2560
|
+
* `executeSweep`'s `baseConfig` accepts. Omit to run at the platform defaults
|
|
2561
|
+
* (`initialFunding: 100`, `feeRate: 0.001`). `buyFeeRate`/`sellFeeRate`/`feeLeg`
|
|
2562
|
+
* are accepted for shape compatibility with a sweep's `baseConfig`, but this
|
|
2563
|
+
* endpoint has one fee-rate slot: a value that implies asymmetric buy/sell fees,
|
|
2564
|
+
* or a non-default `feeLeg`, is rejected with `400`.
|
|
2565
|
+
*
|
|
2566
|
+
*/
|
|
2567
|
+
baseConfig?: SweepBaseConfig;
|
|
2221
2568
|
/**
|
|
2222
2569
|
* Strategy properties to apply to this run. Omit to run the strategy's declared
|
|
2223
2570
|
* defaults, which is exactly what a request without this field has always done.
|
|
@@ -2573,6 +2920,12 @@ export type FinalizeDatasetUploadErrors = {
|
|
|
2573
2920
|
* The uploaded file exceeds your tier's size limit for a dataset.
|
|
2574
2921
|
*/
|
|
2575
2922
|
413: ResponseError;
|
|
2923
|
+
/**
|
|
2924
|
+
* Your account's total storage limit (`GET /account`'s `maxTotalStorageBytes`) is
|
|
2925
|
+
* reached or would be exceeded. Delete a dataset to free space, or upgrade.
|
|
2926
|
+
*
|
|
2927
|
+
*/
|
|
2928
|
+
429: ResponseError;
|
|
2576
2929
|
};
|
|
2577
2930
|
|
|
2578
2931
|
export type FinalizeDatasetUploadError =
|
|
@@ -2628,6 +2981,91 @@ export type GetDatasetUploadResponses = {
|
|
|
2628
2981
|
export type GetDatasetUploadResponse =
|
|
2629
2982
|
GetDatasetUploadResponses[keyof GetDatasetUploadResponses];
|
|
2630
2983
|
|
|
2984
|
+
export type ImportDatasetData = {
|
|
2985
|
+
/**
|
|
2986
|
+
* What to fetch, and where from
|
|
2987
|
+
*/
|
|
2988
|
+
body: DatasetImportRequest;
|
|
2989
|
+
path?: never;
|
|
2990
|
+
query?: never;
|
|
2991
|
+
url: "/datasets/imports";
|
|
2992
|
+
};
|
|
2993
|
+
|
|
2994
|
+
export type ImportDatasetErrors = {
|
|
2995
|
+
/**
|
|
2996
|
+
* Invalid request; `instrument` isn't a plain spot pair; `from >= to`; `cadence` present
|
|
2997
|
+
* but not one of its supported values; the requested range exceeds your tier's import
|
|
2998
|
+
* range ceiling; the requested range's rough size estimate exceeds your tier's row limit;
|
|
2999
|
+
* `dex.network`/`dex.id` not one of their supported values; `dex.contract`/`dex.factory`
|
|
3000
|
+
* fail basic shape validation; or, when `cadence` is omitted, `dex.id`/`dex.version`
|
|
3001
|
+
* missing. Whether the pool/pair actually exists and resolves — and, for a candle
|
|
3002
|
+
* `cadence`, whether that combination is actually servable on the requested `network` —
|
|
3003
|
+
* is checked later, asynchronously — see the `failed` status on the poll endpoint below.
|
|
3004
|
+
*
|
|
3005
|
+
*/
|
|
3006
|
+
400: ResponseError;
|
|
3007
|
+
/**
|
|
3008
|
+
* You already have a dataset with this `name`
|
|
3009
|
+
*/
|
|
3010
|
+
409: ResponseError;
|
|
3011
|
+
/**
|
|
3012
|
+
* Your tier's dataset count limit is reached, or your account's total storage limit
|
|
3013
|
+
* (`GET /account`'s `maxTotalStorageBytes`) is already reached. Delete a dataset to free
|
|
3014
|
+
* a slot or space, or upgrade.
|
|
3015
|
+
*
|
|
3016
|
+
*/
|
|
3017
|
+
429: ResponseError;
|
|
3018
|
+
};
|
|
3019
|
+
|
|
3020
|
+
export type ImportDatasetError = ImportDatasetErrors[keyof ImportDatasetErrors];
|
|
3021
|
+
|
|
3022
|
+
export type ImportDatasetResponses = {
|
|
3023
|
+
/**
|
|
3024
|
+
* Dataset created, fetch started
|
|
3025
|
+
*/
|
|
3026
|
+
202: DatasetImportCreated;
|
|
3027
|
+
};
|
|
3028
|
+
|
|
3029
|
+
export type ImportDatasetResponse =
|
|
3030
|
+
ImportDatasetResponses[keyof ImportDatasetResponses];
|
|
3031
|
+
|
|
3032
|
+
export type GetDatasetImportData = {
|
|
3033
|
+
body?: never;
|
|
3034
|
+
path: {
|
|
3035
|
+
/**
|
|
3036
|
+
* The id returned by `POST /datasets/imports`
|
|
3037
|
+
*/
|
|
3038
|
+
datasetId: string;
|
|
3039
|
+
/**
|
|
3040
|
+
* The `importId` returned by `POST /datasets/imports`
|
|
3041
|
+
*/
|
|
3042
|
+
importId: string;
|
|
3043
|
+
};
|
|
3044
|
+
query?: never;
|
|
3045
|
+
url: "/datasets/{datasetId}/imports/{importId}";
|
|
3046
|
+
};
|
|
3047
|
+
|
|
3048
|
+
export type GetDatasetImportErrors = {
|
|
3049
|
+
/**
|
|
3050
|
+
* No such dataset for this user, or genuinely nothing is known about this `importId`.
|
|
3051
|
+
*
|
|
3052
|
+
*/
|
|
3053
|
+
404: ResponseError;
|
|
3054
|
+
};
|
|
3055
|
+
|
|
3056
|
+
export type GetDatasetImportError =
|
|
3057
|
+
GetDatasetImportErrors[keyof GetDatasetImportErrors];
|
|
3058
|
+
|
|
3059
|
+
export type GetDatasetImportResponses = {
|
|
3060
|
+
/**
|
|
3061
|
+
* Current fetch/ingest state
|
|
3062
|
+
*/
|
|
3063
|
+
200: DatasetImportState;
|
|
3064
|
+
};
|
|
3065
|
+
|
|
3066
|
+
export type GetDatasetImportResponse =
|
|
3067
|
+
GetDatasetImportResponses[keyof GetDatasetImportResponses];
|
|
3068
|
+
|
|
2631
3069
|
export type ClientOptions = {
|
|
2632
3070
|
baseUrl:
|
|
2633
3071
|
| "https://api.qtsurfer.net/v1"
|