@qtsurfer/api-client 0.16.0 → 0.18.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 +12 -2
- package/dist/index.d.ts +742 -21
- package/dist/index.js +123 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/generated/schemas.gen.ts +578 -7
- package/src/generated/sdk.gen.ts +355 -8
- package/src/generated/types.gen.ts +648 -12
|
@@ -287,8 +287,17 @@ export type Exchange = {
|
|
|
287
287
|
|
|
288
288
|
/**
|
|
289
289
|
* Managed exchange data sources available for backtesting.
|
|
290
|
+
*
|
|
291
|
+
* * `ticker` — trades. Can be prepared, executed and swept.
|
|
292
|
+
* * `kline` — aggregated bars (candlesticks). Can be prepared, executed and swept. A run reads
|
|
293
|
+
* bars of the `cadence` the data was prepared at: you choose the bar width when you prepare,
|
|
294
|
+
* and the strategy does not fix it. See `PrepareRequest.cadence` for the accepted values.
|
|
295
|
+
* * `funding` — funding rates. Can be **prepared but not executed or swept yet**: a `funding`
|
|
296
|
+
* request to `execute` or `executeSweep` is rejected with `400` before anything is queued,
|
|
297
|
+
* and the message names the sources that can be run.
|
|
298
|
+
*
|
|
290
299
|
*/
|
|
291
|
-
export type DataSourceType = "ticker";
|
|
300
|
+
export type DataSourceType = "ticker" | "kline" | "funding";
|
|
292
301
|
|
|
293
302
|
/**
|
|
294
303
|
* Two shapes, chosen by the `exchangeId` path segment. Against a managed exchange,
|
|
@@ -338,9 +347,14 @@ export type PrepareRequest = {
|
|
|
338
347
|
* than the source, or not an exact multiple of it, returns `400`. What's accepted, and
|
|
339
348
|
* what omitting it means, depends on the source:
|
|
340
349
|
*
|
|
341
|
-
* * Managed exchange — one of `1s`, `5s`, `1m`, `3m`, `5m`, `15m`,
|
|
342
|
-
* `4h`, `8h`, `12h`, `1d`, `1w`, `1q`; any other label returns `400`.
|
|
343
|
-
* the publisher's native cadence.
|
|
350
|
+
* * Managed exchange, `ticker` or `funding` — one of `1s`, `5s`, `1m`, `3m`, `5m`, `15m`,
|
|
351
|
+
* `30m`, `1h`, `2h`, `4h`, `8h`, `12h`, `1d`, `1w`, `1q`; any other label returns `400`.
|
|
352
|
+
* Omitted = `1s`, the publisher's native cadence.
|
|
353
|
+
* * Managed exchange, `kline` — one of `1s`, `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1d`;
|
|
354
|
+
* any other label, including `5s`, `3m` and `8h`, returns `400` and names the accepted
|
|
355
|
+
* ones. Omitted = `1s`. This is the width of the bars a run reads: it is chosen here,
|
|
356
|
+
* once, and the same strategy can be run at several cadences by preparing the range at
|
|
357
|
+
* each.
|
|
344
358
|
* * Dataset (`exchangeId: user`) — omitted = the dataset version's own discovered
|
|
345
359
|
* `cadence` (see `DatasetVersion.cadence`), served as-is. Any cadence equal to or
|
|
346
360
|
* coarser than it and an exact multiple of it is accepted, including ones outside the
|
|
@@ -1092,8 +1106,9 @@ export type EquityCurveResult = {
|
|
|
1092
1106
|
|
|
1093
1107
|
/**
|
|
1094
1108
|
* Unique identifier for a compiled strategy, derived from the source itself: the same code
|
|
1095
|
-
* always yields the same id, for every caller
|
|
1096
|
-
* `POST /strategy` for exactly which rewrites preserve it and which do
|
|
1109
|
+
* always yields the same id, for every caller. How much formatting the id ignores depends on
|
|
1110
|
+
* the language — see `POST /strategy` for exactly which rewrites preserve it and which do
|
|
1111
|
+
* not.
|
|
1097
1112
|
*
|
|
1098
1113
|
*/
|
|
1099
1114
|
export type StrategyId = string;
|
|
@@ -1728,6 +1743,295 @@ export type AuthTokenError = {
|
|
|
1728
1743
|
message: string;
|
|
1729
1744
|
};
|
|
1730
1745
|
|
|
1746
|
+
/**
|
|
1747
|
+
* One market feed a live run consumes. Exactly one entry per run today.
|
|
1748
|
+
*/
|
|
1749
|
+
export type LiveSource = {
|
|
1750
|
+
/**
|
|
1751
|
+
* Venue category. `cx` (centralized exchange) is the only one live runs support today.
|
|
1752
|
+
*/
|
|
1753
|
+
venueType: string;
|
|
1754
|
+
exchange: string;
|
|
1755
|
+
segment: string;
|
|
1756
|
+
/**
|
|
1757
|
+
* 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.
|
|
1758
|
+
*/
|
|
1759
|
+
type: "ticker" | "kline";
|
|
1760
|
+
/**
|
|
1761
|
+
* Instrument symbols, or `["*"]` for every instrument the exchange/segment offers (tier-gated).
|
|
1762
|
+
*/
|
|
1763
|
+
instruments: Array<string>;
|
|
1764
|
+
};
|
|
1765
|
+
|
|
1766
|
+
export type StartLiveRequest = {
|
|
1767
|
+
sources: [LiveSource];
|
|
1768
|
+
/**
|
|
1769
|
+
* Strategy parameters to start with. Opaque key/value pairs — see this strategy's own `declaredProperties` (from `POST /strategy`) for the keys it accepts.
|
|
1770
|
+
*/
|
|
1771
|
+
params?: {
|
|
1772
|
+
[key: string]: unknown;
|
|
1773
|
+
};
|
|
1774
|
+
/**
|
|
1775
|
+
* A `public` run appears in `GET /live/public` and its signal channel accepts subscriptions from anyone, not only you.
|
|
1776
|
+
*/
|
|
1777
|
+
visibility?: "private" | "public";
|
|
1778
|
+
/**
|
|
1779
|
+
* Request that this run's signals be relayed over its WebSocket channel once it reaches the `live` stage — see the "Live execution" guide. Has no effect while the run is still in the `sandbox` stage, regardless of this value.
|
|
1780
|
+
*/
|
|
1781
|
+
relay?: boolean;
|
|
1782
|
+
name?: string;
|
|
1783
|
+
description?: string;
|
|
1784
|
+
};
|
|
1785
|
+
|
|
1786
|
+
export type UpdateLiveRequest = {
|
|
1787
|
+
visibility?: "private" | "public";
|
|
1788
|
+
name?: string;
|
|
1789
|
+
description?: string;
|
|
1790
|
+
};
|
|
1791
|
+
|
|
1792
|
+
export type UpdateLiveParamsRequest = {
|
|
1793
|
+
/**
|
|
1794
|
+
* Must be non-empty; every key must be a property your strategy declares.
|
|
1795
|
+
*/
|
|
1796
|
+
params: {
|
|
1797
|
+
[key: string]: unknown;
|
|
1798
|
+
};
|
|
1799
|
+
};
|
|
1800
|
+
|
|
1801
|
+
/**
|
|
1802
|
+
* A live run's full state, as returned by starting, reading, or stopping it through its strategy.
|
|
1803
|
+
*/
|
|
1804
|
+
export type LiveRun = {
|
|
1805
|
+
strategyId: StrategyId;
|
|
1806
|
+
/**
|
|
1807
|
+
* This run's own id — its canonical identity for `PATCH`/`PUT .../params` and for `GET /live/public`.
|
|
1808
|
+
*/
|
|
1809
|
+
runId: string;
|
|
1810
|
+
name?: string;
|
|
1811
|
+
description?: string;
|
|
1812
|
+
visibility: "private" | "public";
|
|
1813
|
+
/**
|
|
1814
|
+
* A new run always starts `SANDBOX` — a trial run compared against a second execution for agreement — and moves to `LIVE` once it passes.
|
|
1815
|
+
*/
|
|
1816
|
+
stage: "SANDBOX" | "LIVE";
|
|
1817
|
+
/**
|
|
1818
|
+
* `STARTING` until first observed running; otherwise the runner's own reported state (e.g. `RUNNING`).
|
|
1819
|
+
*/
|
|
1820
|
+
state: string;
|
|
1821
|
+
/**
|
|
1822
|
+
* What you last asked for. `state` can lag this briefly after `DELETE`.
|
|
1823
|
+
*/
|
|
1824
|
+
desired: "RUNNING" | "STOPPED";
|
|
1825
|
+
/**
|
|
1826
|
+
* Present only when the run stopped because it exceeded its resource allowance.
|
|
1827
|
+
*/
|
|
1828
|
+
reason?: string;
|
|
1829
|
+
sources: Array<LiveSource>;
|
|
1830
|
+
params: {
|
|
1831
|
+
[key: string]: unknown;
|
|
1832
|
+
};
|
|
1833
|
+
/**
|
|
1834
|
+
* Increments on every accepted `PUT .../params` call, including one that resends the current values.
|
|
1835
|
+
*/
|
|
1836
|
+
paramsVersion: number;
|
|
1837
|
+
/**
|
|
1838
|
+
* Whether this run's signals are being relayed over the WebSocket channel described in the "Live execution" guide, right now. This is the effective value — `false` on a `sandbox` run regardless of what was requested at start; matches the requested value once `stage` reaches `live`.
|
|
1839
|
+
*/
|
|
1840
|
+
relay: boolean;
|
|
1841
|
+
/**
|
|
1842
|
+
* Epoch milliseconds.
|
|
1843
|
+
*/
|
|
1844
|
+
startedAtMs: number;
|
|
1845
|
+
/**
|
|
1846
|
+
* The sandbox trial's promotion verdict, once one exists. Shape is not yet stabilized as public API — treat as opaque diagnostics.
|
|
1847
|
+
*/
|
|
1848
|
+
gate?: {
|
|
1849
|
+
[key: string]: unknown;
|
|
1850
|
+
};
|
|
1851
|
+
};
|
|
1852
|
+
|
|
1853
|
+
/**
|
|
1854
|
+
* A run's state as returned by `PATCH /live/{runId}` — narrower than `LiveRun` (no `strategyId`, `params`, or `desired`), since this endpoint is addressed by `runId` alone.
|
|
1855
|
+
*/
|
|
1856
|
+
export type LiveRunCompact = {
|
|
1857
|
+
runId: string;
|
|
1858
|
+
name?: string;
|
|
1859
|
+
description?: string;
|
|
1860
|
+
visibility: "private" | "public";
|
|
1861
|
+
stage: "SANDBOX" | "LIVE";
|
|
1862
|
+
state: string;
|
|
1863
|
+
sources: Array<LiveSource>;
|
|
1864
|
+
};
|
|
1865
|
+
|
|
1866
|
+
/**
|
|
1867
|
+
* A run as it appears in `GET /live` — one of your own, narrower than `LiveRun` (no `params`, `paramsVersion`, `relay`, or `gate`), since listing stays cheap regardless of how many runs you have. Check a specific run's full state with `GET /strategy/{strategyId}/live`.
|
|
1868
|
+
*/
|
|
1869
|
+
export type LiveRunSummary = {
|
|
1870
|
+
strategyId: StrategyId;
|
|
1871
|
+
/**
|
|
1872
|
+
* This run's own id — its canonical identity for `PATCH`/`PUT .../params` and for `GET /live/public`.
|
|
1873
|
+
*/
|
|
1874
|
+
runId: string;
|
|
1875
|
+
name?: string;
|
|
1876
|
+
description?: string;
|
|
1877
|
+
visibility: "private" | "public";
|
|
1878
|
+
/**
|
|
1879
|
+
* A new run always starts `SANDBOX` — a trial run compared against a second execution for agreement — and moves to `LIVE` once it passes.
|
|
1880
|
+
*/
|
|
1881
|
+
stage: "SANDBOX" | "LIVE";
|
|
1882
|
+
/**
|
|
1883
|
+
* `STARTING` until first observed running; otherwise the runner's own reported state (e.g. `RUNNING`).
|
|
1884
|
+
*/
|
|
1885
|
+
state: string;
|
|
1886
|
+
/**
|
|
1887
|
+
* What you last asked for. `state` can lag this briefly after `DELETE`.
|
|
1888
|
+
*/
|
|
1889
|
+
desired: "RUNNING" | "STOPPED";
|
|
1890
|
+
sources: Array<LiveSource>;
|
|
1891
|
+
/**
|
|
1892
|
+
* Epoch milliseconds this run was started.
|
|
1893
|
+
*/
|
|
1894
|
+
createdAtMs: number;
|
|
1895
|
+
/**
|
|
1896
|
+
* Epoch milliseconds.
|
|
1897
|
+
*/
|
|
1898
|
+
startedAtMs: number;
|
|
1899
|
+
};
|
|
1900
|
+
|
|
1901
|
+
export type LiveListResponse = {
|
|
1902
|
+
runs: Array<LiveRunSummary>;
|
|
1903
|
+
_links?: PublicLiveListLinks;
|
|
1904
|
+
};
|
|
1905
|
+
|
|
1906
|
+
/**
|
|
1907
|
+
* A run as it appears in `GET /live/public` — never reveals who owns it or which strategy it runs.
|
|
1908
|
+
*/
|
|
1909
|
+
export type PublicLiveRun = {
|
|
1910
|
+
runId: string;
|
|
1911
|
+
name?: string;
|
|
1912
|
+
description?: string;
|
|
1913
|
+
sources: Array<LiveSource>;
|
|
1914
|
+
state: string;
|
|
1915
|
+
createdAtMs: number;
|
|
1916
|
+
};
|
|
1917
|
+
|
|
1918
|
+
export type PublicLiveListResponse = {
|
|
1919
|
+
runs: Array<PublicLiveRun>;
|
|
1920
|
+
_links?: PublicLiveListLinks;
|
|
1921
|
+
};
|
|
1922
|
+
|
|
1923
|
+
/**
|
|
1924
|
+
* Present only when another page exists.
|
|
1925
|
+
*/
|
|
1926
|
+
export type PublicLiveListLinks = {
|
|
1927
|
+
next?: PublicLiveNextLink;
|
|
1928
|
+
};
|
|
1929
|
+
|
|
1930
|
+
export type PublicLiveNextLink = {
|
|
1931
|
+
href?: string;
|
|
1932
|
+
};
|
|
1933
|
+
|
|
1934
|
+
/**
|
|
1935
|
+
* One page of a run's recorded signals, oldest first.
|
|
1936
|
+
*/
|
|
1937
|
+
export type LiveSignalPage = {
|
|
1938
|
+
signals: Array<LiveSignal>;
|
|
1939
|
+
/**
|
|
1940
|
+
* The oldest moment this run's signals can still be read from. Absent when the run has produced nothing yet. It moves forward over time as older signals are discarded, so a `sinceMs` earlier than this is served from here instead.
|
|
1941
|
+
*/
|
|
1942
|
+
availableSinceMs?: number;
|
|
1943
|
+
_links?: PublicLiveListLinks;
|
|
1944
|
+
};
|
|
1945
|
+
|
|
1946
|
+
/**
|
|
1947
|
+
* One signal, in the same shape the real-time signal channel delivers.
|
|
1948
|
+
*/
|
|
1949
|
+
export type LiveSignal = {
|
|
1950
|
+
/**
|
|
1951
|
+
* Envelope schema version.
|
|
1952
|
+
*/
|
|
1953
|
+
v: number;
|
|
1954
|
+
/**
|
|
1955
|
+
* Stable id for this exact signal — dedupe on it across reconnects or overlapping reads.
|
|
1956
|
+
*/
|
|
1957
|
+
signalId: string;
|
|
1958
|
+
runId: string;
|
|
1959
|
+
/**
|
|
1960
|
+
* The stage the run was in when this signal was produced.
|
|
1961
|
+
*/
|
|
1962
|
+
stage: "sandbox" | "live";
|
|
1963
|
+
/**
|
|
1964
|
+
* The parameter set in force when this signal was produced.
|
|
1965
|
+
*/
|
|
1966
|
+
paramsVersion?: number;
|
|
1967
|
+
type: "hint" | "info" | "marker" | "command";
|
|
1968
|
+
/**
|
|
1969
|
+
* `BUY`/`SELL` for a `hint`, the command name for a `command`, absent otherwise.
|
|
1970
|
+
*/
|
|
1971
|
+
kind?: string | null;
|
|
1972
|
+
/**
|
|
1973
|
+
* Market time the signal was produced.
|
|
1974
|
+
*/
|
|
1975
|
+
eventTsMs: number;
|
|
1976
|
+
/**
|
|
1977
|
+
* Time it was published — always at or after `eventTsMs`.
|
|
1978
|
+
*/
|
|
1979
|
+
emittedAtMs: number;
|
|
1980
|
+
instrument: LiveSignalInstrument;
|
|
1981
|
+
order?: LiveSignalOrder;
|
|
1982
|
+
/**
|
|
1983
|
+
* The signal's own free-form payload.
|
|
1984
|
+
*/
|
|
1985
|
+
data?: {
|
|
1986
|
+
[key: string]: unknown;
|
|
1987
|
+
};
|
|
1988
|
+
/**
|
|
1989
|
+
* `true` only for a signal republished to fill a gap in the record.
|
|
1990
|
+
*/
|
|
1991
|
+
regenerated?: boolean;
|
|
1992
|
+
/**
|
|
1993
|
+
* Content hash, for checking that two independent deliveries of the same signal agree.
|
|
1994
|
+
*/
|
|
1995
|
+
digest: string;
|
|
1996
|
+
};
|
|
1997
|
+
|
|
1998
|
+
export type LiveSignalInstrument = {
|
|
1999
|
+
exchange?: string;
|
|
2000
|
+
segment?: string;
|
|
2001
|
+
/**
|
|
2002
|
+
* Slashed form, e.g. `BTC/USDT`.
|
|
2003
|
+
*/
|
|
2004
|
+
symbol?: string;
|
|
2005
|
+
};
|
|
2006
|
+
|
|
2007
|
+
/**
|
|
2008
|
+
* Present only for a `hint`.
|
|
2009
|
+
*/
|
|
2010
|
+
export type LiveSignalOrder = {
|
|
2011
|
+
orderKind?: string;
|
|
2012
|
+
price?: string | null;
|
|
2013
|
+
amount?: string | null;
|
|
2014
|
+
stopPrice?: string | null;
|
|
2015
|
+
trailPct?: string | null;
|
|
2016
|
+
} | null;
|
|
2017
|
+
|
|
2018
|
+
export type LiveConnectionToken = {
|
|
2019
|
+
/**
|
|
2020
|
+
* Pass as the `token` field of the WebSocket `connect` command — see the "Live execution" guide.
|
|
2021
|
+
*/
|
|
2022
|
+
token: string;
|
|
2023
|
+
expiresAtMs: number;
|
|
2024
|
+
};
|
|
2025
|
+
|
|
2026
|
+
export type LiveParamsUpdateResult = {
|
|
2027
|
+
runId: string;
|
|
2028
|
+
paramsVersion: number;
|
|
2029
|
+
/**
|
|
2030
|
+
* Epoch milliseconds — the earliest moment the new values are guaranteed to be in effect.
|
|
2031
|
+
*/
|
|
2032
|
+
effectiveAtMs: number;
|
|
2033
|
+
};
|
|
2034
|
+
|
|
1731
2035
|
export type AuthenticateData = {
|
|
1732
2036
|
body?: never;
|
|
1733
2037
|
path?: never;
|
|
@@ -2028,7 +2332,7 @@ export type ListStrategiesResponse =
|
|
|
2028
2332
|
|
|
2029
2333
|
export type CompileStrategyData = {
|
|
2030
2334
|
/**
|
|
2031
|
-
* Raw strategy Java
|
|
2335
|
+
* Raw strategy source code, Java or QTScript
|
|
2032
2336
|
*/
|
|
2033
2337
|
body: string;
|
|
2034
2338
|
path?: never;
|
|
@@ -2038,7 +2342,8 @@ export type CompileStrategyData = {
|
|
|
2038
2342
|
|
|
2039
2343
|
export type CompileStrategyErrors = {
|
|
2040
2344
|
/**
|
|
2041
|
-
* The source is not valid
|
|
2345
|
+
* The source is not valid; the message carries the diagnostics — the compiler's for Java,
|
|
2346
|
+
* and for QTScript `Line N, Column M:` entries against your own source. Nothing is
|
|
2042
2347
|
* registered, so there is no id to look up afterwards.
|
|
2043
2348
|
*
|
|
2044
2349
|
*/
|
|
@@ -2209,7 +2514,7 @@ export type GetStrategyCodeResponses = {
|
|
|
2209
2514
|
200: {
|
|
2210
2515
|
strategyId: StrategyId;
|
|
2211
2516
|
/**
|
|
2212
|
-
* Raw strategy Java
|
|
2517
|
+
* Raw strategy source code (Java or QTScript), exactly as registered.
|
|
2213
2518
|
*/
|
|
2214
2519
|
code: string;
|
|
2215
2520
|
};
|
|
@@ -2242,7 +2547,9 @@ export type PrepareBacktestData = {
|
|
|
2242
2547
|
export type PrepareBacktestErrors = {
|
|
2243
2548
|
/**
|
|
2244
2549
|
* Invalid request or parameters. Also returned when `from` is older than the configured
|
|
2245
|
-
* lookback window or `to` is in the future
|
|
2550
|
+
* lookback window or `to` is in the future, or when `type` is `kline` and `cadence` is not
|
|
2551
|
+
* one of the cadences kline data is available at (the message lists them). For
|
|
2552
|
+
* `exchangeId: user`, also returned when
|
|
2246
2553
|
* the dataset's current upload has not finished ingesting, or `cadence` asks for a finer
|
|
2247
2554
|
* granularity than the dataset's own discovered cadence (or one that isn't an exact
|
|
2248
2555
|
* multiple of it), or the requested range exceeds your tier's range limit.
|
|
@@ -2339,7 +2646,9 @@ export type ExecuteSweepData = {
|
|
|
2339
2646
|
|
|
2340
2647
|
export type ExecuteSweepErrors = {
|
|
2341
2648
|
/**
|
|
2342
|
-
* Invalid sweep specification
|
|
2649
|
+
* Invalid sweep specification, a `type` that cannot be swept yet (`funding`), or the
|
|
2650
|
+
* expanded grid exceeds the server limit.
|
|
2651
|
+
*
|
|
2343
2652
|
*/
|
|
2344
2653
|
400: ResponseError;
|
|
2345
2654
|
/**
|
|
@@ -2606,7 +2915,9 @@ export type ExecuteBacktestData = {
|
|
|
2606
2915
|
|
|
2607
2916
|
export type ExecuteBacktestErrors = {
|
|
2608
2917
|
/**
|
|
2609
|
-
* Invalid request or parameters
|
|
2918
|
+
* Invalid request or parameters. Also returned for a `type` that cannot be executed yet
|
|
2919
|
+
* (`funding`); the message names the sources that can.
|
|
2920
|
+
*
|
|
2610
2921
|
*/
|
|
2611
2922
|
400: ResponseError;
|
|
2612
2923
|
/**
|
|
@@ -3066,6 +3377,331 @@ export type GetDatasetImportResponses = {
|
|
|
3066
3377
|
export type GetDatasetImportResponse =
|
|
3067
3378
|
GetDatasetImportResponses[keyof GetDatasetImportResponses];
|
|
3068
3379
|
|
|
3380
|
+
export type StopLiveData = {
|
|
3381
|
+
body?: never;
|
|
3382
|
+
path: {
|
|
3383
|
+
/**
|
|
3384
|
+
* The id returned by `POST /strategy`
|
|
3385
|
+
*/
|
|
3386
|
+
strategyId: StrategyId;
|
|
3387
|
+
};
|
|
3388
|
+
query?: never;
|
|
3389
|
+
url: "/strategy/{strategyId}/live";
|
|
3390
|
+
};
|
|
3391
|
+
|
|
3392
|
+
export type StopLiveErrors = {
|
|
3393
|
+
/**
|
|
3394
|
+
* You have never started a live run for this strategy.
|
|
3395
|
+
*/
|
|
3396
|
+
404: ResponseError;
|
|
3397
|
+
};
|
|
3398
|
+
|
|
3399
|
+
export type StopLiveError = StopLiveErrors[keyof StopLiveErrors];
|
|
3400
|
+
|
|
3401
|
+
export type StopLiveResponses = {
|
|
3402
|
+
/**
|
|
3403
|
+
* Stop requested (or already stopped) — the run's current state
|
|
3404
|
+
*/
|
|
3405
|
+
200: LiveRun;
|
|
3406
|
+
};
|
|
3407
|
+
|
|
3408
|
+
export type StopLiveResponse = StopLiveResponses[keyof StopLiveResponses];
|
|
3409
|
+
|
|
3410
|
+
export type GetLiveData = {
|
|
3411
|
+
body?: never;
|
|
3412
|
+
path: {
|
|
3413
|
+
/**
|
|
3414
|
+
* The id returned by `POST /strategy`
|
|
3415
|
+
*/
|
|
3416
|
+
strategyId: StrategyId;
|
|
3417
|
+
};
|
|
3418
|
+
query?: never;
|
|
3419
|
+
url: "/strategy/{strategyId}/live";
|
|
3420
|
+
};
|
|
3421
|
+
|
|
3422
|
+
export type GetLiveErrors = {
|
|
3423
|
+
/**
|
|
3424
|
+
* You have never started a live run for this strategy.
|
|
3425
|
+
*/
|
|
3426
|
+
404: ResponseError;
|
|
3427
|
+
};
|
|
3428
|
+
|
|
3429
|
+
export type GetLiveError = GetLiveErrors[keyof GetLiveErrors];
|
|
3430
|
+
|
|
3431
|
+
export type GetLiveResponses = {
|
|
3432
|
+
/**
|
|
3433
|
+
* The run's current state
|
|
3434
|
+
*/
|
|
3435
|
+
200: LiveRun;
|
|
3436
|
+
};
|
|
3437
|
+
|
|
3438
|
+
export type GetLiveResponse = GetLiveResponses[keyof GetLiveResponses];
|
|
3439
|
+
|
|
3440
|
+
export type StartLiveData = {
|
|
3441
|
+
body: StartLiveRequest;
|
|
3442
|
+
path: {
|
|
3443
|
+
/**
|
|
3444
|
+
* The id returned by `POST /strategy`
|
|
3445
|
+
*/
|
|
3446
|
+
strategyId: StrategyId;
|
|
3447
|
+
};
|
|
3448
|
+
query?: never;
|
|
3449
|
+
url: "/strategy/{strategyId}/live";
|
|
3450
|
+
};
|
|
3451
|
+
|
|
3452
|
+
export type StartLiveErrors = {
|
|
3453
|
+
/**
|
|
3454
|
+
* Malformed `sources` (not exactly one entry, missing field, unsupported `type`), or an invalid `visibility`.
|
|
3455
|
+
*/
|
|
3456
|
+
400: ResponseError;
|
|
3457
|
+
/**
|
|
3458
|
+
* No such registered strategy for this user, or it has never been compiled.
|
|
3459
|
+
*/
|
|
3460
|
+
404: ResponseError;
|
|
3461
|
+
/**
|
|
3462
|
+
* A run for this strategy is already active. Stop it first.
|
|
3463
|
+
*/
|
|
3464
|
+
409: ResponseError;
|
|
3465
|
+
/**
|
|
3466
|
+
* Your plan does not include live runs, would exceed your concurrent-run or
|
|
3467
|
+
* instrument-count limit, or the platform is at capacity right now. Carries a
|
|
3468
|
+
* `Retry-After` header.
|
|
3469
|
+
*
|
|
3470
|
+
*/
|
|
3471
|
+
429: ResponseError;
|
|
3472
|
+
};
|
|
3473
|
+
|
|
3474
|
+
export type StartLiveError = StartLiveErrors[keyof StartLiveErrors];
|
|
3475
|
+
|
|
3476
|
+
export type StartLiveResponses = {
|
|
3477
|
+
/**
|
|
3478
|
+
* Started — the run's own state, in the sandbox stage
|
|
3479
|
+
*/
|
|
3480
|
+
201: LiveRun;
|
|
3481
|
+
};
|
|
3482
|
+
|
|
3483
|
+
export type StartLiveResponse = StartLiveResponses[keyof StartLiveResponses];
|
|
3484
|
+
|
|
3485
|
+
export type ListLiveData = {
|
|
3486
|
+
body?: never;
|
|
3487
|
+
path?: never;
|
|
3488
|
+
query?: {
|
|
3489
|
+
/**
|
|
3490
|
+
* The `runId` from a previous page's `_links.next.href`. Omit for the first page.
|
|
3491
|
+
*/
|
|
3492
|
+
cursor?: string;
|
|
3493
|
+
/**
|
|
3494
|
+
* Page size. Larger values are capped, not rejected.
|
|
3495
|
+
*/
|
|
3496
|
+
limit?: number;
|
|
3497
|
+
};
|
|
3498
|
+
url: "/live";
|
|
3499
|
+
};
|
|
3500
|
+
|
|
3501
|
+
export type ListLiveErrors = {
|
|
3502
|
+
/**
|
|
3503
|
+
* An invalid `cursor` or `limit`.
|
|
3504
|
+
*/
|
|
3505
|
+
400: ResponseError;
|
|
3506
|
+
};
|
|
3507
|
+
|
|
3508
|
+
export type ListLiveError = ListLiveErrors[keyof ListLiveErrors];
|
|
3509
|
+
|
|
3510
|
+
export type ListLiveResponses = {
|
|
3511
|
+
/**
|
|
3512
|
+
* A page of your own runs
|
|
3513
|
+
*/
|
|
3514
|
+
200: LiveListResponse;
|
|
3515
|
+
};
|
|
3516
|
+
|
|
3517
|
+
export type ListLiveResponse = ListLiveResponses[keyof ListLiveResponses];
|
|
3518
|
+
|
|
3519
|
+
export type ListPublicLiveData = {
|
|
3520
|
+
body?: never;
|
|
3521
|
+
path?: never;
|
|
3522
|
+
query?: {
|
|
3523
|
+
/**
|
|
3524
|
+
* The `runId` from a previous page's `_links.next.href`. Omit for the first page.
|
|
3525
|
+
*/
|
|
3526
|
+
cursor?: string;
|
|
3527
|
+
/**
|
|
3528
|
+
* Page size. Larger values are capped, not rejected.
|
|
3529
|
+
*/
|
|
3530
|
+
limit?: number;
|
|
3531
|
+
};
|
|
3532
|
+
url: "/live/public";
|
|
3533
|
+
};
|
|
3534
|
+
|
|
3535
|
+
export type ListPublicLiveErrors = {
|
|
3536
|
+
/**
|
|
3537
|
+
* An invalid `cursor` or `limit`.
|
|
3538
|
+
*/
|
|
3539
|
+
400: ResponseError;
|
|
3540
|
+
};
|
|
3541
|
+
|
|
3542
|
+
export type ListPublicLiveError =
|
|
3543
|
+
ListPublicLiveErrors[keyof ListPublicLiveErrors];
|
|
3544
|
+
|
|
3545
|
+
export type ListPublicLiveResponses = {
|
|
3546
|
+
/**
|
|
3547
|
+
* A page of public runs
|
|
3548
|
+
*/
|
|
3549
|
+
200: PublicLiveListResponse;
|
|
3550
|
+
};
|
|
3551
|
+
|
|
3552
|
+
export type ListPublicLiveResponse =
|
|
3553
|
+
ListPublicLiveResponses[keyof ListPublicLiveResponses];
|
|
3554
|
+
|
|
3555
|
+
export type UpdateLiveData = {
|
|
3556
|
+
body?: UpdateLiveRequest;
|
|
3557
|
+
path: {
|
|
3558
|
+
/**
|
|
3559
|
+
* The `runId` from `POST`/`GET`/`DELETE` `.../live` or from `GET /live/public`
|
|
3560
|
+
*/
|
|
3561
|
+
runId: string;
|
|
3562
|
+
};
|
|
3563
|
+
query?: never;
|
|
3564
|
+
url: "/live/{runId}";
|
|
3565
|
+
};
|
|
3566
|
+
|
|
3567
|
+
export type UpdateLiveErrors = {
|
|
3568
|
+
/**
|
|
3569
|
+
* `visibility` present but not `private`/`public`.
|
|
3570
|
+
*/
|
|
3571
|
+
400: ResponseError;
|
|
3572
|
+
/**
|
|
3573
|
+
* No such run, or you do not own it — the two look identical on purpose.
|
|
3574
|
+
*/
|
|
3575
|
+
404: ResponseError;
|
|
3576
|
+
};
|
|
3577
|
+
|
|
3578
|
+
export type UpdateLiveError = UpdateLiveErrors[keyof UpdateLiveErrors];
|
|
3579
|
+
|
|
3580
|
+
export type UpdateLiveResponses = {
|
|
3581
|
+
/**
|
|
3582
|
+
* Updated
|
|
3583
|
+
*/
|
|
3584
|
+
200: LiveRunCompact;
|
|
3585
|
+
};
|
|
3586
|
+
|
|
3587
|
+
export type UpdateLiveResponse = UpdateLiveResponses[keyof UpdateLiveResponses];
|
|
3588
|
+
|
|
3589
|
+
export type UpdateLiveParamsData = {
|
|
3590
|
+
body: UpdateLiveParamsRequest;
|
|
3591
|
+
path: {
|
|
3592
|
+
runId: string;
|
|
3593
|
+
};
|
|
3594
|
+
query?: never;
|
|
3595
|
+
url: "/live/{runId}/params";
|
|
3596
|
+
};
|
|
3597
|
+
|
|
3598
|
+
export type UpdateLiveParamsErrors = {
|
|
3599
|
+
/**
|
|
3600
|
+
* `params` missing, not an object, empty, or contains a key your strategy does not declare.
|
|
3601
|
+
*/
|
|
3602
|
+
400: ResponseError;
|
|
3603
|
+
/**
|
|
3604
|
+
* No such run, or you do not own it.
|
|
3605
|
+
*/
|
|
3606
|
+
404: ResponseError;
|
|
3607
|
+
/**
|
|
3608
|
+
* This run's compilation has no declared properties on record — recompile the strategy to enable runtime parameter updates.
|
|
3609
|
+
*/
|
|
3610
|
+
409: ResponseError;
|
|
3611
|
+
};
|
|
3612
|
+
|
|
3613
|
+
export type UpdateLiveParamsError =
|
|
3614
|
+
UpdateLiveParamsErrors[keyof UpdateLiveParamsErrors];
|
|
3615
|
+
|
|
3616
|
+
export type UpdateLiveParamsResponses = {
|
|
3617
|
+
/**
|
|
3618
|
+
* Accepted
|
|
3619
|
+
*/
|
|
3620
|
+
200: LiveParamsUpdateResult;
|
|
3621
|
+
};
|
|
3622
|
+
|
|
3623
|
+
export type UpdateLiveParamsResponse =
|
|
3624
|
+
UpdateLiveParamsResponses[keyof UpdateLiveParamsResponses];
|
|
3625
|
+
|
|
3626
|
+
export type GetLiveRunSignalsData = {
|
|
3627
|
+
body?: never;
|
|
3628
|
+
path: {
|
|
3629
|
+
/**
|
|
3630
|
+
* The run whose signals to read.
|
|
3631
|
+
*/
|
|
3632
|
+
runId: string;
|
|
3633
|
+
};
|
|
3634
|
+
query?: {
|
|
3635
|
+
/**
|
|
3636
|
+
* Start from this moment (epoch ms). Omitted, or older than the available window, starts at `availableSinceMs`. Ignored when `cursor` is given.
|
|
3637
|
+
*/
|
|
3638
|
+
sinceMs?: number;
|
|
3639
|
+
/**
|
|
3640
|
+
* Narrow to one or more instruments. Omitted, or `*`, returns every instrument the run
|
|
3641
|
+
* covers. Accepts a single pair (`BTC/USDT`), either half as a wildcard (`*USDT` for any
|
|
3642
|
+
* base against that quote, `BTC*` for that base against any quote), or a comma-separated
|
|
3643
|
+
* list of pairs (`BTC/USDT,ETH/EUR`). Symbols are matched exactly, case included — pass
|
|
3644
|
+
* them as this API reports them.
|
|
3645
|
+
*
|
|
3646
|
+
*/
|
|
3647
|
+
instrument?: string;
|
|
3648
|
+
/**
|
|
3649
|
+
* Continue from a previous page's `_links.next`. Takes precedence over `sinceMs`.
|
|
3650
|
+
*/
|
|
3651
|
+
cursor?: string;
|
|
3652
|
+
/**
|
|
3653
|
+
* Page size.
|
|
3654
|
+
*/
|
|
3655
|
+
limit?: number;
|
|
3656
|
+
};
|
|
3657
|
+
url: "/live/{runId}/signals";
|
|
3658
|
+
};
|
|
3659
|
+
|
|
3660
|
+
export type GetLiveRunSignalsErrors = {
|
|
3661
|
+
/**
|
|
3662
|
+
* `instrument`, `sinceMs`, `limit` or `cursor` is malformed.
|
|
3663
|
+
*/
|
|
3664
|
+
400: ResponseError;
|
|
3665
|
+
/**
|
|
3666
|
+
* No such run, or not one you may read.
|
|
3667
|
+
*/
|
|
3668
|
+
404: ResponseError;
|
|
3669
|
+
/**
|
|
3670
|
+
* The cursor's position is no longer available — restart from the `availableSinceMs` named in the message.
|
|
3671
|
+
*/
|
|
3672
|
+
410: ResponseError;
|
|
3673
|
+
};
|
|
3674
|
+
|
|
3675
|
+
export type GetLiveRunSignalsError =
|
|
3676
|
+
GetLiveRunSignalsErrors[keyof GetLiveRunSignalsErrors];
|
|
3677
|
+
|
|
3678
|
+
export type GetLiveRunSignalsResponses = {
|
|
3679
|
+
/**
|
|
3680
|
+
* One page of signals
|
|
3681
|
+
*/
|
|
3682
|
+
200: LiveSignalPage;
|
|
3683
|
+
};
|
|
3684
|
+
|
|
3685
|
+
export type GetLiveRunSignalsResponse =
|
|
3686
|
+
GetLiveRunSignalsResponses[keyof GetLiveRunSignalsResponses];
|
|
3687
|
+
|
|
3688
|
+
export type MintLiveConnectionTokenData = {
|
|
3689
|
+
body?: never;
|
|
3690
|
+
path?: never;
|
|
3691
|
+
query?: never;
|
|
3692
|
+
url: "/live/token";
|
|
3693
|
+
};
|
|
3694
|
+
|
|
3695
|
+
export type MintLiveConnectionTokenResponses = {
|
|
3696
|
+
/**
|
|
3697
|
+
* Token minted
|
|
3698
|
+
*/
|
|
3699
|
+
200: LiveConnectionToken;
|
|
3700
|
+
};
|
|
3701
|
+
|
|
3702
|
+
export type MintLiveConnectionTokenResponse =
|
|
3703
|
+
MintLiveConnectionTokenResponses[keyof MintLiveConnectionTokenResponses];
|
|
3704
|
+
|
|
3069
3705
|
export type ClientOptions = {
|
|
3070
3706
|
baseUrl:
|
|
3071
3707
|
| "https://api.qtsurfer.net/v1"
|