@qtsurfer/api-client 0.18.0 → 0.20.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 +31 -12
- package/dist/index.d.ts +467 -26
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/generated/schemas.gen.ts +428 -15
- package/src/generated/sdk.gen.ts +145 -4
- package/src/generated/types.gen.ts +418 -21
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ npm install @qtsurfer/api-client
|
|
|
30
30
|
import { client, listExchanges, prepareBacktest } from '@qtsurfer/api-client';
|
|
31
31
|
|
|
32
32
|
client.setConfig({
|
|
33
|
-
baseUrl: 'https://api.qtsurfer.
|
|
33
|
+
baseUrl: 'https://api.qtsurfer.net/v1', // Staging beta server
|
|
34
34
|
headers: {
|
|
35
35
|
Authorization: `Bearer ${process.env.QTSURFER_TOKEN}`,
|
|
36
36
|
},
|
|
@@ -51,7 +51,7 @@ Exchange a long-lived API key for one via `authenticate`:
|
|
|
51
51
|
import { authenticate } from '@qtsurfer/api-client';
|
|
52
52
|
|
|
53
53
|
const { data, error } = await authenticate({
|
|
54
|
-
baseUrl: 'https://api.qtsurfer.
|
|
54
|
+
baseUrl: 'https://api.qtsurfer.net/v1', // Staging beta server
|
|
55
55
|
headers: { 'X-API-Key': process.env.QTSURFER_APIKEY! },
|
|
56
56
|
});
|
|
57
57
|
if (error) throw error;
|
|
@@ -68,21 +68,21 @@ pluggable token stores so callers don't reinvent that plumbing.
|
|
|
68
68
|
|
|
69
69
|
All operations are exported as standalone functions; every operation accepts an `Options` object and returns `{ data, error, response }`.
|
|
70
70
|
|
|
71
|
-
The table is exhaustive: `src/generated/` is produced from the OpenAPI spec, so **all
|
|
72
|
-
the spec declares are exported. The rows below describe **spec version 0.
|
|
71
|
+
The table is exhaustive: `src/generated/` is produced from the OpenAPI spec, so **all 45 operations**
|
|
72
|
+
the spec declares are exported. The rows below describe **spec version 0.128.14**, which is versioned
|
|
73
73
|
independently of this package.
|
|
74
74
|
|
|
75
75
|
| Function | Method | Path | Purpose |
|
|
76
76
|
| -------- | ------ | ---- | ------- |
|
|
77
77
|
| `authenticate` | POST | `/auth/token` | Exchange an API key for a short-lived JWT |
|
|
78
|
-
| `getAccount` | GET | `/account` | Read the authenticated account tier and limits |
|
|
78
|
+
| `getAccount` | GET | `/account` | Read the authenticated account tier and limits, including the full-grid sweep limit |
|
|
79
79
|
| `getAccountUsage` | GET | `/account/usage` | Read current resource and storage use |
|
|
80
80
|
| `listExchanges` | GET | `/exchanges` | List the available exchanges |
|
|
81
81
|
| `listInstruments` | GET | `/exchange/{exchangeId}/instruments` | List an exchange's instruments (default spot segment) |
|
|
82
82
|
| `listSegmentInstruments` | GET | `/exchange/{exchangeId}/{segment}/instruments` | List an exchange segment's instruments |
|
|
83
83
|
| `downloadTickers` | GET | `/exchange/{exchangeId}/tickers/{base}/{quote}` | Download one hour of tickers as a Lastra segment |
|
|
84
84
|
| `downloadKlines` | GET | `/exchange/{exchangeId}/klines/{base}/{quote}` | Download one hour of klines as a Lastra segment |
|
|
85
|
-
| `listStrategies` | GET | `/strategies` | List your registered strategies,
|
|
85
|
+
| `listStrategies` | GET | `/strategies` | List your registered strategies, optionally including deleted strategies and their deletion times |
|
|
86
86
|
| `compileStrategy` | POST | `/strategy` | Compile and register a strategy |
|
|
87
87
|
| `validateStrategy` | POST | `/strategy/{strategyId}/validate` | Check that a registered strategy can actually run |
|
|
88
88
|
| `getStrategy` | GET | `/strategy/{strategyId}` | Get a strategy by id, including its validation state |
|
|
@@ -98,7 +98,7 @@ independently of this package.
|
|
|
98
98
|
| `executeBacktest` | POST | `/backtest/{exchangeId}/{type}/execute` | Execute a compiled strategy against a prepared dataset |
|
|
99
99
|
| `cancelBacktest` | DELETE | `/backtest/{exchangeId}/{type}/execute/{jobId}` | Cancel a running backtest execution |
|
|
100
100
|
| `getBacktestResult` | GET | `/backtest/{exchangeId}/{type}/execute/{jobId}` | Get the result of a backtest execution job |
|
|
101
|
-
| `listDatasets` | GET | `/datasets` | List your datasets |
|
|
101
|
+
| `listDatasets` | GET | `/datasets` | List your datasets, optionally including deleted datasets and their deletion times |
|
|
102
102
|
| `createDataset` | POST | `/datasets` | Create a dataset and obtain its first upload session |
|
|
103
103
|
| `deleteDataset` | DELETE | `/datasets/{datasetId}` | Soft-delete a dataset |
|
|
104
104
|
| `getDataset` | GET | `/datasets/{datasetId}` | Get dataset metadata |
|
|
@@ -107,16 +107,35 @@ independently of this package.
|
|
|
107
107
|
| `getDatasetUpload` | GET | `/datasets/{datasetId}/uploads/{uploadId}` | Get an upload's ingestion state |
|
|
108
108
|
| `importDataset` | POST | `/datasets/imports` | Create a dataset by importing external history |
|
|
109
109
|
| `getDatasetImport` | GET | `/datasets/{datasetId}/imports/{importId}` | Get an import's fetch and ingestion state |
|
|
110
|
-
| `startLive` | POST | `/strategy/{strategyId}/live` | Start a compiled strategy on a live feed |
|
|
110
|
+
| `startLive` | POST | `/strategy/{strategyId}/live` | Start a compiled strategy on a live feed; optionally simulate fills and equity with `paper` |
|
|
111
111
|
| `getLive` | GET | `/strategy/{strategyId}/live` | Read a strategy's current or most recent live run |
|
|
112
112
|
| `stopLive` | DELETE | `/strategy/{strategyId}/live` | Request a strategy's active live run to stop |
|
|
113
|
+
| `listLive` | GET | `/live` | Page all live runs owned by the authenticated account |
|
|
113
114
|
| `listPublicLive` | GET | `/live/public` | Page publicly visible live runs |
|
|
114
115
|
| `updateLive` | PATCH | `/live/{runId}` | Change a run's visibility, name, or description |
|
|
115
116
|
| `updateLiveParams` | PUT | `/live/{runId}/params` | Change parameters while a run stays active |
|
|
116
|
-
| `
|
|
117
|
+
| `sendLiveCommand` | POST | `/live/{runId}/commands` | Send a command to a running strategy without restarting it |
|
|
118
|
+
| `getLiveRunSignals` | GET | `/live/{runId}/signals` | Page retained signals by time, instrument, or signal type (`paper` items only when output is `mix`) |
|
|
119
|
+
| `getLiveRunPaper` | GET | `/live/{runId}/paper` | Read simulated accounts, open positions, equity, and KPIs for a paper-trading run |
|
|
120
|
+
| `getLiveRunPaperEquity` | GET | `/live/{runId}/paper/equity` | Page the run's retained paper equity curve, optionally by quote currency or start time |
|
|
117
121
|
| `mintLiveConnectionToken` | POST | `/live/token` | Mint a short-lived Centrifugo connection token |
|
|
118
122
|
|
|
119
|
-
All generated types (`Exchange`, `InstrumentDetail`, `BacktestJobResult`, `PrepareJobState`, `ResultMap`, etc.) are re-exported from the root.
|
|
123
|
+
All generated types (`Exchange`, `InstrumentDetail`, `BacktestJobResult`, `PrepareJobState`, `ResultMap`, `LivePaper`, `LivePaperAccount`, `LivePaperEquityPage`, `SendLiveCommandRequest`, `LiveCommandResult`, etc.) are re-exported from the root.
|
|
124
|
+
|
|
125
|
+
`sendLiveCommand` sends a command to every execution behind an owned live run. The strategy must
|
|
126
|
+
implement the engine's `CommandRequestHandler`; `202` means the command was accepted, not that the
|
|
127
|
+
strategy has completed handling it:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
import { sendLiveCommand } from '@qtsurfer/api-client';
|
|
131
|
+
|
|
132
|
+
const { data, error } = await sendLiveCommand({
|
|
133
|
+
path: { runId },
|
|
134
|
+
body: { command: 'flatten', properties: { instrument: 'BTC/USDT' } },
|
|
135
|
+
});
|
|
136
|
+
if (error) throw error;
|
|
137
|
+
console.log(data.commandId, data.effectiveAtMs);
|
|
138
|
+
```
|
|
120
139
|
|
|
121
140
|
## Configuring the client
|
|
122
141
|
|
|
@@ -127,12 +146,12 @@ import { client, listExchanges } from '@qtsurfer/api-client';
|
|
|
127
146
|
|
|
128
147
|
// Global
|
|
129
148
|
client.setConfig({
|
|
130
|
-
baseUrl: 'https://api.qtsurfer.
|
|
149
|
+
baseUrl: 'https://api.qtsurfer.net/v1', // Staging beta server
|
|
131
150
|
});
|
|
132
151
|
|
|
133
152
|
// Per-call
|
|
134
153
|
await listExchanges({
|
|
135
|
-
baseUrl: 'https://api.qtsurfer.
|
|
154
|
+
baseUrl: 'https://api.qtsurfer.net/v1', // Staging beta server
|
|
136
155
|
headers: { 'X-Request-Id': '...' },
|
|
137
156
|
});
|
|
138
157
|
```
|