@qtsurfer/api-client 0.24.0 → 0.25.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/dist/index.d.ts CHANGED
@@ -13,6 +13,37 @@ type ResponseError = {
13
13
  * Error description
14
14
  */
15
15
  message: string;
16
+ /**
17
+ * A stable token naming the cause, for a client to branch on without reading `message`.
18
+ * Present only on an error that has one, and each operation that can return one lists
19
+ * the values it uses. A client treats a value it does not know like an absent `reason`.
20
+ *
21
+ */
22
+ reason?: string;
23
+ next?: ErrorNextCall;
24
+ };
25
+ /**
26
+ * The call that gets past an error, ready to send: a client that wants the same thing by
27
+ * another route makes this request. Present only on an error that has one.
28
+ *
29
+ */
30
+ type ErrorNextCall = {
31
+ /**
32
+ * HTTP method of the call.
33
+ */
34
+ method: "GET" | "POST" | "PUT" | "DELETE";
35
+ /**
36
+ * Path of the call, relative to the server URL (the one that already ends in `/v1`).
37
+ */
38
+ path: string;
39
+ /**
40
+ * JSON body of the call, when it has one. Whatever depends on the caller and cannot be
41
+ * known here (such as the `name` of a dataset) is left for the client to add.
42
+ *
43
+ */
44
+ body?: {
45
+ [key: string]: unknown;
46
+ };
16
47
  };
17
48
  /**
18
49
  * A scalar strategy property value for one execution.
@@ -22,6 +53,12 @@ type ScalarStrategyParamValue = number | string | boolean;
22
53
  * Exchange instrument identifier (e.g. a currency pair)
23
54
  */
24
55
  type Instrument = string;
56
+ /**
57
+ * An exchange's instrument catalogue: centralized-exchange instruments or decentralized-exchange
58
+ * pools. Read `meta.venueType` to distinguish `cex` from `dex`, including when `data` is empty.
59
+ *
60
+ */
61
+ type InstrumentCatalogueResponse = InstrumentListResponse | PoolListResponse;
25
62
  /**
26
63
  * HAL-style response envelope for the instruments listing
27
64
  */
@@ -49,6 +86,10 @@ type InstrumentListMeta = {
49
86
  * The market segment served in `data`
50
87
  */
51
88
  segment: "spot" | "futures";
89
+ /**
90
+ * The venue type of the exchange, as `GET /exchanges` lists it. Always `cex` here; a listing of pools says `dex`.
91
+ */
92
+ venueType: "cex";
52
93
  };
53
94
  /**
54
95
  * HAL `_links` — segment discovery for the instruments listing
@@ -67,6 +108,111 @@ type InstrumentLinks = {
67
108
  */
68
109
  futures?: HalLink;
69
110
  };
111
+ /**
112
+ * HAL-style response envelope for the instruments listing of a decentralized exchange, whose instruments are pools
113
+ */
114
+ type PoolListResponse = {
115
+ /**
116
+ * The pools worth running, the most traded in the last 24 hours first
117
+ */
118
+ data: Array<PoolDetail>;
119
+ meta: PoolListMeta;
120
+ _links: PoolLinks;
121
+ };
122
+ /**
123
+ * Metadata describing the pools listing of a decentralized exchange
124
+ */
125
+ type PoolListMeta = {
126
+ /**
127
+ * When this listing was last refreshed. It is refreshed every hour, and the `lastPrice` of each pool is as of this time.
128
+ */
129
+ updatedAt: string;
130
+ /**
131
+ * The exchange the pools belong to
132
+ */
133
+ exchange: string;
134
+ /**
135
+ * The protocol served in `data`, one of the exchange's `segments`
136
+ */
137
+ segment: string;
138
+ /**
139
+ * The venue type of the exchange, as `GET /exchanges` lists it. Always `dex` here; a listing of instruments of a centralized exchange says `cex`.
140
+ */
141
+ venueType: "dex";
142
+ /**
143
+ * A pool with less liquidity than this (in US dollars) is not listed
144
+ */
145
+ minTvlUsd: number;
146
+ /**
147
+ * The most pools the listing has
148
+ */
149
+ limit: number;
150
+ };
151
+ /**
152
+ * HAL `_links` — protocol discovery for the pools listing of a decentralized exchange
153
+ */
154
+ type PoolLinks = {
155
+ /**
156
+ * Link to this listing
157
+ */
158
+ self: HalLink;
159
+ [key: string]: HalLink;
160
+ };
161
+ /**
162
+ * A pool of a decentralized exchange that a live run can read. The listing is a place to start, not the
163
+ * whole market: a live run can read any pool of the protocol, listed or not.
164
+ *
165
+ */
166
+ type PoolDetail = {
167
+ /**
168
+ * The pool's address, in lower case. It is the value to put in `instruments` of a live run's source.
169
+ */
170
+ id: string;
171
+ /**
172
+ * The pair written `BASE/QUOTE`, the way the signals of a run on this pool name it (`instrument`)
173
+ */
174
+ symbol: string;
175
+ /**
176
+ * Symbol of the base token
177
+ */
178
+ base: string;
179
+ /**
180
+ * Symbol of the quote token
181
+ */
182
+ quote: string;
183
+ /**
184
+ * Address of the base token, in lower case
185
+ */
186
+ baseAddress: string;
187
+ /**
188
+ * Address of the quote token, in lower case
189
+ */
190
+ quoteAddress: string;
191
+ /**
192
+ * The pool's fee tier, in percent (`0.05` is a 0.05 % fee). A protocol can have several pools of the same pair, one per fee tier.
193
+ */
194
+ feePercent: number;
195
+ /**
196
+ * The price of one base token in the quote token, as the signals of a run on this pool name the pair. It is as of `meta.updatedAt`, so up to one hour old. Absent when there is no price for the pool.
197
+ */
198
+ lastPrice?: number;
199
+ /**
200
+ * What traded in the pool over the last 24 hours, in the quote token, the same meaning as `volume24h` of an instrument of a centralized exchange. Absent when the quote token has no dollar price to convert from.
201
+ */
202
+ volume24h?: number;
203
+ /**
204
+ * The liquidity held by the pool, in US dollars
205
+ */
206
+ tvlUsd: number;
207
+ /**
208
+ * What traded in the pool over the last 24 hours, in US dollars
209
+ */
210
+ volume24hUsd: number;
211
+ /**
212
+ * When the pool was created. Absent when it is not known
213
+ */
214
+ createdAt?: string;
215
+ };
70
216
  /**
71
217
  * HAL `_links` for a strategy — present on a full `StrategyState` body (`GET
72
218
  * /strategy/{strategyId}`, and `POST /strategy/{strategyId}/validate`'s already-validated
@@ -112,6 +258,7 @@ type Account = {
112
258
  * Your current subscription tier.
113
259
  */
114
260
  tier: string;
261
+ scopes: KeyScopes;
115
262
  /**
116
263
  * Maximum number of strategy executions (and sweeps) you can have running at the same time
117
264
  * through the API. Starting one past this number is answered with `429`, whose message
@@ -227,6 +374,10 @@ type InstrumentDetail = {
227
374
  * Instrument identifier (e.g. currency pair)
228
375
  */
229
376
  id: string;
377
+ /**
378
+ * The instrument's name, the same as `id`. A pool of a decentralized exchange has the same field (`PoolDetail`), so both listings are read alike.
379
+ */
380
+ symbol: string;
230
381
  /**
231
382
  * Base currency
232
383
  */
@@ -235,13 +386,17 @@ type InstrumentDetail = {
235
386
  * Quote currency
236
387
  */
237
388
  quote: string;
389
+ /**
390
+ * Settlement currency. Present on a futures instrument only.
391
+ */
392
+ settle?: string;
238
393
  coverage?: InstrumentCoverage;
239
394
  /**
240
- * Last traded price
395
+ * Last traded price. Absent for an instrument with no recent price.
241
396
  */
242
397
  lastPrice?: number;
243
398
  /**
244
- * Trading volume in the last 24 hours (in quote currency)
399
+ * Trading volume in the last 24 hours (in quote currency). Absent for an instrument with no recent volume.
245
400
  */
246
401
  volume24h?: number;
247
402
  };
@@ -291,6 +446,18 @@ type Exchange = {
291
446
  * Description of the exchange
292
447
  */
293
448
  description?: string;
449
+ /**
450
+ * Venue category, written as the `venueType` of a live run's source: `cex` is a centralized exchange and `dex` a decentralized one. A `dex` exchange has no market data to prepare or backtest, so its id is not valid in the routes that take an `exchangeId`, except the two instruments routes, which list its pools (the instrument of a run on it is a pool's address).
451
+ */
452
+ venueType: "cex" | "dex";
453
+ /**
454
+ * The segments the exchange offers, written as in the path of `GET /exchange/{exchangeId}/{segment}/instruments` and as the `segment` of a live run's source. For a `cex` exchange, its market segments (`spot`, `futures`: the ones its instrument catalogues are served under); for a `dex` exchange, the protocols whose pools a run can read.
455
+ */
456
+ segments: Array<string>;
457
+ /**
458
+ * The segments among `segments` for which live data is published, so the ones a live run can read: a live run on any other segment of the exchange is refused with `400`. It can be empty (an exchange whose live data is not published yet).
459
+ */
460
+ liveSegments: Array<string>;
294
461
  };
295
462
  /**
296
463
  * Managed exchange data sources available for backtesting.
@@ -356,11 +523,10 @@ type PrepareRequest = {
356
523
  * * Managed exchange, `ticker` or `funding` — one of `1s`, `5s`, `1m`, `3m`, `5m`, `15m`,
357
524
  * `30m`, `1h`, `2h`, `4h`, `8h`, `12h`, `1d`, `1w`, `1q`; any other label returns `400`.
358
525
  * Omitted = `1s`, the publisher's native cadence.
359
- * * Managed exchange, `kline` — one of `1s`, `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1d`;
360
- * any other label, including `5s`, `3m` and `8h`, returns `400` and names the accepted
361
- * ones. Omitted = `1s`. This is the width of the bars a run reads: it is chosen here,
362
- * once, and the same strategy can be run at several cadences by preparing the range at
363
- * each.
526
+ * * Managed exchange, `kline` — the same labels as above, `1s` to `1q`; a label that is
527
+ * not a whole number of seconds returns `400`. Omitted = `1s`. This is the width of the
528
+ * bars a run reads: it is chosen here, once, and the same strategy can be run at
529
+ * several cadences by preparing the range at each.
364
530
  * * Dataset (`exchangeId: user`) — omitted = the dataset version's own discovered
365
531
  * `cadence` (see `DatasetVersion.cadence`), served as-is. Any cadence equal to or
366
532
  * coarser than it and an exact multiple of it is accepted, including ones outside the
@@ -1288,9 +1454,11 @@ type Dataset = {
1288
1454
  */
1289
1455
  name: string;
1290
1456
  /**
1291
- * `ticker` for an upload or a `dex` import with no `cadence` requested (native per-trade
1292
- * data). `klines` for a `dex` import that requested a candle `cadence` — pre-aggregated
1293
- * bars rather than raw ticks. Purely informational; both shapes are read the same way.
1457
+ * `ticker` for an upload, a `dex` import with no `cadence` requested (native per-trade
1458
+ * data) or a `cex` import with `dataType: ticker`. `klines` for a `dex` import that
1459
+ * requested a candle `cadence` — pre-aggregated bars rather than raw ticks — or a `cex`
1460
+ * import with `dataType: klines`. Purely informational; both shapes are read the same
1461
+ * way.
1294
1462
  *
1295
1463
  */
1296
1464
  type: "ticker" | "klines";
@@ -1477,11 +1645,12 @@ type DatasetVersion = {
1477
1645
  rows?: number;
1478
1646
  /**
1479
1647
  * The cadence discovered from the data's own timestamps. Either a fixed grid — `1s`,
1480
- * `5s`, `15s`, `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1d` — when at least half the
1481
- * intervals between consecutive rows fall on that step (small clock jitter tolerated), or
1482
- * `rt`: native data at the rate it was captured, each row at its own timestamp with no
1483
- * fixed step — per-trade on-chain swaps, block-spaced or sub-second ticks, irregular
1484
- * intervals. An `rt` dataset can be resampled to any fixed cadence at prepare time.
1648
+ * `5s`, `15s`, `1m`, `3m`, `5m`, `15m`, `30m`, `1h`, `2h`, `4h`, `8h`, `12h`, `1d`,
1649
+ * `1w` — when at least half the intervals between consecutive rows fall on that step
1650
+ * (small clock jitter tolerated), or `rt`: native data at the rate it was captured, each
1651
+ * row at its own timestamp with no fixed step — per-trade on-chain swaps, block-spaced
1652
+ * or sub-second ticks, irregular intervals. An `rt` dataset can be resampled to any
1653
+ * fixed cadence at prepare time.
1485
1654
  *
1486
1655
  */
1487
1656
  cadence?: string;
@@ -1554,7 +1723,8 @@ type DatasetUploadState = {
1554
1723
  };
1555
1724
  /**
1556
1725
  * `POST /datasets/imports`'s request body. A common block plus one type-specific block,
1557
- * selected by `type` — `dex` is the only value today.
1726
+ * selected by `type`: `dex` (block `dex`) or `cex` (block `cex`), the two `venueType`s of
1727
+ * `GET /exchanges`.
1558
1728
  *
1559
1729
  */
1560
1730
  type DatasetImportRequest = {
@@ -1574,21 +1744,39 @@ type DatasetImportRequest = {
1574
1744
  */
1575
1745
  to: string;
1576
1746
  /**
1577
- * Optional. Omitted/blank keeps native per-trade event cadence — each swap at its own
1578
- * timestamp, so the resulting version's `cadence` is `rt` unless the swaps happen to sit
1579
- * on a fixed grid (see `DatasetVersion.cadence`). Set to `1s`, `1m` or
1580
- * `5m` instead to get pre-aggregated candles at that width rather than raw trades (the
1581
- * resulting dataset's `type` becomes `klines`); any other value is `400`. Not every
1582
- * network supports every cadence — an unsupported combination fails asynchronously, not
1583
- * at request time (see `DatasetImportState.error`).
1747
+ * Optional; what it means, and what it accepts, depends on `type`. Any other value is
1748
+ * `400`.
1749
+ *
1750
+ * * `dex` — omitted/blank keeps native per-trade event cadence: each swap at its own
1751
+ * timestamp, so the resulting version's `cadence` is `rt` unless the swaps happen to
1752
+ * sit on a fixed grid (see `DatasetVersion.cadence`). Set to `1s`, `1m` or `5m`
1753
+ * instead to get pre-aggregated candles at that width rather than raw trades (the
1754
+ * resulting dataset's `type` becomes `klines`). Not every network supports every
1755
+ * cadence — an unsupported combination fails asynchronously, not at request time (see
1756
+ * `DatasetImportState.error`).
1757
+ * * `cex` — one of `1s`, `5s`, `1m`, `3m`, `5m`, `15m`, `30m`, `1h`, `2h`, `4h`, `8h`,
1758
+ * `12h`, `1d`, `1w`, `1q`, whether `dataType` is `ticker` or `klines`. Omitted = the
1759
+ * finest cadence every part of the range holds.
1760
+ *
1761
+ * For `cex` the bars are built from the finest data every part of the range holds. A
1762
+ * `cadence` finer than that, or not an exact multiple of it, fails the import
1763
+ * asynchronously (`failed`; the `error` names the finest cadence the range holds) rather
1764
+ * than returning a dataset with a different cadence from the one asked for. So a range
1765
+ * whose history changes cadence part-way (from `1m` to `1s`, say) comes out entirely at
1766
+ * the coarser one when `cadence` is omitted: the dataset has no gap that is only a
1767
+ * change of cadence.
1584
1768
  *
1585
1769
  */
1586
- cadence?: "1s" | "1m" | "5m";
1770
+ cadence?: "1s" | "5s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "8h" | "12h" | "1d" | "1w" | "1q";
1587
1771
  /**
1588
- * The source to fetch from. `dex` is the only value today.
1772
+ * The kind of venue to import from, the same two values as the `venueType` of
1773
+ * `GET /exchanges`: `dex` — a pool/pair's own on-chain market (block `dex`) — or `cex` —
1774
+ * a centralized exchange's market history (block `cex`).
1775
+ *
1589
1776
  */
1590
- type: "dex";
1777
+ type: "dex" | "cex";
1591
1778
  dex?: DatasetImportDexRequest;
1779
+ cex?: DatasetImportCexRequest;
1592
1780
  };
1593
1781
  /**
1594
1782
  * The `dex` source's own fields — required when `type` is `dex`. `id`/`version` are required
@@ -1630,6 +1818,32 @@ type DatasetImportDexRequest = {
1630
1818
  */
1631
1819
  factory?: string;
1632
1820
  };
1821
+ /**
1822
+ * The `cex` source's own fields — required when `type` is `cex`. They name a market the way
1823
+ * `GET /exchanges` and the instruments routes do: `exchange` is the `id` of a centralized
1824
+ * exchange, `segment` one of its `segments`.
1825
+ *
1826
+ */
1827
+ type DatasetImportCexRequest = {
1828
+ /**
1829
+ * The id of a centralized exchange (`venueType` `cex`) of `GET /exchanges`, lower-case.
1830
+ * A decentralized exchange's id is `400`: import its pools with `type: dex`.
1831
+ *
1832
+ */
1833
+ exchange: string;
1834
+ /**
1835
+ * The market segment, one of the exchange's `segments`. `spot` is the only segment a
1836
+ * `cex` import takes today, which matches `instrument` being a plain spot pair.
1837
+ *
1838
+ */
1839
+ segment: "spot";
1840
+ /**
1841
+ * What to import, and the resulting dataset's `type`: `ticker` — the exchange's ticker
1842
+ * series — or `klines` — its aggregated bars (open, high, low, close and volume).
1843
+ *
1844
+ */
1845
+ dataType: "ticker" | "klines";
1846
+ };
1633
1847
  /**
1634
1848
  * The response to `POST /datasets/imports` — the dataset now exists, and its fetch has started.
1635
1849
  */
@@ -1677,7 +1891,8 @@ type DatasetImportState = {
1677
1891
  /**
1678
1892
  * A human-readable reason, present when `status` is `failed` — an unresolvable
1679
1893
  * pool/pair, no data in the requested range, a range older than the configured source
1680
- * retains, the fetch exceeding your tier's time ceiling, or any of
1894
+ * retains, a `cex` `cadence` finer than the range holds (the message names the finest
1895
+ * one), the fetch exceeding your tier's time ceiling, or any of
1681
1896
  * `DatasetUploadState.error`'s own ingest-side reasons once fetching hands off to it.
1682
1897
  * Durably recorded, same as on the upload path.
1683
1898
  *
@@ -1688,6 +1903,18 @@ type DatasetImportState = {
1688
1903
  */
1689
1904
  version?: DatasetVersion;
1690
1905
  };
1906
+ /**
1907
+ * What your API key may do, as a map from a resource to the actions allowed on it. Names are
1908
+ * lower case: `{ "backtests": ["read", "write", "execute"], "exchanges": ["read"] }`. A scope
1909
+ * is a resource and an action: a resource is listed only with at least one action, and a key
1910
+ * with no scope is `{}`. `GET /account` and `POST /auth/token` return the same map for the
1911
+ * same key. The API reports the scopes of a key; it does not yet refuse an operation because
1912
+ * a scope is missing.
1913
+ *
1914
+ */
1915
+ type KeyScopes = {
1916
+ [key: string]: Array<string>;
1917
+ };
1691
1918
  type AuthTokenResponse = {
1692
1919
  /**
1693
1920
  * Short-lived HS256 JWT. Send as `Authorization: Bearer <token>` on all other endpoints.
@@ -1701,23 +1928,20 @@ type AuthTokenResponse = {
1701
1928
  * Seconds until the JWT expires (typically 3600).
1702
1929
  */
1703
1930
  expires_in: number;
1704
- /**
1705
- * Scopes granted to this token. Reserved for future use; currently always empty.
1706
- */
1707
- scopes?: Array<string>;
1931
+ scopes?: KeyScopes;
1708
1932
  /**
1709
1933
  * Subscription tier this token was issued for. Drives rate limits and feature flags on downstream endpoints.
1710
1934
  */
1711
1935
  tier: "free" | "basic" | "pro" | "elite";
1712
1936
  };
1713
1937
  /**
1714
- * Error envelope returned by `POST /auth/token` when the API key is rejected.
1938
+ * Error envelope returned by `POST /auth/token` when the API key is rejected (`401`) or carries no scopes where scopes are required (`403`).
1715
1939
  */
1716
1940
  type AuthTokenError = {
1717
1941
  /**
1718
1942
  * Machine-readable error reason.
1719
1943
  */
1720
- code: "invalid_apikey" | "apikey_revoked" | "apikey_expired";
1944
+ code: "invalid_apikey" | "apikey_revoked" | "apikey_expired" | "apikey_without_scopes";
1721
1945
  /**
1722
1946
  * Human-readable description of the failure.
1723
1947
  */
@@ -1728,17 +1952,23 @@ type AuthTokenError = {
1728
1952
  */
1729
1953
  type LiveSource = {
1730
1954
  /**
1731
- * Venue category. `cx` (centralized exchange) is the only one live runs support today.
1955
+ * Venue category. `cex` is a centralized exchange and `dex` is one pool on a decentralized exchange, which takes its own `exchange`, `segment`, `type` and `instruments` (see "Sources" in the Live execution guide). `cx` and `dx`, the spellings used before, are still read as `cex` and `dex`; the run always reports the new ones.
1956
+ */
1957
+ venueType: "cex" | "dex";
1958
+ /**
1959
+ * The exchange id, as `GET /exchanges` lists it. For a `dex` source, the chain the pool is on; `robinhood` is the only one today.
1732
1960
  */
1733
- venueType: string;
1734
1961
  exchange: string;
1962
+ /**
1963
+ * The segment, as `GET /exchanges` lists it for that exchange, among its `liveSegments` (a segment with no live data is refused with `400`). For a `cex` source, the market segment (`spot` today); for a `dex` source, the protocol of the pool, `uniswap-v3` the only one today.
1964
+ */
1735
1965
  segment: string;
1736
1966
  /**
1737
- * Both `ticker` and `kline` connect to the lightest (fastest) cadence available for the exchange — today, 1 tick/second on every supported exchange. Choosing a specific cadence is not offered yet.
1967
+ * Both `ticker` and `kline` connect to the lightest (fastest) cadence available for the exchange — today, 1 tick/second on every supported exchange. Choosing a specific cadence is not offered yet. A `dex` source supports only `kline`: one candle per second of the pool's trades.
1738
1968
  */
1739
1969
  type: "ticker" | "kline";
1740
1970
  /**
1741
- * The instruments the run reads. For a run started with a list, that list as sent; for one started without `instruments`, or with `["*"]`, what the start resolved: the list of pairs the compilation of the strategy records as the instruments it accepts, when it records one, or `["*"]` for every instrument the exchange/segment offers (tier-gated). An entry is written `BASE/QUOTE` and either side can be `*` to mean any, such as any base paired with USDT. Symbols are not case-sensitive and spaces around them are ignored, so `btc/usdt` and `BTC/USDT` are the same instrument.
1971
+ * The instruments the run reads. For a run started with a list, that list as sent; for one started without `instruments`, or with `["*"]`, what the start resolved: the list of pairs the compilation of the strategy records as the instruments it accepts, when it records one, or `["*"]` for every instrument the exchange/segment offers (tier-gated). An entry is written `BASE/QUOTE` and either side can be `*` to mean any, such as any base paired with USDT. Symbols are not case-sensitive and spaces around them are ignored, so `btc/usdt` and `BTC/USDT` are the same instrument. A `dex` source holds exactly one entry, the address of its pool.
1742
1972
  */
1743
1973
  instruments: Array<string>;
1744
1974
  };
@@ -1747,17 +1977,23 @@ type LiveSource = {
1747
1977
  */
1748
1978
  type LiveSourceRequest = {
1749
1979
  /**
1750
- * Venue category. `cx` (centralized exchange) is the only one live runs support today.
1980
+ * Venue category. `cex` is a centralized exchange and `dex` is one pool on a decentralized exchange, which takes its own `exchange`, `segment`, `type` and `instruments` (see "Sources" in the Live execution guide). `cx` and `dx`, the spellings used before, are still read as `cex` and `dex`; the run always reports the new ones.
1981
+ */
1982
+ venueType: "cex" | "dex";
1983
+ /**
1984
+ * The exchange id, as `GET /exchanges` lists it. For a `dex` source, the chain the pool is on; `robinhood` is the only one today.
1751
1985
  */
1752
- venueType: string;
1753
1986
  exchange: string;
1987
+ /**
1988
+ * The segment, as `GET /exchanges` lists it for that exchange, among its `liveSegments` (a segment with no live data is refused with `400`). For a `cex` source, the market segment (`spot` today); for a `dex` source, the protocol of the pool, `uniswap-v3` the only one today.
1989
+ */
1754
1990
  segment: string;
1755
1991
  /**
1756
- * Both `ticker` and `kline` connect to the lightest (fastest) cadence available for the exchange — today, 1 tick/second on every supported exchange. Choosing a specific cadence is not offered yet.
1992
+ * Both `ticker` and `kline` connect to the lightest (fastest) cadence available for the exchange — today, 1 tick/second on every supported exchange. Choosing a specific cadence is not offered yet. A `dex` source supports only `kline`: one candle per second of the pool's trades.
1757
1993
  */
1758
1994
  type: "ticker" | "kline";
1759
1995
  /**
1760
- * Which instruments the run reads. A QTScript strategy can declare which instruments it accepts with an `instruments` line in its source. When the compilation of the strategy records that selection as a list of pairs, leaving `instruments` out, or sending `["*"]`, takes that list; otherwise the run reads every instrument the exchange/segment offers. A list of instruments is taken as sent, and `[]` and `null` are refused with `400`. An entry is written `BASE/QUOTE`; either side can be `*` to mean any: any base can be paired with USDT, and BTC can be paired with any quote. Entries are not case-sensitive and spaces around them are ignored, so `btc/usdt` and `BTC/USDT` are the same instrument. An entry that is not of that form (no `/`, an empty side, a `.` or a space inside a side, or a `*` mixed with other characters of a side) makes the run fail when it starts. Plan limits: a list with an entry that has a `*` on a side counts like `["*"]` and only plans that include the wildcard accept it; the other entries are counted one by one. The instruments the run actually reads come back in the run's `sources`.
1996
+ * Which instruments the run reads. A QTScript strategy can declare which instruments it accepts with an `instruments` line in its source. When the compilation of the strategy records that selection as a list of pairs, leaving `instruments` out, or sending `["*"]`, takes that list; otherwise the run reads every instrument the exchange/segment offers. A list of instruments is taken as sent, and `[]` and `null` are refused with `400`. An entry is written `BASE/QUOTE`; either side can be `*` to mean any: any base can be paired with USDT, and BTC can be paired with any quote. Entries are not case-sensitive and spaces around them are ignored, so `btc/usdt` and `BTC/USDT` are the same instrument. An entry that is not of that form (no `/`, an empty side, a `.` or a space inside a side, or a `*` mixed with other characters of a side) makes the run fail when it starts. Plan limits: a list with an entry that has a `*` on a side counts like `["*"]` and only plans that include the wildcard accept it; the other entries are counted one by one. The instruments the run actually reads come back in the run's `sources`. A `dex` source needs exactly one entry, the address of its pool (`0x` and 40 hexadecimal digits, not case-sensitive): it cannot be left out and `*` is not accepted.
1761
1997
  */
1762
1998
  instruments?: Array<string>;
1763
1999
  };
@@ -1908,12 +2144,15 @@ type LiveRun = {
1908
2144
  * stack trace or an internal message. Either `resource: ...` (the platform stopped the run for
1909
2145
  * exceeding its resource allowance; the text says which limit) or one of a fixed set of sentences for
1910
2146
  * a `FAILED` run: the strategy cannot consume the source type the run was started with, the run's
1911
- * definition was refused, the run could not start after several attempts, the strategy failed while
1912
- * processing data, the run lost its data feed, or the generic `The run failed.`. The set may grow:
2147
+ * definition was refused, the pool address of a `dex` run is not a pool of its protocol on its chain,
2148
+ * the platform has no room to follow the pool of a `dex` run, the run could not start after several
2149
+ * attempts, the strategy failed while processing data, the run lost its data feed, or the generic
2150
+ * `The run failed.`. The set may grow:
1913
2151
  * read an unrecognised sentence as a failure and do not parse it. A `FAILED` run usually stays
1914
2152
  * `desired: RUNNING` until you stop it, and counts as active (`409` on a new start, and toward your
1915
- * live-run limit) until then; one that can never run because its strategy cannot consume its source
1916
- * type is stopped by the platform itself (`desired: STOPPED`), so it holds no place.
2153
+ * live-run limit) until then; one that cannot run, and will not by waiting, because its strategy cannot
2154
+ * consume its source type or because the pool of a `dex` run is not a pool or has no room to be followed,
2155
+ * is stopped by the platform itself (`desired: STOPPED`), so it holds no place.
1917
2156
  *
1918
2157
  */
1919
2158
  reason?: string;
@@ -2082,12 +2321,15 @@ type LiveRunSummary = {
2082
2321
  * stack trace or an internal message. Either `resource: ...` (the platform stopped the run for
2083
2322
  * exceeding its resource allowance; the text says which limit) or one of a fixed set of sentences for
2084
2323
  * a `FAILED` run: the strategy cannot consume the source type the run was started with, the run's
2085
- * definition was refused, the run could not start after several attempts, the strategy failed while
2086
- * processing data, the run lost its data feed, or the generic `The run failed.`. The set may grow:
2324
+ * definition was refused, the pool address of a `dex` run is not a pool of its protocol on its chain,
2325
+ * the platform has no room to follow the pool of a `dex` run, the run could not start after several
2326
+ * attempts, the strategy failed while processing data, the run lost its data feed, or the generic
2327
+ * `The run failed.`. The set may grow:
2087
2328
  * read an unrecognised sentence as a failure and do not parse it. A `FAILED` run usually stays
2088
2329
  * `desired: RUNNING` until you stop it, and counts as active (`409` on a new start, and toward your
2089
- * live-run limit) until then; one that can never run because its strategy cannot consume its source
2090
- * type is stopped by the platform itself (`desired: STOPPED`), so it holds no place.
2330
+ * live-run limit) until then; one that cannot run, and will not by waiting, because its strategy cannot
2331
+ * consume its source type or because the pool of a `dex` run is not a pool or has no room to be followed,
2332
+ * is stopped by the platform itself (`desired: STOPPED`), so it holds no place.
2091
2333
  *
2092
2334
  */
2093
2335
  reason?: string;
@@ -2352,6 +2594,10 @@ type AuthenticateErrors = {
2352
2594
  * API key is invalid, revoked, or expired.
2353
2595
  */
2354
2596
  401: AuthTokenError;
2597
+ /**
2598
+ * The API key is valid but carries no scopes, and this deployment requires them.
2599
+ */
2600
+ 403: AuthTokenError;
2355
2601
  /**
2356
2602
  * Rate limit exceeded for this API key.
2357
2603
  */
@@ -2417,16 +2663,20 @@ type ListInstrumentsData = {
2417
2663
  };
2418
2664
  type ListInstrumentsErrors = {
2419
2665
  /**
2420
- * Exchange not found or instrument catalog not available
2666
+ * The exchange is not one `GET /exchanges` lists
2667
+ */
2668
+ 400: ResponseError;
2669
+ /**
2670
+ * The instrument catalog is not available
2421
2671
  */
2422
2672
  404: ResponseError;
2423
2673
  };
2424
2674
  type ListInstrumentsError = ListInstrumentsErrors[keyof ListInstrumentsErrors];
2425
2675
  type ListInstrumentsResponses = {
2426
2676
  /**
2427
- * The default (spot) segment's instruments in `data`, `meta`, and HAL `_links` (self + spot/futures segment discovery)
2677
+ * The default (spot) segment's instruments in `data`, `meta`, and HAL `_links` (self + spot/futures segment discovery); for a decentralized exchange, its pools
2428
2678
  */
2429
- 200: InstrumentListResponse;
2679
+ 200: InstrumentCatalogueResponse;
2430
2680
  };
2431
2681
  type ListInstrumentsResponse = ListInstrumentsResponses[keyof ListInstrumentsResponses];
2432
2682
  type ListSegmentInstrumentsData = {
@@ -2437,16 +2687,20 @@ type ListSegmentInstrumentsData = {
2437
2687
  */
2438
2688
  exchangeId: string;
2439
2689
  /**
2440
- * Market segment to list instruments for
2690
+ * The segment to list instruments for, one of the exchange's `segments` in `GET /exchanges`; `spot` or `futures` for a centralized exchange, a protocol (`uniswap-v3`) for a decentralized one
2441
2691
  */
2442
- segment: "spot" | "futures";
2692
+ segment: string;
2443
2693
  };
2444
2694
  query?: never;
2445
2695
  url: "/exchange/{exchangeId}/{segment}/instruments";
2446
2696
  };
2447
2697
  type ListSegmentInstrumentsErrors = {
2448
2698
  /**
2449
- * Exchange, segment, or instrument catalog not found
2699
+ * The exchange is not one `GET /exchanges` lists, or the segment is not one the exchange has (`spot` or `futures` for a centralized exchange, a protocol for a decentralized one)
2700
+ */
2701
+ 400: ResponseError;
2702
+ /**
2703
+ * The instrument catalog is not available
2450
2704
  */
2451
2705
  404: ResponseError;
2452
2706
  };
@@ -2455,7 +2709,7 @@ type ListSegmentInstrumentsResponses = {
2455
2709
  /**
2456
2710
  * An object with a `data` array of instrument details (each with per-data-type coverage) and a `meta` block
2457
2711
  */
2458
- 200: InstrumentListResponse;
2712
+ 200: InstrumentCatalogueResponse;
2459
2713
  };
2460
2714
  type ListSegmentInstrumentsResponse = ListSegmentInstrumentsResponses[keyof ListSegmentInstrumentsResponses];
2461
2715
  type DownloadTickersData = {
@@ -2493,25 +2747,38 @@ type DownloadTickersData = {
2493
2747
  };
2494
2748
  type DownloadTickersErrors = {
2495
2749
  /**
2496
- * Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
2750
+ * Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`), an `hour` in the
2751
+ * future, or an hour older than the last 7 days (`reason: OUTSIDE_WINDOW`, with `next`).
2752
+ *
2497
2753
  */
2498
2754
  400: ResponseError;
2499
2755
  /**
2500
- * No Lastra segment exists for the requested instrument/hour.
2756
+ * No segment for the requested instrument/hour. `reason: NOT_YET_AVAILABLE` — the hour
2757
+ * is not stored yet and no provisional answer was given for it (the answer carries
2758
+ * `Retry-After`); `reason: NO_DATA` — the hour is stored and holds nothing for this
2759
+ * instrument.
2760
+ *
2501
2761
  */
2502
2762
  404: ResponseError;
2503
2763
  /**
2504
2764
  * Unexpected I/O error serving the file.
2505
2765
  */
2506
2766
  500: ResponseError;
2767
+ /**
2768
+ * Reads are being limited (of stored or of provisional data) and this one was not served
2769
+ * (`reason: TEMPORARILY_UNAVAILABLE`). Ask again after the `Retry-After` delay.
2770
+ *
2771
+ */
2772
+ 503: ResponseError;
2507
2773
  };
2508
2774
  type DownloadTickersError = DownloadTickersErrors[keyof DownloadTickersErrors];
2509
2775
  type DownloadTickersResponses = {
2510
2776
  /**
2511
2777
  * One hour of tickers for the instrument. `Content-Type` is
2512
- * `application/vnd.lastra` by default or
2778
+ * `application/vnd.qtsurfer.lastra` by default or
2513
2779
  * `application/vnd.apache.parquet` when `format=parquet` was
2514
- * requested.
2780
+ * requested. The hour in progress, or one that has ended and is not stored yet, may be
2781
+ * provisional where the service gives provisional answers: see `X-Data-Status`.
2515
2782
  *
2516
2783
  */
2517
2784
  200: Blob | File;
@@ -2551,24 +2818,38 @@ type DownloadKlinesData = {
2551
2818
  };
2552
2819
  type DownloadKlinesErrors = {
2553
2820
  /**
2554
- * Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
2821
+ * Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`), an `hour` in the
2822
+ * future, or an hour older than the last 7 days (`reason: OUTSIDE_WINDOW`, with `next`).
2823
+ *
2555
2824
  */
2556
2825
  400: ResponseError;
2557
2826
  /**
2558
- * No Lastra segment exists for the requested instrument/hour.
2827
+ * No segment for the requested instrument/hour. `reason: NOT_YET_AVAILABLE` — the hour
2828
+ * is not stored yet and no provisional answer was given for it (the answer carries
2829
+ * `Retry-After`); `reason: NO_DATA` — the hour is stored and holds nothing for this
2830
+ * instrument.
2831
+ *
2559
2832
  */
2560
2833
  404: ResponseError;
2561
2834
  /**
2562
2835
  * Unexpected I/O error serving the file.
2563
2836
  */
2564
2837
  500: ResponseError;
2838
+ /**
2839
+ * Reads are being limited (of stored or of provisional data) and this one was not served
2840
+ * (`reason: TEMPORARILY_UNAVAILABLE`). Ask again after the `Retry-After` delay.
2841
+ *
2842
+ */
2843
+ 503: ResponseError;
2565
2844
  };
2566
2845
  type DownloadKlinesError = DownloadKlinesErrors[keyof DownloadKlinesErrors];
2567
2846
  type DownloadKlinesResponses = {
2568
2847
  /**
2569
2848
  * One hour of klines for the instrument. `Content-Type` is
2570
- * `application/vnd.lastra` by default or
2571
- * `application/vnd.apache.parquet` when `format=parquet`.
2849
+ * `application/vnd.qtsurfer.lastra` by default or
2850
+ * `application/vnd.apache.parquet` when `format=parquet` was
2851
+ * requested. The hour in progress, or one that has ended and is not stored yet, may be
2852
+ * provisional where the service gives provisional answers: see `X-Data-Status`.
2572
2853
  *
2573
2854
  */
2574
2855
  200: Blob | File;
@@ -3448,6 +3729,15 @@ type ImportDatasetErrors = {
3448
3729
  * `cadence`, whether that combination is actually servable on the requested `network` —
3449
3730
  * is checked later, asynchronously — see the `failed` status on the poll endpoint below.
3450
3731
  *
3732
+ * For `type: cex`: no `cex` block, or its `exchange` is not a centralized exchange of
3733
+ * `GET /exchanges` (a decentralized one is `400` too — use `type: dex`), `segment` is not
3734
+ * `spot` (the only segment a `cex` import takes today), `dataType` is not `ticker` or
3735
+ * `klines`, or
3736
+ * `cadence` is not one of the values a `cex` import takes (see `DatasetImportRequest`).
3737
+ * Whether the range holds data, and whether it holds data fine enough for the `cadence`
3738
+ * asked, is checked later, asynchronously — see the `failed` status on the poll endpoint
3739
+ * below.
3740
+ *
3451
3741
  */
3452
3742
  400: ResponseError;
3453
3743
  /**
@@ -3563,7 +3853,7 @@ type StartLiveData = {
3563
3853
  };
3564
3854
  type StartLiveErrors = {
3565
3855
  /**
3566
- * Malformed `sources` (not exactly one entry, missing field, unsupported `type`), a `type` the strategy cannot consume (a ticker strategy with a `kline` source, or the reverse; the message names both), an invalid `visibility`, an invalid `paper` block (an unknown field, a wrong type or an out-of-range value), or no `paper` block for a strategy that listens to its own execution events. A `relay` or `stream` that is not `true` or `false`, or a `stream` where streams are not available yet. A `warmFrom` that is not an integer from 0 to 3600. An `instruments` that is empty or `null`.
3856
+ * Malformed `sources` (not exactly one entry, missing field, unsupported `type`), a `venueType`, `exchange` and `segment` that `GET /exchanges` does not list together, or a segment with no live data (the message names what it lists), a `type` the strategy cannot consume (a ticker strategy with a `kline` source, or the reverse; the message names both), an invalid `visibility`, an invalid `paper` block (an unknown field, a wrong type or an out-of-range value), or no `paper` block for a strategy that listens to its own execution events. A `relay` or `stream` that is not `true` or `false`, or a `stream` where streams are not available yet. A `warmFrom` that is not an integer from 0 to 3600. An `instruments` that is empty or `null`.
3567
3857
  */
3568
3858
  400: ResponseError;
3569
3859
  /**
@@ -3995,6 +4285,10 @@ type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean
3995
4285
  * expires after `expires_in` seconds. Callers should refresh the token
3996
4286
  * before expiry (or on a `401` response) by calling this endpoint again.
3997
4287
  *
4288
+ * The answer's `scopes` say what the key may do. Where a deployment requires scopes, a key
4289
+ * that carries none is refused with `403` and the code `apikey_without_scopes`: create a key
4290
+ * with at least one scope.
4291
+ *
3998
4292
  */
3999
4293
  declare const authenticate: <ThrowOnError extends boolean = false>(options?: Options<AuthenticateData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AuthTokenResponse, unknown, ThrowOnError>;
4000
4294
  /**
@@ -4017,6 +4311,18 @@ declare const getAccount: <ThrowOnError extends boolean = false>(options?: Optio
4017
4311
  declare const getAccountUsage: <ThrowOnError extends boolean = false>(options?: Options<GetAccountUsageData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<AccountUsage, unknown, ThrowOnError>;
4018
4312
  /**
4019
4313
  * List the available exchanges
4314
+ * The exchanges the platform knows, centralized and decentralized, each with its `venueType` and the
4315
+ * `segments` it offers. Ids, venue types and segments are lower-case, and are written the same way
4316
+ * wherever the API takes them: `/exchange/binance/spot/instruments`, and the `exchange`, `venueType`
4317
+ * and `segment` of a live run's source.
4318
+ *
4319
+ * `venueType` is `cex` for a centralized exchange and `dex` for a decentralized one. The `segments` of a
4320
+ * `cex` exchange are the market segments its instrument catalogues are served under (`spot`, `futures`);
4321
+ * its `liveSegments`, among them, are those a live run can read, because live data is published for them.
4322
+ * A `dex` exchange has no market data to prepare or backtest, so its id is `400` in the routes that take an
4323
+ * `exchangeId`, except the two instruments routes: its `segments` are the protocols whose pools a run can
4324
+ * read, and those routes list the pools, since the instrument of a run on it is a pool's address.
4325
+ *
4020
4326
  */
4021
4327
  declare const listExchanges: <ThrowOnError extends boolean = false>(options?: Options<ListExchangesData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Exchange[], unknown, ThrowOnError>;
4022
4328
  /**
@@ -4026,8 +4332,12 @@ declare const listExchanges: <ThrowOnError extends boolean = false>(options?: Op
4026
4332
  * confirms the served `segment` (`spot`); HAL `_links` carry `self` plus the
4027
4333
  * `spot` / `futures` segment-discovery links.
4028
4334
  *
4335
+ * For a decentralized exchange (`venueType` `dex` in `GET /exchanges`) the instruments are its pools,
4336
+ * each a `PoolDetail`, and the default segment is the first one the exchange lists (`uniswap-v3` for
4337
+ * `robinhood`).
4338
+ *
4029
4339
  */
4030
- declare const listInstruments: <ThrowOnError extends boolean = false>(options: Options<ListInstrumentsData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<InstrumentListResponse, ResponseError, ThrowOnError>;
4340
+ declare const listInstruments: <ThrowOnError extends boolean = false>(options: Options<ListInstrumentsData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<InstrumentCatalogueResponse, ResponseError, ThrowOnError>;
4031
4341
  /**
4032
4342
  * List an exchange segment's instruments
4033
4343
  * Returns the instruments for one market segment of the exchange, each with
@@ -4035,8 +4345,13 @@ declare const listInstruments: <ThrowOnError extends boolean = false>(options: O
4035
4345
  * `spot` / `futures` segment-discovery links; the default-segment shortcut is
4036
4346
  * `GET /exchange/{exchangeId}/instruments` (spot).
4037
4347
  *
4348
+ * For a decentralized exchange the segments are its protocols (`uniswap-v3` for `robinhood`) and the
4349
+ * instruments are its pools, each a `PoolDetail`: the 50 with most volume in the last 24 hours among
4350
+ * those with at least 10,000 US dollars of liquidity, refreshed every hour. The list is a place to
4351
+ * start, not the whole market: a live run can read any pool of the protocol, listed or not.
4352
+ *
4038
4353
  */
4039
- declare const listSegmentInstruments: <ThrowOnError extends boolean = false>(options: Options<ListSegmentInstrumentsData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<InstrumentListResponse, ResponseError, ThrowOnError>;
4354
+ declare const listSegmentInstruments: <ThrowOnError extends boolean = false>(options: Options<ListSegmentInstrumentsData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<InstrumentCatalogueResponse, ResponseError, ThrowOnError>;
4040
4355
  /**
4041
4356
  * Download one hour of tickers for an instrument as a Lastra segment
4042
4357
  * Serves exactly one hour of raw ticker data for the given instrument on the
@@ -4046,9 +4361,33 @@ declare const listSegmentInstruments: <ThrowOnError extends boolean = false>(opt
4046
4361
  *
4047
4362
  * One segment = one hour, aligned to UTC. The `hour` query parameter selects
4048
4363
  * the segment and must match `YYYY-MM-DDTHH` (no minutes/seconds, no timezone
4049
- * suffix). Example: `hour=2026-01-15T10` returns `h10.lastra` for
4050
- * 2026-01-15, covering `[10:00:00Z, 11:00:00Z)`. Hours not yet available
4051
- * return `404`.
4364
+ * suffix). Example: `hour=2026-10-15T10` is the segment `h10.lastra` of
4365
+ * 2026-10-15, covering `[10:00:00Z, 11:00:00Z)`. The hour has to be one of the last 7 days (see
4366
+ * below): read the example as the shape of the value.
4367
+ *
4368
+ * **Which hours.** The last 7 days: an hour that started no more than 7 days before the
4369
+ * request and has ended. This route gives one hour of one instrument, fast; it is not how to
4370
+ * get older history or a range. An older hour is `400` with `reason: OUTSIDE_WINDOW`, and the
4371
+ * error carries `next`, the `POST /datasets/imports` request that imports exactly that hour
4372
+ * as a dataset (add a `name`); a longer span is imported the same way, within your plan's
4373
+ * limits.
4374
+ *
4375
+ * **The hour in progress and the last hours.** The hour in progress, and an hour that has ended
4376
+ * but is not stored yet, can be answered with what has been received so far, marked provisional:
4377
+ * `200` with `X-Data-Status: provisional` and `X-Data-Through`, the instant of the last row.
4378
+ * Not every deployment of the service gives provisional answers: where it does not, those hours
4379
+ * are `404` with `reason: NOT_YET_AVAILABLE` and a `Retry-After`, and a client that needs them
4380
+ * handles both. A provisional answer is not to keep: it can still grow, and the stored hour
4381
+ * replaces it once there is one. It takes seconds to build, longer the further the hour has gone,
4382
+ * and the service limits how many it builds at once (`503` with `Retry-After`). When there is
4383
+ * nothing to give, because the instrument has no rows in the hour yet or what has been received
4384
+ * does not reach back to the start of the hour, the answer is also `404` with
4385
+ * `reason: NOT_YET_AVAILABLE`.
4386
+ *
4387
+ * **Timestamps.** In a Lastra response the `ts` column holds microseconds since the epoch,
4388
+ * declared by `ts_unit: micros` in the column's metadata and by the response header
4389
+ * `X-Ts-Unit: micros`. In a Parquet response the timestamp column is a `TIMESTAMP` in
4390
+ * milliseconds.
4052
4391
  *
4053
4392
  * A `format=parquet` query parameter switches the response to on-the-fly
4054
4393
  * Parquet conversion via [lastra-convert](https://github.com/QTSurfer/lastra-convert)
@@ -4081,6 +4420,9 @@ declare const downloadTickers: <ThrowOnError extends boolean = false>(options: O
4081
4420
  * format read the other with the same code. Use this endpoint when a
4082
4421
  * per-tick payload would be too large for the window of interest.
4083
4422
  *
4423
+ * The hours served (the last 7 days; the hour in progress and the last hours may be provisional), the timestamps
4424
+ * (`ts` in microseconds, `X-Ts-Unit: micros`) and the errors are those of the tickers route.
4425
+ *
4084
4426
  */
4085
4427
  declare const downloadKlines: <ThrowOnError extends boolean = false>(options: Options<DownloadKlinesData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Blob | File, ResponseError, ThrowOnError>;
4086
4428
  /**
@@ -4531,8 +4873,18 @@ declare const getDatasetUpload: <ThrowOnError extends boolean = false>(options:
4531
4873
  * as a dataset version indistinguishable from an uploaded one once it's ready. Poll
4532
4874
  * `GET /datasets/{datasetId}/imports/{importId}` for progress.
4533
4875
  *
4534
- * `type` selects the source. `dex` — history over a pool/pair's own on-chain market — is the
4535
- * only value today; other source types join this same endpoint later.
4876
+ * `type` selects the kind of venue the history comes from, with the same two values as the
4877
+ * `venueType` of `GET /exchanges`: `dex` — history over a pool/pair's own on-chain market —
4878
+ * and `cex` — the history of a centralized exchange's market, kept by the platform. Each
4879
+ * has its own block (`dex`, `cex`). The exchange id of a `cex` import has to be a centralized
4880
+ * exchange of `GET /exchanges`; a decentralized one (`robinhood`, say) is `400`, and is imported
4881
+ * with `type: dex`.
4882
+ *
4883
+ * A `cex` import covers one instrument over a range: the API reads that range of the
4884
+ * exchange's history, builds the bars of the requested `cadence` from the finest data it has
4885
+ * for it, and stores the result as a dataset version, exactly as for an upload. `cex.dataType`
4886
+ * picks tickers or klines and is also the resulting dataset's `type`. The range is capped by
4887
+ * your tier like any import (`maxImportRangeHours` of `GET /account`).
4536
4888
  *
4537
4889
  * A `dex` import has two data shapes, chosen by the top-level `cadence`:
4538
4890
  *
@@ -4607,7 +4959,16 @@ declare const getLive: <ThrowOnError extends boolean = false>(options: Options<G
4607
4959
  * (fastest) cadence available for the exchange — today that is 1 tick/second on every
4608
4960
  * supported exchange; choosing among several cadences is not offered yet.
4609
4961
  *
4610
- * `instruments` can be left out. A QTScript strategy can declare which instruments it accepts with an `instruments`
4962
+ * `venueType` is `cex` (a centralized exchange) or `dex` (one pool on a decentralized exchange). A `dex` source reads one
4963
+ * pool, takes only `kline`, and needs the pool's address as its single instrument. See the "Live execution" guide,
4964
+ * "Sources".
4965
+ *
4966
+ * `venueType`, `exchange` and `segment` have to be ones `GET /exchanges` lists together: the exchange under that
4967
+ * venue type, and the segment among its `liveSegments`. Case and the spaces around a value do not matter, and the
4968
+ * run reports them back in lower case (`cx`, the older spelling of `cex`, is still read). Anything else is refused
4969
+ * with `400`, naming what the list has.
4970
+ *
4971
+ * `instruments` can be left out, except for a `dex` source. A QTScript strategy can declare which instruments it accepts with an `instruments`
4611
4972
  * line in its source; when the compilation of the strategy records that selection as a list of pairs, a
4612
4973
  * start that leaves `instruments` out, or sends `["*"]`, takes that list, and otherwise the run reads every
4613
4974
  * instrument the exchange/segment offers. A list you send is taken as sent. Either side of an entry can be `*`
@@ -4820,4 +5181,4 @@ declare const mintLiveConnectionToken: <ThrowOnError extends boolean = false>(op
4820
5181
 
4821
5182
  declare const client: _hey_api_client_fetch.Client;
4822
5183
 
4823
- export { type AcceptedJob, type Account, type AccountLinks, type AccountUsage, type AccountUsageLinks, 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 GetAccountData, type GetAccountResponse, type GetAccountResponses, type GetAccountUsageData, type GetAccountUsageResponse, type GetAccountUsageResponses, 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 GetLiveData, type GetLiveError, type GetLiveErrors, type GetLiveResponse, type GetLiveResponses, type GetLiveRunData, type GetLiveRunError, type GetLiveRunErrors, type GetLiveRunPaperData, type GetLiveRunPaperEquityData, type GetLiveRunPaperEquityError, type GetLiveRunPaperEquityErrors, type GetLiveRunPaperEquityResponse, type GetLiveRunPaperEquityResponses, type GetLiveRunPaperError, type GetLiveRunPaperErrors, type GetLiveRunPaperResponse, type GetLiveRunPaperResponses, type GetLiveRunResponse, type GetLiveRunResponses, type GetLiveRunSignalsData, type GetLiveRunSignalsError, type GetLiveRunSignalsErrors, type GetLiveRunSignalsResponse, type GetLiveRunSignalsResponses, 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 ListLiveData, type ListLiveError, type ListLiveErrors, type ListLiveResponse, type ListLiveResponses, type ListPublicLiveData, type ListPublicLiveError, type ListPublicLiveErrors, type ListPublicLiveResponse, type ListPublicLiveResponses, type ListSegmentInstrumentsData, type ListSegmentInstrumentsError, type ListSegmentInstrumentsErrors, type ListSegmentInstrumentsResponse, type ListSegmentInstrumentsResponses, type ListStrategiesData, type ListStrategiesResponse, type ListStrategiesResponses, type LiveCommandResult, type LiveConnectionToken, type LiveListResponse, type LivePaper, type LivePaperAccount, type LivePaperConfig, type LivePaperEquityPage, type LivePaperEquityPoint, type LivePaperKpi, type LivePaperPosition, type LiveParamsUpdateResult, type LiveRun, type LiveRunCompact, type LiveRunDetail, type LiveRunStats, type LiveRunSummary, type LiveRunWithStream, type LiveSignal, type LiveSignalInstrument, type LiveSignalOrder, type LiveSignalPage, type LiveSource, type LiveSourceRequest, type LiveStreamRevoked, type LiveStreamUrl, type MintLiveConnectionTokenData, type MintLiveConnectionTokenResponse, type MintLiveConnectionTokenResponses, 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 PublicLiveListLinks, type PublicLiveListResponse, type PublicLiveNextLink, type PublicLiveRun, type ResponseError, type ResultMap, type RevokeLiveStreamData, type RevokeLiveStreamError, type RevokeLiveStreamErrors, type RevokeLiveStreamResponse, type RevokeLiveStreamResponses, type RotateLiveStreamData, type RotateLiveStreamError, type RotateLiveStreamErrors, type RotateLiveStreamResponse, type RotateLiveStreamResponses, type ScalarStrategyParamValue, type SendLiveCommandData, type SendLiveCommandError, type SendLiveCommandErrors, type SendLiveCommandRequest, type SendLiveCommandResponse, type SendLiveCommandResponses, type StartLiveData, type StartLiveError, type StartLiveErrors, type StartLiveRequest, type StartLiveResponse, type StartLiveResponses, type StopLiveData, type StopLiveError, type StopLiveErrors, type StopLiveResponse, type StopLiveResponses, 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 UpdateLiveData, type UpdateLiveError, type UpdateLiveErrors, type UpdateLiveParamsData, type UpdateLiveParamsError, type UpdateLiveParamsErrors, type UpdateLiveParamsRequest, type UpdateLiveParamsResponse, type UpdateLiveParamsResponses, type UpdateLiveRequest, type UpdateLiveResponse, type UpdateLiveResponses, type ValidateStrategyData, type ValidateStrategyError, type ValidateStrategyErrors, type ValidateStrategyResponse, type ValidateStrategyResponses, type WalkForwardAccepted, type WalkForwardFold, type WalkForwardRequest, type WalkForwardResult, type WarmFrom, authenticate, cancelBacktest, cancelSweep, client, compileStrategy, createDataset, deleteDataset, deleteStrategy, downloadKlines, downloadTickers, executeBacktest, executeSweep, finalizeDatasetUpload, getAccount, getAccountUsage, getBacktestResult, getDataset, getDatasetImport, getDatasetUpload, getLive, getLiveRun, getLiveRunPaper, getLiveRunPaperEquity, getLiveRunSignals, getPrepareStatus, getStrategy, getStrategyCode, getSweepResult, getSweepRunEquityCurve, getSweepSensitivity, importDataset, listDatasets, listExchanges, listInstruments, listLive, listPublicLive, listSegmentInstruments, listStrategies, mintLiveConnectionToken, openDatasetUpload, prepareBacktest, revokeLiveStream, rotateLiveStream, sendLiveCommand, startLive, stopLive, updateLive, updateLiveParams, validateStrategy };
5184
+ export { type AcceptedJob, type Account, type AccountLinks, type AccountUsage, type AccountUsageLinks, 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 DatasetImportCexRequest, 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 ErrorNextCall, 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 GetAccountData, type GetAccountResponse, type GetAccountResponses, type GetAccountUsageData, type GetAccountUsageResponse, type GetAccountUsageResponses, 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 GetLiveData, type GetLiveError, type GetLiveErrors, type GetLiveResponse, type GetLiveResponses, type GetLiveRunData, type GetLiveRunError, type GetLiveRunErrors, type GetLiveRunPaperData, type GetLiveRunPaperEquityData, type GetLiveRunPaperEquityError, type GetLiveRunPaperEquityErrors, type GetLiveRunPaperEquityResponse, type GetLiveRunPaperEquityResponses, type GetLiveRunPaperError, type GetLiveRunPaperErrors, type GetLiveRunPaperResponse, type GetLiveRunPaperResponses, type GetLiveRunResponse, type GetLiveRunResponses, type GetLiveRunSignalsData, type GetLiveRunSignalsError, type GetLiveRunSignalsErrors, type GetLiveRunSignalsResponse, type GetLiveRunSignalsResponses, 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 InstrumentCatalogueResponse, type InstrumentCoverage, type InstrumentDetail, type InstrumentLinks, type InstrumentListMeta, type InstrumentListResponse, type JobState, type KeyScopes, type ListDatasetsData, type ListDatasetsResponse, type ListDatasetsResponses, type ListExchangesData, type ListExchangesResponse, type ListExchangesResponses, type ListInstrumentsData, type ListInstrumentsError, type ListInstrumentsErrors, type ListInstrumentsResponse, type ListInstrumentsResponses, type ListLiveData, type ListLiveError, type ListLiveErrors, type ListLiveResponse, type ListLiveResponses, type ListPublicLiveData, type ListPublicLiveError, type ListPublicLiveErrors, type ListPublicLiveResponse, type ListPublicLiveResponses, type ListSegmentInstrumentsData, type ListSegmentInstrumentsError, type ListSegmentInstrumentsErrors, type ListSegmentInstrumentsResponse, type ListSegmentInstrumentsResponses, type ListStrategiesData, type ListStrategiesResponse, type ListStrategiesResponses, type LiveCommandResult, type LiveConnectionToken, type LiveListResponse, type LivePaper, type LivePaperAccount, type LivePaperConfig, type LivePaperEquityPage, type LivePaperEquityPoint, type LivePaperKpi, type LivePaperPosition, type LiveParamsUpdateResult, type LiveRun, type LiveRunCompact, type LiveRunDetail, type LiveRunStats, type LiveRunSummary, type LiveRunWithStream, type LiveSignal, type LiveSignalInstrument, type LiveSignalOrder, type LiveSignalPage, type LiveSource, type LiveSourceRequest, type LiveStreamRevoked, type LiveStreamUrl, type MintLiveConnectionTokenData, type MintLiveConnectionTokenResponse, type MintLiveConnectionTokenResponses, type Notice, type OpenDatasetUploadData, type OpenDatasetUploadError, type OpenDatasetUploadErrors, type OpenDatasetUploadResponse, type OpenDatasetUploadResponses, type Options, type PoolDetail, type PoolLinks, type PoolListMeta, type PoolListResponse, type PrepareBacktestData, type PrepareBacktestError, type PrepareBacktestErrors, type PrepareBacktestResponse, type PrepareBacktestResponses, type PrepareJobState, type PrepareRequest, type PublicLiveListLinks, type PublicLiveListResponse, type PublicLiveNextLink, type PublicLiveRun, type ResponseError, type ResultMap, type RevokeLiveStreamData, type RevokeLiveStreamError, type RevokeLiveStreamErrors, type RevokeLiveStreamResponse, type RevokeLiveStreamResponses, type RotateLiveStreamData, type RotateLiveStreamError, type RotateLiveStreamErrors, type RotateLiveStreamResponse, type RotateLiveStreamResponses, type ScalarStrategyParamValue, type SendLiveCommandData, type SendLiveCommandError, type SendLiveCommandErrors, type SendLiveCommandRequest, type SendLiveCommandResponse, type SendLiveCommandResponses, type StartLiveData, type StartLiveError, type StartLiveErrors, type StartLiveRequest, type StartLiveResponse, type StartLiveResponses, type StopLiveData, type StopLiveError, type StopLiveErrors, type StopLiveResponse, type StopLiveResponses, 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 UpdateLiveData, type UpdateLiveError, type UpdateLiveErrors, type UpdateLiveParamsData, type UpdateLiveParamsError, type UpdateLiveParamsErrors, type UpdateLiveParamsRequest, type UpdateLiveParamsResponse, type UpdateLiveParamsResponses, type UpdateLiveRequest, type UpdateLiveResponse, type UpdateLiveResponses, type ValidateStrategyData, type ValidateStrategyError, type ValidateStrategyErrors, type ValidateStrategyResponse, type ValidateStrategyResponses, type WalkForwardAccepted, type WalkForwardFold, type WalkForwardRequest, type WalkForwardResult, type WarmFrom, authenticate, cancelBacktest, cancelSweep, client, compileStrategy, createDataset, deleteDataset, deleteStrategy, downloadKlines, downloadTickers, executeBacktest, executeSweep, finalizeDatasetUpload, getAccount, getAccountUsage, getBacktestResult, getDataset, getDatasetImport, getDatasetUpload, getLive, getLiveRun, getLiveRunPaper, getLiveRunPaperEquity, getLiveRunSignals, getPrepareStatus, getStrategy, getStrategyCode, getSweepResult, getSweepRunEquityCurve, getSweepSensitivity, importDataset, listDatasets, listExchanges, listInstruments, listLive, listPublicLive, listSegmentInstruments, listStrategies, mintLiveConnectionToken, openDatasetUpload, prepareBacktest, revokeLiveStream, rotateLiveStream, sendLiveCommand, startLive, stopLive, updateLive, updateLiveParams, validateStrategy };