@qtsurfer/api-client 0.3.0 → 0.5.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
@@ -26,7 +26,7 @@ npm install @qtsurfer/api-client
26
26
  ## Quick start
27
27
 
28
28
  ```ts
29
- import { client, getExchanges, prepareBacktesting } from '@qtsurfer/api-client';
29
+ import { client, listExchanges, prepareBacktest } from '@qtsurfer/api-client';
30
30
 
31
31
  client.setConfig({
32
32
  baseUrl: 'https://api.qtsurfer.com/v1',
@@ -35,7 +35,7 @@ client.setConfig({
35
35
  },
36
36
  });
37
37
 
38
- const { data: exchanges, error } = await getExchanges();
38
+ const { data: exchanges, error } = await listExchanges();
39
39
  if (error) throw error;
40
40
 
41
41
  console.log(exchanges);
@@ -44,12 +44,12 @@ console.log(exchanges);
44
44
  ### API key → JWT
45
45
 
46
46
  Every endpoint above expects a short-lived JWT in `Authorization: Bearer …`.
47
- Exchange a long-lived API key for one via `auth`:
47
+ Exchange a long-lived API key for one via `authenticate`:
48
48
 
49
49
  ```ts
50
- import { auth } from '@qtsurfer/api-client';
50
+ import { authenticate } from '@qtsurfer/api-client';
51
51
 
52
- const { data, error } = await auth({
52
+ const { data, error } = await authenticate({
53
53
  baseUrl: 'https://api.qtsurfer.com/v1',
54
54
  headers: { 'X-API-Key': process.env.QTSURFER_APIKEY! },
55
55
  });
@@ -59,7 +59,7 @@ const { access_token: jwt } = data; // feed to client.setConfig() for the rest
59
59
  ```
60
60
 
61
61
  For production use, prefer the [`@qtsurfer/sdk`](https://github.com/QTSurfer/sdk-ts)
62
- `auth(apikey)` helper — it returns a session that refreshes the JWT
62
+ `authenticate(apikey)` helper — it returns a session that refreshes the JWT
63
63
  transparently, reads `QTSURFER_APIKEY` from the environment, and supports
64
64
  pluggable token stores so callers don't reinvent that plumbing.
65
65
 
@@ -69,27 +69,27 @@ All operations are exported as standalone functions; every operation accepts an
69
69
 
70
70
  | Function | Method | Path | Purpose |
71
71
  | -------- | ------ | ---- | ------- |
72
- | `auth` | POST | `/auth/token` | Exchange an API key for a short-lived JWT |
73
- | `getExchanges` | GET | `/exchanges` | List available exchanges |
74
- | `getInstruments` | GET | `/exchange/{exchangeId}/instruments` | List instruments for an exchange |
75
- | `getExchangeTickersHour` | GET | `/exchange/{exchangeId}/tickers/{base}/{quote}` | Download one hour of tickers as Lastra/Parquet |
76
- | `getExchangeKlinesHour` | GET | `/exchange/{exchangeId}/klines/{base}/{quote}` | Download one hour of klines as Lastra/Parquet |
77
- | `postStrategy` | POST | `/strategy` | Compile a strategy |
78
- | `getStrategyStatus` | GET | `/strategy/{strategyId}` | Poll strategy compilation status |
79
- | `prepareBacktesting` | POST | `/backtesting/prepare` | Start a data preparation job |
80
- | `getPreparationStatus` | GET | `/backtesting/prepare/{jobId}` | Poll preparation status |
81
- | `executeBacktesting` | POST | `/backtesting/execute` | Start a backtest execution |
82
- | `cancelExecution` | POST | `/backtesting/execute/{jobId}/cancel` | Cancel a running execution |
83
- | `getExecutionResult` | GET | `/backtesting/execute/{jobId}` | Poll or fetch execution results |
84
-
85
- All generated types (`Exchange`, `InstrumentDetail`, `BacktestJobResult`, `ResultMap`, etc.) are re-exported from the root.
72
+ | `authenticate` | POST | `/auth/token` | Exchange an API key for a short-lived JWT |
73
+ | `listExchanges` | GET | `/exchanges` | List available exchanges |
74
+ | `listInstruments` | GET | `/exchange/{exchangeId}/instruments` | List instruments for an exchange |
75
+ | `downloadTickers` | GET | `/exchange/{exchangeId}/tickers/{base}/{quote}` | Download one hour of tickers as Lastra/Parquet |
76
+ | `downloadKlines` | GET | `/exchange/{exchangeId}/klines/{base}/{quote}` | Download one hour of klines as Lastra/Parquet |
77
+ | `compileStrategy` | POST | `/strategy` | Compile a strategy |
78
+ | `getStrategy` | GET | `/strategy/{strategyId}` | Poll strategy compilation status |
79
+ | `prepareBacktest` | POST | `/backtesting/prepare` | Start a data preparation job |
80
+ | `getPrepareStatus` | GET | `/backtesting/prepare/{jobId}` | Poll preparation status |
81
+ | `executeBacktest` | POST | `/backtesting/execute` | Start a backtest execution |
82
+ | `cancelBacktest` | POST | `/backtesting/execute/{jobId}/cancel` | Cancel a running execution |
83
+ | `getBacktestResult` | GET | `/backtesting/execute/{jobId}` | Poll or fetch execution results |
84
+
85
+ All generated types (`Exchange`, `InstrumentDetail`, `BacktestJobResult`, `PrepareJobState`, `ResultMap`, etc.) are re-exported from the root.
86
86
 
87
87
  ## Configuring the client
88
88
 
89
89
  The default client points to the staging server. Override via `setConfig` or by passing options inline:
90
90
 
91
91
  ```ts
92
- import { client, getExchanges } from '@qtsurfer/api-client';
92
+ import { client, listExchanges } from '@qtsurfer/api-client';
93
93
 
94
94
  // Global
95
95
  client.setConfig({
@@ -97,7 +97,7 @@ client.setConfig({
97
97
  });
98
98
 
99
99
  // Per-call
100
- await getExchanges({
100
+ await listExchanges({
101
101
  baseUrl: 'https://api.qtsurfer.com/v1',
102
102
  headers: { 'X-Request-Id': '...' },
103
103
  });
@@ -110,9 +110,9 @@ To build your own isolated client (e.g. per-tenant), use `createClient` from `@h
110
110
  Each function returns a discriminated union. Narrow via `error` before using `data`:
111
111
 
112
112
  ```ts
113
- const { data, error } = await prepareBacktesting({
113
+ const { data, error } = await prepareBacktest({
114
114
  body: {
115
- /* PrepareBacktestingRequest */
115
+ /* PrepareRequest */
116
116
  },
117
117
  });
118
118