@qtsurfer/api-client 0.19.0 → 0.21.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 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.com/v1',
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.com/v1',
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 44 operations**
72
- the spec declares are exported. The rows below describe **spec version 0.127.0**, which is versioned
71
+ The table is exhaustive: `src/generated/` is produced from the OpenAPI spec, so **all 48 operations**
72
+ the spec declares are exported. The rows below describe **spec version 0.128.17**, 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, most recently compiled first |
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,19 +107,38 @@ 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; optionally simulate fills and equity with `paper` |
110
+ | `startLive` | POST | `/strategy/{strategyId}/live` | Start a compiled strategy on a live feed; optionally simulate fills and equity with `paper`, or request a plain WebSocket stream URL |
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
113
  | `listLive` | GET | `/live` | Page all live runs owned by the authenticated account |
114
114
  | `listPublicLive` | GET | `/live/public` | Page publicly visible live runs |
115
+ | `getLiveRun` | GET | `/live/{runId}` | Read one owned run by its id, including its latest stats and last-change time |
115
116
  | `updateLive` | PATCH | `/live/{runId}` | Change a run's visibility, name, or description |
116
117
  | `updateLiveParams` | PUT | `/live/{runId}/params` | Change parameters while a run stays active |
118
+ | `rotateLiveStream` | POST | `/live/{runId}/stream` | Replace a run's stream URL and retire the old one |
119
+ | `revokeLiveStream` | DELETE | `/live/{runId}/stream` | Permanently revoke a run's stream URL |
120
+ | `sendLiveCommand` | POST | `/live/{runId}/commands` | Send a command to a running strategy without restarting it |
117
121
  | `getLiveRunSignals` | GET | `/live/{runId}/signals` | Page retained signals by time, instrument, or signal type (`paper` items only when output is `mix`) |
118
122
  | `getLiveRunPaper` | GET | `/live/{runId}/paper` | Read simulated accounts, open positions, equity, and KPIs for a paper-trading run |
119
123
  | `getLiveRunPaperEquity` | GET | `/live/{runId}/paper/equity` | Page the run's retained paper equity curve, optionally by quote currency or start time |
120
124
  | `mintLiveConnectionToken` | POST | `/live/token` | Mint a short-lived Centrifugo connection token |
121
125
 
122
- All generated types (`Exchange`, `InstrumentDetail`, `BacktestJobResult`, `PrepareJobState`, `ResultMap`, `LivePaper`, `LivePaperAccount`, `LivePaperEquityPage`, etc.) are re-exported from the root.
126
+ All generated types (`Exchange`, `InstrumentDetail`, `BacktestJobResult`, `PrepareJobState`, `ResultMap`, `LiveRunStats`, `LiveRunDetail`, `LiveRunWithStream`, `LiveStreamUrl`, `LiveStreamRevoked`, `LivePaper`, `LivePaperAccount`, `LivePaperEquityPage`, `SendLiveCommandRequest`, `LiveCommandResult`, etc.) are re-exported from the root.
127
+
128
+ `sendLiveCommand` sends a command to every execution behind an owned live run. The strategy must
129
+ implement the engine's `CommandRequestHandler`; `202` means the command was accepted, not that the
130
+ strategy has completed handling it:
131
+
132
+ ```ts
133
+ import { sendLiveCommand } from '@qtsurfer/api-client';
134
+
135
+ const { data, error } = await sendLiveCommand({
136
+ path: { runId },
137
+ body: { command: 'flatten', properties: { instrument: 'BTC/USDT' } },
138
+ });
139
+ if (error) throw error;
140
+ console.log(data.commandId, data.effectiveAtMs);
141
+ ```
123
142
 
124
143
  ## Configuring the client
125
144
 
@@ -130,12 +149,12 @@ import { client, listExchanges } from '@qtsurfer/api-client';
130
149
 
131
150
  // Global
132
151
  client.setConfig({
133
- baseUrl: 'https://api.qtsurfer.com/v1',
152
+ baseUrl: 'https://api.qtsurfer.net/v1', // Staging beta server
134
153
  });
135
154
 
136
155
  // Per-call
137
156
  await listExchanges({
138
- baseUrl: 'https://api.qtsurfer.com/v1',
157
+ baseUrl: 'https://api.qtsurfer.net/v1', // Staging beta server
139
158
  headers: { 'X-Request-Id': '...' },
140
159
  });
141
160
  ```