@qtsurfer/api-client 0.1.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Support. While redistributing the Work or
166
+ Derivative Works thereof, You may choose to offer, and charge a
167
+ fee for, acceptance of support, warranty, indemnity, or other
168
+ liability obligations and/or rights consistent with this License.
169
+ However, in accepting such obligations, You may act only on Your
170
+ own behalf and on Your sole responsibility, not on behalf of any
171
+ other Contributor, and only if You agree to indemnify, defend,
172
+ and hold each Contributor harmless for any liability incurred by,
173
+ or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 QTSurfer
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
200
+ implied. See the License for the specific language governing
201
+ permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,119 @@
1
+ # @qtsurfer/api-client
2
+
3
+ Auto-generated TypeScript API client for the [QTSurfer API](https://github.com/QTSurfer/qtsurfer-api), produced from the OpenAPI 3.1 spec with [`@hey-api/openapi-ts`](https://heyapi.dev/).
4
+
5
+ This package is intentionally thin: one function per operation, 1:1 with the spec. For workflow orchestration (polling, retries, domain objects, unified errors), use [`@qtsurfer/sdk`](https://github.com/QTSurfer/sdk-ts).
6
+
7
+ - Tree-shakeable standalone functions.
8
+ - Full type safety for requests, responses, and error shapes.
9
+ - Native `fetch` based client via `@hey-api/client-fetch`.
10
+ - Works in Node.js `>=20`, modern browsers, Deno, and Bun.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ pnpm add @qtsurfer/api-client
16
+ # or
17
+ npm install @qtsurfer/api-client
18
+ ```
19
+
20
+ ## Quick start
21
+
22
+ ```ts
23
+ import { client, getExchanges, prepareBacktesting } from '@qtsurfer/api-client';
24
+
25
+ client.setConfig({
26
+ baseUrl: 'https://api.qtsurfer.com/v1',
27
+ headers: {
28
+ Authorization: `Bearer ${process.env.QTSURFER_TOKEN}`,
29
+ },
30
+ });
31
+
32
+ const { data: exchanges, error } = await getExchanges();
33
+ if (error) throw error;
34
+
35
+ console.log(exchanges);
36
+ ```
37
+
38
+ ## API surface
39
+
40
+ All operations are exported as standalone functions; every operation accepts an `Options` object and returns `{ data, error, response }`.
41
+
42
+ | Function | Method | Path | Purpose |
43
+ | -------- | ------ | ---- | ------- |
44
+ | `getExchanges` | GET | `/exchanges` | List available exchanges |
45
+ | `getInstruments` | GET | `/exchange/{exchangeId}/instruments` | List instruments for an exchange |
46
+ | `postStrategy` | POST | `/strategy` | Compile a strategy |
47
+ | `getStrategyStatus` | GET | `/strategy/{strategyId}` | Poll strategy compilation status |
48
+ | `prepareBacktesting` | POST | `/backtesting/prepare` | Start a data preparation job |
49
+ | `getPreparationStatus` | GET | `/backtesting/prepare/{jobId}` | Poll preparation status |
50
+ | `executeBacktesting` | POST | `/backtesting/execute` | Start a backtest execution |
51
+ | `cancelExecution` | POST | `/backtesting/execute/{jobId}/cancel` | Cancel a running execution |
52
+ | `getExecutionResult` | GET | `/backtesting/execute/{jobId}` | Poll or fetch execution results |
53
+
54
+ All generated types (`Exchange`, `InstrumentDetail`, `BacktestJobResult`, `ResultMap`, etc.) are re-exported from the root.
55
+
56
+ ## Configuring the client
57
+
58
+ The default client points to the staging server. Override via `setConfig` or by passing options inline:
59
+
60
+ ```ts
61
+ import { client, getExchanges } from '@qtsurfer/api-client';
62
+
63
+ // Global
64
+ client.setConfig({
65
+ baseUrl: 'https://api.qtsurfer.com/v1',
66
+ });
67
+
68
+ // Per-call
69
+ await getExchanges({
70
+ baseUrl: 'https://api.qtsurfer.com/v1',
71
+ headers: { 'X-Request-Id': '...' },
72
+ });
73
+ ```
74
+
75
+ To build your own isolated client (e.g. per-tenant), use `createClient` from `@hey-api/client-fetch`.
76
+
77
+ ## Error handling
78
+
79
+ Each function returns a discriminated union. Narrow via `error` before using `data`:
80
+
81
+ ```ts
82
+ const { data, error } = await prepareBacktesting({
83
+ body: {
84
+ /* PrepareBacktestingRequest */
85
+ },
86
+ });
87
+
88
+ if (error) {
89
+ console.error(error.code, error.message);
90
+ return;
91
+ }
92
+
93
+ console.log(data.jobId);
94
+ ```
95
+
96
+ ## Regenerating the client
97
+
98
+ The `src/generated/` directory is a committed artifact produced from the OpenAPI spec hosted at [`QTSurfer/qtsurfer-api`](https://github.com/QTSurfer/qtsurfer-api/blob/main/openapi.yaml).
99
+
100
+ ```bash
101
+ pnpm install
102
+ pnpm generate # runs @hey-api/openapi-ts against the remote spec
103
+ pnpm lint # tsc --noEmit
104
+ pnpm build # emits dist/ with .js + .d.ts
105
+ ```
106
+
107
+ Configuration lives in `openapi-ts.config.ts`. To generate against a local checkout instead, change `input` to a relative path (e.g. `../qtsurfer-api/openapi.yaml`).
108
+
109
+ ## Development
110
+
111
+ | Script | Description |
112
+ | ------ | ----------- |
113
+ | `pnpm generate` | Regenerate the client from the OpenAPI spec |
114
+ | `pnpm lint` | Type-check without emitting |
115
+ | `pnpm build` | Compile to `dist/` |
116
+
117
+ ## License
118
+
119
+ Apache-2.0 — see [LICENSE](./LICENSE).
@@ -0,0 +1,13 @@
1
+ import type { ClientOptions } from './types.gen';
2
+ import { type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch';
3
+ /**
4
+ * The `createClientConfig()` function will be called on client initialization
5
+ * and the returned object will become the client's initial configuration.
6
+ *
7
+ * You may want to initialize your client this way instead of calling
8
+ * `setConfig()`. This is useful for example if you're using Next.js
9
+ * to ensure your client always has the correct values.
10
+ */
11
+ export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>;
12
+ export declare const client: import("@hey-api/client-fetch").Client;
13
+ //# sourceMappingURL=client.gen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.gen.d.ts","sourceRoot":"","sources":["../../src/generated/client.gen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,IAAI,oBAAoB,EAA8B,MAAM,uBAAuB,CAAC;AAE5H;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,oBAAoB,GAAG,aAAa,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,oBAAoB,GAAG,CAAC,CAAC,KAAK,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;AAE7K,eAAO,MAAM,MAAM,wCAEhB,CAAC"}
@@ -0,0 +1,6 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ import { createClient, createConfig } from '@hey-api/client-fetch';
3
+ export const client = createClient(createConfig({
4
+ baseUrl: 'https://api.staging.qtsurfer.com/v1'
5
+ }));
6
+ //# sourceMappingURL=client.gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.gen.js","sourceRoot":"","sources":["../../src/generated/client.gen.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAGrD,OAAO,EAA2D,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAY5H,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,YAAY,CAAgB;IAC3D,OAAO,EAAE,qCAAqC;CACjD,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './types.gen';
2
+ export * from './sdk.gen';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generated/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,4 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ export * from './types.gen';
3
+ export * from './sdk.gen';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generated/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,284 @@
1
+ export declare const ResponseErrorSchema: {
2
+ readonly description: "General response error";
3
+ readonly type: "object";
4
+ readonly required: readonly ["code", "message"];
5
+ readonly properties: {
6
+ readonly code: {
7
+ readonly description: "Status code";
8
+ readonly type: "integer";
9
+ readonly example: 400;
10
+ };
11
+ readonly message: {
12
+ readonly description: "Error description";
13
+ readonly type: "string";
14
+ readonly example: "Invalid request";
15
+ };
16
+ };
17
+ };
18
+ export declare const InstrumentSchema: {
19
+ readonly description: "Exchange instrument identifier (e.g. a currency pair)";
20
+ readonly type: "string";
21
+ readonly example: "BTC/USDT";
22
+ };
23
+ export declare const InstrumentDetailSchema: {
24
+ readonly description: "Exchange instrument with data availability and market info";
25
+ readonly type: "object";
26
+ readonly required: readonly ["id", "base", "quote"];
27
+ readonly properties: {
28
+ readonly id: {
29
+ readonly type: "string";
30
+ readonly description: "Instrument identifier (e.g. currency pair)";
31
+ readonly example: "BTC/USDT";
32
+ };
33
+ readonly base: {
34
+ readonly type: "string";
35
+ readonly description: "Base currency";
36
+ readonly example: "BTC";
37
+ };
38
+ readonly quote: {
39
+ readonly type: "string";
40
+ readonly description: "Quote currency";
41
+ readonly example: "USDT";
42
+ };
43
+ readonly dataFrom: {
44
+ readonly type: "string";
45
+ readonly format: "date-time";
46
+ readonly description: "Earliest timestamp with quality-verified data available for backtesting";
47
+ readonly example: "2026-03-17T00:00:00Z";
48
+ };
49
+ readonly dataTo: {
50
+ readonly type: "string";
51
+ readonly format: "date-time";
52
+ readonly description: "Latest timestamp with quality-verified data available for backtesting";
53
+ readonly example: "2026-03-31T18:00:00Z";
54
+ };
55
+ readonly lastPrice: {
56
+ readonly type: "number";
57
+ readonly format: "double";
58
+ readonly description: "Last traded price";
59
+ readonly example: 84250.5;
60
+ };
61
+ readonly volume24h: {
62
+ readonly type: "number";
63
+ readonly format: "double";
64
+ readonly description: "Trading volume in the last 24 hours (in quote currency)";
65
+ readonly example: 1234567.89;
66
+ };
67
+ };
68
+ };
69
+ export declare const ExchangeSchema: {
70
+ readonly description: "Exchange service provider";
71
+ readonly type: "object";
72
+ readonly required: readonly ["id", "name"];
73
+ readonly properties: {
74
+ readonly id: {
75
+ readonly description: "Unique identifier for the exchange";
76
+ readonly type: "string";
77
+ readonly example: "binance";
78
+ };
79
+ readonly name: {
80
+ readonly description: "Name of the exchange";
81
+ readonly type: "string";
82
+ readonly example: "Binance";
83
+ };
84
+ readonly description: {
85
+ readonly description: "Description of the exchange";
86
+ readonly type: "string";
87
+ readonly example: "Binance cryptocurrency exchange";
88
+ };
89
+ };
90
+ };
91
+ export declare const DataSourceTypeSchema: {
92
+ readonly type: "string";
93
+ readonly description: "Managed exchange data sources available for backtesting. Currently only ticker is supported; kline and funding rate support is planned.";
94
+ readonly enum: readonly ["ticker"];
95
+ readonly example: "ticker";
96
+ };
97
+ export declare const JobStateSchema: {
98
+ readonly type: "object";
99
+ readonly description: "Information about a single job";
100
+ readonly required: readonly ["contextId", "status", "size", "completed"];
101
+ readonly properties: {
102
+ readonly contextId: {
103
+ readonly type: "string";
104
+ readonly description: "Unique context ID for the job";
105
+ readonly example: "jctx:ticker:4a627755-7f5a-4297-b647-8dddd8aee416:binance:1rabbrpk5r4kkegs83w6qr:btc/usdt:2o8heaioicr0edvx5ybcap";
106
+ };
107
+ readonly status: {
108
+ readonly type: "string";
109
+ readonly description: "Current status of the job";
110
+ readonly enum: readonly ["New", "Started", "Completed", "Aborted", "Failed"];
111
+ readonly example: "Completed";
112
+ };
113
+ readonly statusDetail: {
114
+ readonly type: readonly ["string", "null"];
115
+ readonly description: "Detailed status information, if available";
116
+ readonly example: "Job completed with error code 5001";
117
+ };
118
+ readonly size: {
119
+ readonly type: "integer";
120
+ readonly description: "Total size of the data being prepared";
121
+ readonly example: 100;
122
+ };
123
+ readonly completed: {
124
+ readonly type: "integer";
125
+ readonly description: "The amount of data processed so far";
126
+ readonly example: 50;
127
+ };
128
+ readonly startTime: {
129
+ readonly type: readonly ["string", "null"];
130
+ readonly format: "date-time";
131
+ readonly description: "Timestamp for when the preparation started";
132
+ readonly example: "2025-01-04T14:00:00Z";
133
+ };
134
+ readonly endTime: {
135
+ readonly type: readonly ["string", "null"];
136
+ readonly format: "date-time";
137
+ readonly description: "Timestamp for when the preparation finished";
138
+ readonly example: "2025-01-04T14:00:20Z";
139
+ };
140
+ };
141
+ };
142
+ export declare const AcceptedJobSchema: {
143
+ readonly type: "object";
144
+ readonly description: "Response returned by async endpoints (`202 Accepted`). The `jobId` is deterministic for the\nsame input parameters — repeated calls with identical params return the same id.\n";
145
+ readonly required: readonly ["jobId"];
146
+ readonly properties: {
147
+ readonly jobId: {
148
+ readonly type: "string";
149
+ readonly description: "Unique job identifier; use this to poll for completion.";
150
+ readonly example: "13RBLGQlPnfDjO6wyKSX8i";
151
+ };
152
+ };
153
+ readonly example: {
154
+ readonly jobId: "13RBLGQlPnfDjO6wyKSX8i";
155
+ };
156
+ };
157
+ export declare const BacktestJobResultSchema: {
158
+ readonly type: "object";
159
+ readonly description: "Backtest job result.";
160
+ readonly required: readonly ["results", "state"];
161
+ readonly properties: {
162
+ readonly results: {
163
+ readonly $ref: "#/components/schemas/ResultMap";
164
+ };
165
+ readonly state: {
166
+ readonly $ref: "#/components/schemas/JobState";
167
+ };
168
+ };
169
+ };
170
+ export declare const ResultMapSchema: {
171
+ readonly type: "object";
172
+ readonly description: "Execution result map. Always includes core fields (hostName, iops, strategyId, instrument). Yield metrics (pnlTotal, totalTrades, winRate, etc.) are present when the strategy emitted at least one trade. When signal storage is enabled, includes signal fields described below.";
173
+ readonly required: readonly ["strategyId", "instrument"];
174
+ readonly properties: {
175
+ readonly hostName: {
176
+ readonly type: "string";
177
+ readonly description: "Hostname of the worker node that executed the strategy";
178
+ readonly example: "backtesting-job-worker-84b569dff9-dr4lb";
179
+ };
180
+ readonly iops: {
181
+ readonly type: "number";
182
+ readonly format: "double";
183
+ readonly description: "Instrument operations per second throughput during execution";
184
+ readonly example: 123956.53;
185
+ };
186
+ readonly strategyId: {
187
+ readonly type: "string";
188
+ readonly description: "Redis key of the compiled strategy used for execution. Format: strategy:{userId}:ticker:{compilationId}";
189
+ readonly example: "strategy:4a627755-7f5a-4297-b647-8dddd8aee416:ticker:2iyvtenlzh9dabqtxn7nbv";
190
+ };
191
+ readonly instrument: {
192
+ readonly type: "string";
193
+ readonly description: "The instrument (currency pair) that was backtested";
194
+ readonly example: "BTC/USDT";
195
+ };
196
+ readonly pnlTotal: {
197
+ readonly type: "number";
198
+ readonly format: "double";
199
+ readonly description: "Total profit and loss in the output currency";
200
+ readonly example: 42.75;
201
+ };
202
+ readonly totalTrades: {
203
+ readonly type: "integer";
204
+ readonly format: "int64";
205
+ readonly description: "Total number of trades executed by the strategy";
206
+ readonly example: 156;
207
+ };
208
+ readonly winRate: {
209
+ readonly type: "number";
210
+ readonly format: "double";
211
+ readonly description: "Percentage of profitable trades (0-100)";
212
+ readonly example: 58.33;
213
+ };
214
+ readonly sharpeRatio: {
215
+ readonly type: "number";
216
+ readonly format: "double";
217
+ readonly description: "Risk-adjusted return ratio (mean return / standard deviation of returns)";
218
+ readonly example: 1.245;
219
+ };
220
+ readonly sortinoRatio: {
221
+ readonly type: "number";
222
+ readonly format: "double";
223
+ readonly description: "Downside risk-adjusted return ratio (mean return / downside deviation)";
224
+ readonly example: 1.872;
225
+ };
226
+ readonly cagr: {
227
+ readonly type: "number";
228
+ readonly format: "double";
229
+ readonly description: "Compound Annual Growth Rate";
230
+ readonly example: 0.1534;
231
+ };
232
+ readonly maxDrawdown: {
233
+ readonly type: "number";
234
+ readonly format: "double";
235
+ readonly description: "Maximum absolute drawdown in the output currency";
236
+ readonly example: 12.5;
237
+ };
238
+ readonly maxDrawdownPercent: {
239
+ readonly type: "number";
240
+ readonly format: "double";
241
+ readonly description: "Maximum percentage drawdown from peak equity";
242
+ readonly example: 8.75;
243
+ };
244
+ readonly signalCount: {
245
+ readonly type: "integer";
246
+ readonly description: "Number of signals emitted during strategy execution";
247
+ readonly example: 100000;
248
+ };
249
+ readonly signalsId: {
250
+ readonly type: "string";
251
+ readonly description: "Storage key for the signal Parquet file. Format: {userId}/exec/{exchange}/{jobId}";
252
+ readonly example: "4a627755-7f5a-4297-b647-8dddd8aee416/exec/binance/3vsndwikcuaatjmb83fjtl";
253
+ };
254
+ readonly signalsUrl: {
255
+ readonly type: "string";
256
+ readonly format: "uri";
257
+ readonly description: "Public HTTPS URL to the Parquet file. Computed at setup time from publicBaseUrl + signalsId + .parquet. Available even before upload completes.";
258
+ readonly example: "https://storage.qtsurfer.com/4a627755-7f5a-4297-b647-8dddd8aee416/exec/binance/3vsndwikcuaatjmb83fjtl.parquet";
259
+ };
260
+ readonly signalsUpload: {
261
+ readonly type: "string";
262
+ readonly enum: readonly ["Done", "Failed", "Skipped"];
263
+ readonly description: "Upload status. Done = file uploaded to R2. Failed = upload error (see signalsUploadReason). Skipped = no signals emitted or storage not configured.";
264
+ readonly example: "Done";
265
+ };
266
+ readonly signalsUploadedAt: {
267
+ readonly type: "string";
268
+ readonly format: "date-time";
269
+ readonly description: "ISO 8601 timestamp of when the upload completed. Only present when signalsUpload is Done.";
270
+ readonly example: "2026-03-18T13:21:48.170Z";
271
+ };
272
+ readonly signalsUploadReason: {
273
+ readonly type: "string";
274
+ readonly description: "Human-readable reason when signalsUpload is Failed or Skipped.";
275
+ readonly example: "parquet file empty or missing after close";
276
+ };
277
+ };
278
+ };
279
+ export declare const strategyIdSchema: {
280
+ readonly description: "Unique identifier for a compiled strategy";
281
+ readonly type: "string";
282
+ readonly example: "6bsh31ikwkuivhtgcoa6s4";
283
+ };
284
+ //# sourceMappingURL=schemas.gen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.gen.d.ts","sourceRoot":"","sources":["../../src/generated/schemas.gen.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;CAgBtB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AAEX,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CzB,CAAC;AAEX,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;CAqBjB,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;CAKvB,CAAC;AAEX,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CjB,CAAC;AAEX,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;CAgBpB,CAAC;AAEX,eAAO,MAAM,uBAAuB;;;;;;;;;;;;CAY1B,CAAC;AAEX,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4GlB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC"}