@qtsurfer/api-client 0.9.0 → 0.10.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
@@ -68,8 +68,8 @@ 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 18 operations**
72
- the spec declares are exported. The rows below describe **spec version 0.107.0**, which is versioned
71
+ The table is exhaustive: `src/generated/` is produced from the OpenAPI spec, so **all 21 operations**
72
+ the spec declares are exported. The rows below describe **spec version 0.109.2**, which is versioned
73
73
  independently of this package.
74
74
 
75
75
  | Function | Method | Path | Purpose |
@@ -80,9 +80,12 @@ independently of this package.
80
80
  | `listSegmentInstruments` | GET | `/exchange/{exchangeId}/{segment}/instruments` | List an exchange segment's instruments |
81
81
  | `downloadTickers` | GET | `/exchange/{exchangeId}/tickers/{base}/{quote}` | Download one hour of tickers as a Lastra segment |
82
82
  | `downloadKlines` | GET | `/exchange/{exchangeId}/klines/{base}/{quote}` | Download one hour of klines as a Lastra segment |
83
+ | `listStrategies` | GET | `/strategies` | List your registered strategies, most recently compiled first |
83
84
  | `compileStrategy` | POST | `/strategy` | Compile and register a strategy |
84
85
  | `validateStrategy` | POST | `/strategy/{strategyId}/validate` | Check that a registered strategy can actually run |
85
86
  | `getStrategy` | GET | `/strategy/{strategyId}` | Get a strategy by id, including its validation state |
87
+ | `deleteStrategy` | DELETE | `/strategy/{strategyId}` | Release a registered strategy |
88
+ | `getStrategyCode` | GET | `/strategy/{strategyId}/code` | Get a registered strategy's source, if you still have one to read |
86
89
  | `prepareBacktest` | POST | `/backtest/{exchangeId}/{type}/prepare` | Prepare backtest data |
87
90
  | `getPrepareStatus` | GET | `/backtest/{exchangeId}/{type}/prepare/{jobId}` | Get the status of a prepare job |
88
91
  | `executeSweep` | POST | `/backtest/{exchangeId}/{type}/executeSweep/{requestId}` | Execute a parameter sweep over prepared data |
package/dist/index.d.ts CHANGED
@@ -63,6 +63,22 @@ type InstrumentLinks = {
63
63
  */
64
64
  futures?: HalLink;
65
65
  };
66
+ /**
67
+ * HAL `_links` for a strategy — present on a full `StrategyState` body (`GET
68
+ * /strategy/{strategyId}`, and `POST /strategy/{strategyId}/validate`'s already-validated
69
+ * `200`), absent from that same endpoint's `202` — a deliberately partial stub carrying only
70
+ * what is known before a check has even started. Following `code` can still `404` once
71
+ * present: it documents its own honest "nothing to return" for a strategy with no source of
72
+ * its own (a `REFERENCE` marketplace copy, or one resolved only through the platform's shared
73
+ * pool). This link says where to look, not that something is there.
74
+ *
75
+ */
76
+ type StrategyLinks = {
77
+ /**
78
+ * Link to this strategy's registered source, `GET /strategy/{strategyId}/code`.
79
+ */
80
+ code: HalLink;
81
+ };
66
82
  /**
67
83
  * A HAL link object (Hypertext Application Language)
68
84
  */
@@ -762,6 +778,26 @@ type Notice = {
762
778
  */
763
779
  provenance?: "execute" | "compile-dry-run";
764
780
  };
781
+ /**
782
+ * One entry from `GET /strategies` — the same provenance a full `StrategyState` carries
783
+ * (`compiledAt`, `requiredSources`), without its validation state, so listing stays cheap
784
+ * regardless of how many strategies you have registered. Check a specific strategy's
785
+ * validation with `GET /strategy/{strategyId}`.
786
+ *
787
+ */
788
+ type StrategySummary = {
789
+ strategyId: StrategyId;
790
+ /**
791
+ * When the live compilation was produced.
792
+ */
793
+ compiledAt?: string;
794
+ /**
795
+ * The market data this strategy needs. Absent, not empty, when it could
796
+ * not be established without constructing the strategy.
797
+ *
798
+ */
799
+ requiredSources?: Array<string>;
800
+ };
765
801
  /**
766
802
  * What is known about a registered strategy: that it compiled, and what validating it found.
767
803
  *
@@ -833,6 +869,7 @@ type StrategyState = {
833
869
  *
834
870
  */
835
871
  validationStalled?: boolean;
872
+ _links?: StrategyLinks;
836
873
  };
837
874
  type AuthTokenResponse = {
838
875
  /**
@@ -1076,6 +1113,22 @@ type DownloadKlinesResponses = {
1076
1113
  200: Blob | File;
1077
1114
  };
1078
1115
  type DownloadKlinesResponse = DownloadKlinesResponses[keyof DownloadKlinesResponses];
1116
+ type ListStrategiesData = {
1117
+ body?: never;
1118
+ path?: never;
1119
+ query?: never;
1120
+ url: "/strategies";
1121
+ };
1122
+ type ListStrategiesResponses = {
1123
+ /**
1124
+ * Your registered strategies. An empty array if you have none — this is never a `404`.
1125
+ *
1126
+ */
1127
+ 200: {
1128
+ strategies: Array<StrategySummary>;
1129
+ };
1130
+ };
1131
+ type ListStrategiesResponse = ListStrategiesResponses[keyof ListStrategiesResponses];
1079
1132
  type CompileStrategyData = {
1080
1133
  /**
1081
1134
  * Raw strategy Java source code
@@ -1144,6 +1197,34 @@ type ValidateStrategyResponses = {
1144
1197
  202: StrategyState;
1145
1198
  };
1146
1199
  type ValidateStrategyResponse = ValidateStrategyResponses[keyof ValidateStrategyResponses];
1200
+ type DeleteStrategyData = {
1201
+ body?: never;
1202
+ path: {
1203
+ /**
1204
+ * The id returned by `POST /strategy`
1205
+ */
1206
+ strategyId: StrategyId;
1207
+ };
1208
+ query?: never;
1209
+ url: "/strategy/{strategyId}";
1210
+ };
1211
+ type DeleteStrategyErrors = {
1212
+ /**
1213
+ * No such registered strategy for this user
1214
+ */
1215
+ 404: ResponseError;
1216
+ };
1217
+ type DeleteStrategyError = DeleteStrategyErrors[keyof DeleteStrategyErrors];
1218
+ type DeleteStrategyResponses = {
1219
+ /**
1220
+ * Deleted
1221
+ */
1222
+ 200: {
1223
+ strategyId: StrategyId;
1224
+ deleted: true;
1225
+ };
1226
+ };
1227
+ type DeleteStrategyResponse = DeleteStrategyResponses[keyof DeleteStrategyResponses];
1147
1228
  type GetStrategyData = {
1148
1229
  body?: never;
1149
1230
  path: {
@@ -1169,6 +1250,37 @@ type GetStrategyResponses = {
1169
1250
  200: StrategyState;
1170
1251
  };
1171
1252
  type GetStrategyResponse = GetStrategyResponses[keyof GetStrategyResponses];
1253
+ type GetStrategyCodeData = {
1254
+ body?: never;
1255
+ path: {
1256
+ /**
1257
+ * The id returned by `POST /strategy`
1258
+ */
1259
+ strategyId: StrategyId;
1260
+ };
1261
+ query?: never;
1262
+ url: "/strategy/{strategyId}/code";
1263
+ };
1264
+ type GetStrategyCodeErrors = {
1265
+ /**
1266
+ * No such registered strategy for this user, or nothing to read for this id
1267
+ */
1268
+ 404: ResponseError;
1269
+ };
1270
+ type GetStrategyCodeError = GetStrategyCodeErrors[keyof GetStrategyCodeErrors];
1271
+ type GetStrategyCodeResponses = {
1272
+ /**
1273
+ * The registered source
1274
+ */
1275
+ 200: {
1276
+ strategyId: StrategyId;
1277
+ /**
1278
+ * Raw strategy Java source code, exactly as registered.
1279
+ */
1280
+ code: string;
1281
+ };
1282
+ };
1283
+ type GetStrategyCodeResponse = GetStrategyCodeResponses[keyof GetStrategyCodeResponses];
1172
1284
  type PrepareBacktestData = {
1173
1285
  /**
1174
1286
  * The required data to prepare a backtesting
@@ -1513,7 +1625,7 @@ type GetBacktestResultResponses = {
1513
1625
  };
1514
1626
  type GetBacktestResultResponse = GetBacktestResultResponses[keyof GetBacktestResultResponses];
1515
1627
  type ClientOptions = {
1516
- baseUrl: "https://api.staging.qtsurfer.com/v1" | "https://api.qtsurfer.com/v1" | (string & {});
1628
+ baseUrl: "https://api.qtsurfer.net/v1" | "https://api.qtsurfer.com/v1" | (string & {});
1517
1629
  };
1518
1630
 
1519
1631
  type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options$1<TData, ThrowOnError> & {
@@ -1610,6 +1722,19 @@ declare const downloadTickers: <ThrowOnError extends boolean = false>(options: O
1610
1722
  *
1611
1723
  */
1612
1724
  declare const downloadKlines: <ThrowOnError extends boolean = false>(options: Options<DownloadKlinesData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Blob | File, ResponseError, ThrowOnError>;
1725
+ /**
1726
+ * List your registered strategies
1727
+ * Every strategy you have registered and not deleted, most recently compiled first.
1728
+ *
1729
+ * Each entry carries the same provenance `GET /strategy/{strategyId}` does — `compiledAt`,
1730
+ * `requiredSources` — but not its validation state, so listing stays cheap regardless of how
1731
+ * many strategies you have. Check a specific strategy's validation with `GET
1732
+ * /strategy/{strategyId}`.
1733
+ *
1734
+ */
1735
+ declare const listStrategies: <ThrowOnError extends boolean = false>(options?: Options<ListStrategiesData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
1736
+ strategies: Array<StrategySummary>;
1737
+ }, unknown, ThrowOnError>;
1613
1738
  /**
1614
1739
  * Compile and register a strategy
1615
1740
  * Compiles raw strategy source and registers it, returning its `strategyId`.
@@ -1653,6 +1778,24 @@ declare const compileStrategy: <ThrowOnError extends boolean = false>(options: O
1653
1778
  *
1654
1779
  */
1655
1780
  declare const validateStrategy: <ThrowOnError extends boolean = false>(options: Options<ValidateStrategyData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<StrategyState, ResponseError, ThrowOnError>;
1781
+ /**
1782
+ * Release a registered strategy
1783
+ * Removes a strategy from `GET /strategy/{strategyId}` and `GET /strategies`. This is not
1784
+ * undone by re-submitting the same source to `POST /strategy` — that registers a new
1785
+ * strategy, with a new id.
1786
+ *
1787
+ * **Backtests you already ran against this strategy are unaffected.** Deleting it stops it
1788
+ * from counting against your account and stops you from validating or re-running it under
1789
+ * this id — it does not erase what already happened.
1790
+ *
1791
+ * Only removes a strategy you registered yourself. If you copied someone else's strategy
1792
+ * (a shared/marketplace listing), deleting your copy never affects theirs, or anyone else's.
1793
+ *
1794
+ */
1795
+ declare const deleteStrategy: <ThrowOnError extends boolean = false>(options: Options<DeleteStrategyData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
1796
+ strategyId: StrategyId;
1797
+ deleted: true;
1798
+ }, ResponseError, ThrowOnError>;
1656
1799
  /**
1657
1800
  * Get a strategy by id, including its validation state
1658
1801
  * Reports that the strategy is registered — implied by a `200` at all — and what validating it
@@ -1663,6 +1806,21 @@ declare const validateStrategy: <ThrowOnError extends boolean = false>(options:
1663
1806
  *
1664
1807
  */
1665
1808
  declare const getStrategy: <ThrowOnError extends boolean = false>(options: Options<GetStrategyData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<StrategyState, ResponseError, ThrowOnError>;
1809
+ /**
1810
+ * Get a registered strategy's source, if you still have one to read
1811
+ * The exact source you last submitted for this id — the same text `POST /strategy` derives
1812
+ * `strategyId` from, whitespace and comments included.
1813
+ *
1814
+ * **"If available", not "always".** A strategy you resolve only through a shared/marketplace
1815
+ * listing you copied by reference carries no source of its own, and reads as a `404` here the
1816
+ * same as a `strategyId` you never registered — that is the honest answer either way, since
1817
+ * from this endpoint's point of view nothing is there to return.
1818
+ *
1819
+ */
1820
+ declare const getStrategyCode: <ThrowOnError extends boolean = false>(options: Options<GetStrategyCodeData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<{
1821
+ strategyId: StrategyId;
1822
+ code: string;
1823
+ }, ResponseError, ThrowOnError>;
1666
1824
  /**
1667
1825
  * Prepare backtest data
1668
1826
  * Enqueues a prepare task over the requested date range. Returns immediately with a `jobId`;
@@ -1806,4 +1964,4 @@ declare const getBacktestResult: <ThrowOnError extends boolean = false>(options:
1806
1964
 
1807
1965
  declare const client: _hey_api_client_fetch.Client;
1808
1966
 
1809
- export { type AcceptedJob, type AuthTokenError, type AuthTokenResponse, type AuthenticateData, type AuthenticateError, type AuthenticateErrors, type AuthenticateResponse, type AuthenticateResponses, type BacktestJobResult, type CancelBacktestData, type CancelBacktestError, type CancelBacktestErrors, type CancelBacktestResponse, type CancelBacktestResponses, type CancelSweepData, type CancelSweepError, type CancelSweepErrors, type CancelSweepResponse, type CancelSweepResponses, type ClientOptions, type CompileStrategyData, type CompileStrategyError, type CompileStrategyErrors, type CompileStrategyResponse, type CompileStrategyResponses, type CoverageWindow, type DataSourceType, type DownloadKlinesData, type DownloadKlinesError, type DownloadKlinesErrors, type DownloadKlinesResponse, type DownloadKlinesResponses, type DownloadTickersData, type DownloadTickersError, type DownloadTickersErrors, type DownloadTickersResponse, type DownloadTickersResponses, type EquityPoint, type Exchange, type ExecuteBacktestData, type ExecuteBacktestError, type ExecuteBacktestErrors, type ExecuteBacktestResponse, type ExecuteBacktestResponses, type ExecuteSweepAccepted, type ExecuteSweepData, type ExecuteSweepError, type ExecuteSweepErrors, type ExecuteSweepRequest, type ExecuteSweepResponse, type ExecuteSweepResponses, type ExecuteSweepResult, type GetBacktestResultData, type GetBacktestResultError, type GetBacktestResultErrors, type GetBacktestResultResponse, type GetBacktestResultResponses, type GetPrepareStatusData, type GetPrepareStatusError, type GetPrepareStatusErrors, type GetPrepareStatusResponse, type GetPrepareStatusResponses, type GetStrategyData, type GetStrategyError, type GetStrategyErrors, type GetStrategyResponse, type GetStrategyResponses, type GetSweepResultData, type GetSweepResultError, type GetSweepResultErrors, type GetSweepResultResponse, type GetSweepResultResponses, type GetSweepSensitivityData, type GetSweepSensitivityError, type GetSweepSensitivityErrors, type GetSweepSensitivityResponse, type GetSweepSensitivityResponses, type HalLink, type Instrument, type InstrumentCoverage, type InstrumentDetail, type InstrumentLinks, type InstrumentListMeta, type InstrumentListResponse, type JobState, type ListExchangesData, type ListExchangesResponse, type ListExchangesResponses, type ListInstrumentsData, type ListInstrumentsError, type ListInstrumentsErrors, type ListInstrumentsResponse, type ListInstrumentsResponses, type ListSegmentInstrumentsData, type ListSegmentInstrumentsError, type ListSegmentInstrumentsErrors, type ListSegmentInstrumentsResponse, type ListSegmentInstrumentsResponses, type Notice, type Options, type PrepareBacktestData, type PrepareBacktestError, type PrepareBacktestErrors, type PrepareBacktestResponse, type PrepareBacktestResponses, type PrepareJobState, type PrepareRequest, type ResponseError, type ResultMap, type StrategyId, type StrategyState, type SweepAxis, type SweepBaseConfig, type SweepHeatmap, type SweepHeatmapCell, type SweepMarginal, type SweepMarginalPoint, type SweepProgress, type SweepRunRow, type SweepSensitivity, type SweepSpecRequest, type ValidateStrategyData, type ValidateStrategyError, type ValidateStrategyErrors, type ValidateStrategyResponse, type ValidateStrategyResponses, type WalkForwardAccepted, type WalkForwardFold, type WalkForwardRequest, type WalkForwardResult, authenticate, cancelBacktest, cancelSweep, client, compileStrategy, downloadKlines, downloadTickers, executeBacktest, executeSweep, getBacktestResult, getPrepareStatus, getStrategy, getSweepResult, getSweepSensitivity, listExchanges, listInstruments, listSegmentInstruments, prepareBacktest, validateStrategy };
1967
+ export { type AcceptedJob, type AuthTokenError, type AuthTokenResponse, type AuthenticateData, type AuthenticateError, type AuthenticateErrors, type AuthenticateResponse, type AuthenticateResponses, type BacktestJobResult, type CancelBacktestData, type CancelBacktestError, type CancelBacktestErrors, type CancelBacktestResponse, type CancelBacktestResponses, type CancelSweepData, type CancelSweepError, type CancelSweepErrors, type CancelSweepResponse, type CancelSweepResponses, type ClientOptions, type CompileStrategyData, type CompileStrategyError, type CompileStrategyErrors, type CompileStrategyResponse, type CompileStrategyResponses, type CoverageWindow, type DataSourceType, type DeleteStrategyData, type DeleteStrategyError, type DeleteStrategyErrors, type DeleteStrategyResponse, type DeleteStrategyResponses, type DownloadKlinesData, type DownloadKlinesError, type DownloadKlinesErrors, type DownloadKlinesResponse, type DownloadKlinesResponses, type DownloadTickersData, type DownloadTickersError, type DownloadTickersErrors, type DownloadTickersResponse, type DownloadTickersResponses, type EquityPoint, type Exchange, type ExecuteBacktestData, type ExecuteBacktestError, type ExecuteBacktestErrors, type ExecuteBacktestResponse, type ExecuteBacktestResponses, type ExecuteSweepAccepted, type ExecuteSweepData, type ExecuteSweepError, type ExecuteSweepErrors, type ExecuteSweepRequest, type ExecuteSweepResponse, type ExecuteSweepResponses, type ExecuteSweepResult, type GetBacktestResultData, type GetBacktestResultError, type GetBacktestResultErrors, type GetBacktestResultResponse, type GetBacktestResultResponses, type GetPrepareStatusData, type GetPrepareStatusError, type GetPrepareStatusErrors, type GetPrepareStatusResponse, type GetPrepareStatusResponses, type GetStrategyCodeData, type GetStrategyCodeError, type GetStrategyCodeErrors, type GetStrategyCodeResponse, type GetStrategyCodeResponses, type GetStrategyData, type GetStrategyError, type GetStrategyErrors, type GetStrategyResponse, type GetStrategyResponses, type GetSweepResultData, type GetSweepResultError, type GetSweepResultErrors, type GetSweepResultResponse, type GetSweepResultResponses, type GetSweepSensitivityData, type GetSweepSensitivityError, type GetSweepSensitivityErrors, type GetSweepSensitivityResponse, type GetSweepSensitivityResponses, type HalLink, type Instrument, type InstrumentCoverage, type InstrumentDetail, type InstrumentLinks, type InstrumentListMeta, type InstrumentListResponse, type JobState, type ListExchangesData, type ListExchangesResponse, type ListExchangesResponses, type ListInstrumentsData, type ListInstrumentsError, type ListInstrumentsErrors, type ListInstrumentsResponse, type ListInstrumentsResponses, type ListSegmentInstrumentsData, type ListSegmentInstrumentsError, type ListSegmentInstrumentsErrors, type ListSegmentInstrumentsResponse, type ListSegmentInstrumentsResponses, type ListStrategiesData, type ListStrategiesResponse, type ListStrategiesResponses, type Notice, type Options, type PrepareBacktestData, type PrepareBacktestError, type PrepareBacktestErrors, type PrepareBacktestResponse, type PrepareBacktestResponses, type PrepareJobState, type PrepareRequest, type ResponseError, type ResultMap, type StrategyId, type StrategyLinks, type StrategyState, type StrategySummary, type SweepAxis, type SweepBaseConfig, type SweepHeatmap, type SweepHeatmapCell, type SweepMarginal, type SweepMarginalPoint, type SweepProgress, type SweepRunRow, type SweepSensitivity, type SweepSpecRequest, type ValidateStrategyData, type ValidateStrategyError, type ValidateStrategyErrors, type ValidateStrategyResponse, type ValidateStrategyResponses, type WalkForwardAccepted, type WalkForwardFold, type WalkForwardRequest, type WalkForwardResult, authenticate, cancelBacktest, cancelSweep, client, compileStrategy, deleteStrategy, downloadKlines, downloadTickers, executeBacktest, executeSweep, getBacktestResult, getPrepareStatus, getStrategy, getStrategyCode, getSweepResult, getSweepSensitivity, listExchanges, listInstruments, listSegmentInstruments, listStrategies, prepareBacktest, validateStrategy };
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  } from "@hey-api/client-fetch";
6
6
  var client = createClient(
7
7
  createConfig({
8
- baseUrl: "https://api.staging.qtsurfer.com/v1"
8
+ baseUrl: "https://api.qtsurfer.net/v1"
9
9
  })
10
10
  );
11
11
 
@@ -52,6 +52,18 @@ var downloadKlines = (options) => {
52
52
  ...options
53
53
  });
54
54
  };
55
+ var listStrategies = (options) => {
56
+ return (options?.client ?? client).get({
57
+ security: [
58
+ {
59
+ scheme: "bearer",
60
+ type: "http"
61
+ }
62
+ ],
63
+ url: "/strategies",
64
+ ...options
65
+ });
66
+ };
55
67
  var compileStrategy = (options) => {
56
68
  return (options.client ?? client).post({
57
69
  bodySerializer: null,
@@ -81,6 +93,18 @@ var validateStrategy = (options) => {
81
93
  ...options
82
94
  });
83
95
  };
96
+ var deleteStrategy = (options) => {
97
+ return (options.client ?? client).delete({
98
+ security: [
99
+ {
100
+ scheme: "bearer",
101
+ type: "http"
102
+ }
103
+ ],
104
+ url: "/strategy/{strategyId}",
105
+ ...options
106
+ });
107
+ };
84
108
  var getStrategy = (options) => {
85
109
  return (options.client ?? client).get({
86
110
  security: [
@@ -93,6 +117,18 @@ var getStrategy = (options) => {
93
117
  ...options
94
118
  });
95
119
  };
120
+ var getStrategyCode = (options) => {
121
+ return (options.client ?? client).get({
122
+ security: [
123
+ {
124
+ scheme: "bearer",
125
+ type: "http"
126
+ }
127
+ ],
128
+ url: "/strategy/{strategyId}/code",
129
+ ...options
130
+ });
131
+ };
96
132
  var prepareBacktest = (options) => {
97
133
  return (options.client ?? client).post({
98
134
  security: [
@@ -219,6 +255,7 @@ export {
219
255
  cancelSweep,
220
256
  client,
221
257
  compileStrategy,
258
+ deleteStrategy,
222
259
  downloadKlines,
223
260
  downloadTickers,
224
261
  executeBacktest,
@@ -226,11 +263,13 @@ export {
226
263
  getBacktestResult,
227
264
  getPrepareStatus,
228
265
  getStrategy,
266
+ getStrategyCode,
229
267
  getSweepResult,
230
268
  getSweepSensitivity,
231
269
  listExchanges,
232
270
  listInstruments,
233
271
  listSegmentInstruments,
272
+ listStrategies,
234
273
  prepareBacktest,
235
274
  validateStrategy
236
275
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/generated/client.gen.ts","../src/generated/sdk.gen.ts"],"sourcesContent":["// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { ClientOptions } from \"./types.gen\";\nimport {\n type Config,\n type ClientOptions as DefaultClientOptions,\n createClient,\n createConfig,\n} from \"@hey-api/client-fetch\";\n\n/**\n * The `createClientConfig()` function will be called on client initialization\n * and the returned object will become the client's initial configuration.\n *\n * You may want to initialize your client this way instead of calling\n * `setConfig()`. This is useful for example if you're using Next.js\n * to ensure your client always has the correct values.\n */\nexport type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> =\n (\n override?: Config<DefaultClientOptions & T>\n ) => Config<Required<DefaultClientOptions> & T>;\n\nexport const client = createClient(\n createConfig<ClientOptions>({\n baseUrl: \"https://api.staging.qtsurfer.com/v1\",\n })\n);\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type {\n Options as ClientOptions,\n TDataShape,\n Client,\n} from \"@hey-api/client-fetch\";\nimport type {\n AuthenticateData,\n AuthenticateResponse,\n AuthenticateError,\n ListExchangesData,\n ListExchangesResponse,\n ListInstrumentsData,\n ListInstrumentsResponse,\n ListInstrumentsError,\n ListSegmentInstrumentsData,\n ListSegmentInstrumentsResponse,\n ListSegmentInstrumentsError,\n DownloadTickersData,\n DownloadTickersResponse,\n DownloadTickersError,\n DownloadKlinesData,\n DownloadKlinesResponse,\n DownloadKlinesError,\n CompileStrategyData,\n CompileStrategyResponse,\n CompileStrategyError,\n ValidateStrategyData,\n ValidateStrategyResponse,\n ValidateStrategyError,\n GetStrategyData,\n GetStrategyResponse,\n GetStrategyError,\n PrepareBacktestData,\n PrepareBacktestResponse,\n PrepareBacktestError,\n GetPrepareStatusData,\n GetPrepareStatusResponse,\n GetPrepareStatusError,\n ExecuteSweepData,\n ExecuteSweepResponse,\n ExecuteSweepError,\n CancelSweepData,\n CancelSweepResponse,\n CancelSweepError,\n GetSweepResultData,\n GetSweepResultResponse,\n GetSweepResultError,\n GetSweepSensitivityData,\n GetSweepSensitivityResponse,\n GetSweepSensitivityError,\n ExecuteBacktestData,\n ExecuteBacktestResponse,\n ExecuteBacktestError,\n CancelBacktestData,\n CancelBacktestResponse,\n CancelBacktestError,\n GetBacktestResultData,\n GetBacktestResultResponse,\n GetBacktestResultError,\n} from \"./types.gen\";\nimport { client as _heyApiClient } from \"./client.gen\";\n\nexport type Options<\n TData extends TDataShape = TDataShape,\n ThrowOnError extends boolean = boolean\n> = ClientOptions<TData, ThrowOnError> & {\n /**\n * You can provide a client instance returned by `createClient()` instead of\n * individual options. This might be also useful if you want to implement a\n * custom client.\n */\n client?: Client;\n /**\n * You can pass arbitrary values through the `meta` object. This can be\n * used to access values that aren't defined as part of the SDK function.\n */\n meta?: Record<string, unknown>;\n};\n\n/**\n * Exchange API key for a short-lived JWT\n * Exchanges a long-lived API key for a short-lived JWT used by every other\n * endpoint. This is the only endpoint that accepts an API key directly —\n * callers should obtain a JWT here, then send it as `Authorization: Bearer\n * <token>` to all other operations.\n *\n * The returned JWT carries the caller's subscription `tier` as a claim and\n * expires after `expires_in` seconds. Callers should refresh the token\n * before expiry (or on a `401` response) by calling this endpoint again.\n *\n */\nexport const authenticate = <ThrowOnError extends boolean = false>(\n options?: Options<AuthenticateData, ThrowOnError>\n) => {\n return (options?.client ?? _heyApiClient).post<\n AuthenticateResponse,\n AuthenticateError,\n ThrowOnError\n >({\n security: [\n {\n name: \"X-API-Key\",\n type: \"apiKey\",\n },\n ],\n url: \"/auth/token\",\n ...options,\n });\n};\n\n/**\n * List the available exchanges\n */\nexport const listExchanges = <ThrowOnError extends boolean = false>(\n options?: Options<ListExchangesData, ThrowOnError>\n) => {\n return (options?.client ?? _heyApiClient).get<\n ListExchangesResponse,\n unknown,\n ThrowOnError\n >({\n url: \"/exchanges\",\n ...options,\n });\n};\n\n/**\n * List an exchange's instruments (default spot segment)\n * \"Give me binance instruments\" — returns the exchange's DEFAULT segment (`spot`)\n * in `data`, each instrument with per-data-type coverage and market info. `meta`\n * confirms the served `segment` (`spot`); HAL `_links` carry `self` plus the\n * `spot` / `futures` segment-discovery links.\n *\n */\nexport const listInstruments = <ThrowOnError extends boolean = false>(\n options: Options<ListInstrumentsData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n ListInstrumentsResponse,\n ListInstrumentsError,\n ThrowOnError\n >({\n url: \"/exchange/{exchangeId}/instruments\",\n ...options,\n });\n};\n\n/**\n * List an exchange segment's instruments\n * Returns the instruments for one market segment of the exchange, each with\n * per-data-type coverage and market info. HAL `_links` carry `self` plus the\n * `spot` / `futures` segment-discovery links; the default-segment shortcut is\n * `GET /exchange/{exchangeId}/instruments` (spot).\n *\n */\nexport const listSegmentInstruments = <ThrowOnError extends boolean = false>(\n options: Options<ListSegmentInstrumentsData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n ListSegmentInstrumentsResponse,\n ListSegmentInstrumentsError,\n ThrowOnError\n >({\n url: \"/exchange/{exchangeId}/{segment}/instruments\",\n ...options,\n });\n};\n\n/**\n * Download one hour of tickers for an instrument as a Lastra segment\n * Serves exactly one hour of raw ticker data for the given instrument on the\n * requested exchange. The payload is a native [Lastra](https://github.com/QTSurfer/lastra-java)\n * file — QTSurfer's columnar format for tick-precision timeseries — with\n * no JSON envelope.\n *\n * One segment = one hour, aligned to UTC. The `hour` query parameter selects\n * the segment and must match `YYYY-MM-DDTHH` (no minutes/seconds, no timezone\n * suffix). Example: `hour=2026-01-15T10` returns `h10.lastra` for\n * 2026-01-15, covering `[10:00:00Z, 11:00:00Z)`. Hours not yet available\n * return `404`.\n *\n * A `format=parquet` query parameter switches the response to on-the-fly\n * Parquet conversion via [lastra-convert](https://github.com/QTSurfer/lastra-convert)\n * for clients that don't yet read Lastra. Lastra is the primary format\n * and cheaper when the client can consume it.\n *\n * Clients:\n * - [lastra-java](https://github.com/QTSurfer/lastra-java) — reference\n * Java reader/writer with per-column codecs (ALP, Gorilla, delta-varint,\n * ZSTD) and CRC32 integrity.\n * - [lastra-ts](https://github.com/QTSurfer/lastra-ts) — TypeScript reader\n * (~4 kB bundle, browser + Node.js).\n * - [duckdb-lastra](https://github.com/QTSurfer/duckdb-lastra) — DuckDB\n * extension for ad-hoc SQL over Lastra files.\n * - [lastra-convert](https://github.com/QTSurfer/lastra-convert) — CLI + Java\n * API for converting to/from Parquet, Reef, and CSV.\n * - `curl -OJ` for offline dumps (the `Content-Disposition` header sets a\n * descriptive filename).\n *\n */\nexport const downloadTickers = <ThrowOnError extends boolean = false>(\n options: Options<DownloadTickersData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n DownloadTickersResponse,\n DownloadTickersError,\n ThrowOnError\n >({\n url: \"/exchange/{exchangeId}/tickers/{base}/{quote}\",\n ...options,\n });\n};\n\n/**\n * Download one hour of klines for an instrument as a Lastra segment\n * Same shape and semantics as `/exchange/{exchangeId}/tickers/{base}/{quote}`,\n * but serves klines (aggregated bars) instead of raw ticks. One\n * [Lastra](https://github.com/QTSurfer/lastra-java) segment = one hour of\n * klines at the exchange's native kline cadence, aligned to UTC.\n *\n * Klines use the same columnar layout as tickers — readers that handle one\n * format read the other with the same code. Use this endpoint when a\n * per-tick payload would be too large for the window of interest.\n *\n */\nexport const downloadKlines = <ThrowOnError extends boolean = false>(\n options: Options<DownloadKlinesData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n DownloadKlinesResponse,\n DownloadKlinesError,\n ThrowOnError\n >({\n url: \"/exchange/{exchangeId}/klines/{base}/{quote}\",\n ...options,\n });\n};\n\n/**\n * Compile and register a strategy\n * Compiles raw strategy source and registers it, returning its `strategyId`.\n *\n * **This answers one question: is the source valid Java.** It compiles, registers, and hands\n * back the id — nothing more. Whether the class can actually run is\n * `POST /strategy/{strategyId}/validate`, and everything known about a strategy, validation\n * included, is read from `GET /strategy/{strategyId}`. One place to ask, so there is no second\n * answer to keep in step.\n *\n * The `strategyId` is derived from what the code *means*, not from how it is written. Adding a\n * comment, inserting a blank line, re-indenting, reordering imports, or moving a method around\n * all return the **same** id — you have not created a second strategy. Renaming a variable,\n * changing an identifier's case, reordering fields, or reordering statements inside a method\n * return a **different** one.\n *\n * Two rules follow, and they are worth designing around:\n *\n * - re-submitting a strategy you have only reformatted is free, and gives you back the id you\n * already had, along with any validation already recorded against it;\n * - the id says nothing about *behaviour*. Two sources that compute the same thing by\n * different means are two strategies, because deciding otherwise would mean deciding program\n * equivalence.\n *\n */\nexport const compileStrategy = <ThrowOnError extends boolean = false>(\n options: Options<CompileStrategyData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).post<\n CompileStrategyResponse,\n CompileStrategyError,\n ThrowOnError\n >({\n bodySerializer: null,\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/strategy\",\n ...options,\n headers: {\n \"Content-Type\": \"text/plain\",\n ...options?.headers,\n },\n });\n};\n\n/**\n * Check that a registered strategy can actually run\n * Instantiates the compiled class and drives it through a bounded synthetic series, so a wiring\n * fault surfaces here instead of at your first backtest. The verdict — pass or fail, plus any\n * engine notices — is recorded and served from `GET /strategy/{strategyId}`.\n *\n * **Idempotent.** If a verdict already exists for the current compilation it comes straight\n * back with `200` and nothing is queued. Otherwise the check is queued and this returns `202`;\n * poll `GET /strategy/{strategyId}` until `validation` is `passed` or `failed`.\n *\n * Recompiling supersedes a verdict, which makes this callable again — the old answer described\n * bytecode that is no longer what would run.\n *\n */\nexport const validateStrategy = <ThrowOnError extends boolean = false>(\n options: Options<ValidateStrategyData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).post<\n ValidateStrategyResponse,\n ValidateStrategyError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/strategy/{strategyId}/validate\",\n ...options,\n });\n};\n\n/**\n * Get a strategy by id, including its validation state\n * Reports that the strategy is registered — implied by a `200` at all — and what validating it\n * found.\n *\n * A `404` means one thing: no such registered strategy for this user. It is never a stale or\n * expired answer; registration and verdict are stored durably, not cached.\n *\n */\nexport const getStrategy = <ThrowOnError extends boolean = false>(\n options: Options<GetStrategyData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n GetStrategyResponse,\n GetStrategyError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/strategy/{strategyId}\",\n ...options,\n });\n};\n\n/**\n * Prepare backtest data\n * Enqueues a prepare task over the requested date range. Returns immediately with a `jobId`;\n * poll `GET /backtest/{exchangeId}/{type}/prepare/{jobId}` for completion.\n *\n * The same params always return the same `jobId` (idempotent). Repeated calls with identical\n * params do not enqueue duplicate work — they reuse the existing job.\n *\n */\nexport const prepareBacktest = <ThrowOnError extends boolean = false>(\n options: Options<PrepareBacktestData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).post<\n PrepareBacktestResponse,\n PrepareBacktestError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/prepare\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n },\n });\n};\n\n/**\n * Get the status of a prepare job\n * Retrieves the current state of the prepare job identified by `jobId`.\n * Poll until `status` is `Completed`, `Failed`, or `Aborted`.\n *\n */\nexport const getPrepareStatus = <ThrowOnError extends boolean = false>(\n options: Options<GetPrepareStatusData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n GetPrepareStatusResponse,\n GetPrepareStatusError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/prepare/{jobId}\",\n ...options,\n });\n};\n\n/**\n * Execute a parameter sweep over prepared data\n * Runs a parameter matrix over the single immutable dataset identified by `requestId`.\n * The backend expands and executes the matrix internally; clients poll the returned\n * `sweepId` for incremental results.\n *\n * Supplying `walkForward` runs the sweep in a different mode entirely. Instead of scoring\n * every parameter vector once over the whole range, the data is split into F sequential\n * folds; each fold optimizes the full grid on its own window and then scores only its winner\n * on the window immediately after — data that winner was not chosen on. It answers a harder\n * question than a leaderboard: not \"which parameters won\", but \"does re-optimizing this\n * periodically actually work\". Omit the block and nothing changes, including the response.\n *\n * The cost is the reason it is opt-in rather than always on: F folds × N vectors, so a\n * 4-fold run over a 500-point grid is 2004 backtests where the plain sweep is 500. The\n * request is rejected when `folds × totalRuns` exceeds the server's sweep budget.\n *\n */\nexport const executeSweep = <ThrowOnError extends boolean = false>(\n options: Options<ExecuteSweepData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).post<\n ExecuteSweepResponse,\n ExecuteSweepError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/executeSweep/{requestId}\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n },\n });\n};\n\n/**\n * Cancel a running parameter sweep\n * Requests cancellation between parameter vectors. Completed rows remain readable.\n */\nexport const cancelSweep = <ThrowOnError extends boolean = false>(\n options: Options<CancelSweepData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).delete<\n CancelSweepResponse,\n CancelSweepError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}\",\n ...options,\n });\n};\n\n/**\n * Get sweep progress and results\n * Returns incremental sweep progress. The default `ranked` view sorts and may truncate the\n * display leaderboard. `order=natural` returns every available row, untruncated, ordered by\n * deterministic `runIx`; use that view when materialising durable trial rows.\n *\n * The `ranked` view is ordered by **plateau score** by default, not by the raw objective. A\n * plateau score is the objective of the worst run in a parameter point's immediate\n * neighbourhood, so a point scores well only if the region around it also does — the highest\n * raw score is frequently a spike that does not survive the parameters moving slightly. Pass\n * `ranking=raw` for the unadjusted objective order.\n *\n * Rows in the `ranked` view carry `plateauScore` and `neighbourCount` when plateau ranking\n * applied. Read them together: `neighbourCount: 0` means the point had no neighbours to\n * compare against, so its plateau score is unevidenced rather than confirmed. Sweeps\n * submitted before plateau ranking existed have no stored parameter grid to rebuild a\n * neighbourhood from and are always ranked raw; the response's `ranking` field says which\n * ordering was actually used.\n *\n * A sweep submitted with `walkForward` answers in a different shape, and the `walkForward`\n * field on the response is what tells the two apart — it appears as soon as the sweep is\n * accepted, before any fold has finished, so it is safe to branch on while polling. There\n * the leaderboard is one row per completed fold: that fold's winner as it scored\n * **out-of-sample**, with `runIx` carrying the fold index rather than a grid position. The\n * in-sample runs behind those winners are not retained — they are an optimization's working\n * set, and only the winner survives its fold. `ranking` is always `raw` and no plateau, DSR\n * or PBO figure is reported: the out-of-sample scores are already the honest number, and\n * layering a certification computed over F observations on top of them would overstate what\n * was measured.\n *\n */\nexport const getSweepResult = <ThrowOnError extends boolean = false>(\n options: Options<GetSweepResultData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n GetSweepResultResponse,\n GetSweepResultError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}\",\n ...options,\n });\n};\n\n/**\n * Get sweep sensitivity surfaces\n * How the objective moves as each parameter moves — the question a leaderboard cannot answer.\n * A leaderboard says which point won; a sweep can spend its entire budget on an axis that\n * never moved the objective at all, and showing only the top rows hides that completely.\n *\n * A **marginal** takes one axis and collapses every other one: for each value of that axis,\n * it aggregates every run that used it, whatever the rest of the parameters were. A flat\n * marginal means the axis is irrelevant over the range swept. `best`, `mean` and `worst` are\n * all reported because them disagreeing is itself the signal — a value with a high `best` and\n * a poor `mean` works only in specific company, which is an interaction between parameters\n * and would be invisible behind a single number.\n *\n * A **heatmap** does the same over a pair of axes, where that interaction becomes visible\n * directly.\n *\n * Served from the sweep's stored rows: no re-run, no engine call, and it works on a sweep\n * still in flight — the aggregates then describe the runs finished so far. Aborted runs are\n * excluded throughout, since a run that threw measured nothing and counting it as a bad\n * outcome would invent evidence against a parameter value that was never really tested.\n *\n * This is a separate endpoint rather than extra fields on the result view because the\n * two-dimensional half is quadratic in the axis count (N axes give N(N-1)/2 surfaces, each\n * the product of two axes' value counts) and is not wanted on the poll that drives progress.\n *\n */\nexport const getSweepSensitivity = <ThrowOnError extends boolean = false>(\n options: Options<GetSweepSensitivityData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n GetSweepSensitivityResponse,\n GetSweepSensitivityError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}/sensitivity\",\n ...options,\n });\n};\n\n/**\n * Execute a compiled strategy against a prepared dataset\n * Enqueues an execute task that runs the strategy identified by `strategyId` over the data\n * prepared by the prepare job identified by `prepareJobId`. The instrument and date range are\n * recovered from the prepare job — they do not need to be sent again.\n *\n * Returns immediately with a `jobId`; poll `GET /backtest/{exchangeId}/{type}/execute/{jobId}`\n * for the result.\n *\n * The same params (same `prepareJobId`, `strategyId`, `storeSignals`) always return the same\n * `jobId` (idempotent).\n *\n */\nexport const executeBacktest = <ThrowOnError extends boolean = false>(\n options: Options<ExecuteBacktestData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).post<\n ExecuteBacktestResponse,\n ExecuteBacktestError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/execute\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n },\n });\n};\n\n/**\n * Cancel a running backtest execution\n * Requests cancellation of the specified execution. The execution\n * status will transition to `Aborted` once the cancellation is\n * processed. Cancellation is asynchronous — poll the GET endpoint\n * to confirm the final status.\n *\n */\nexport const cancelBacktest = <ThrowOnError extends boolean = false>(\n options: Options<CancelBacktestData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).delete<\n CancelBacktestResponse,\n CancelBacktestError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/execute/{jobId}\",\n ...options,\n });\n};\n\n/**\n * Get the result of a backtest execution job\n * Retrieves the current state and results of the execute job identified by `jobId`.\n * Poll until `state.status` is `Completed`, `Failed`, or `Aborted`.\n *\n * A `202` means the result is not readable yet — keep polling. It is never a terminal\n * outcome, and it carries no `state`, so a poll loop that stops on a terminal status will\n * not stop on it.\n *\n */\nexport const getBacktestResult = <ThrowOnError extends boolean = false>(\n options: Options<GetBacktestResultData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n GetBacktestResultResponse,\n GetBacktestResultError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/execute/{jobId}\",\n ...options,\n });\n};\n"],"mappings":"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","names":[]}
1
+ {"version":3,"sources":["../src/generated/client.gen.ts","../src/generated/sdk.gen.ts"],"sourcesContent":["// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { ClientOptions } from \"./types.gen\";\nimport {\n type Config,\n type ClientOptions as DefaultClientOptions,\n createClient,\n createConfig,\n} from \"@hey-api/client-fetch\";\n\n/**\n * The `createClientConfig()` function will be called on client initialization\n * and the returned object will become the client's initial configuration.\n *\n * You may want to initialize your client this way instead of calling\n * `setConfig()`. This is useful for example if you're using Next.js\n * to ensure your client always has the correct values.\n */\nexport type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> =\n (\n override?: Config<DefaultClientOptions & T>\n ) => Config<Required<DefaultClientOptions> & T>;\n\nexport const client = createClient(\n createConfig<ClientOptions>({\n baseUrl: \"https://api.qtsurfer.net/v1\",\n })\n);\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type {\n Options as ClientOptions,\n TDataShape,\n Client,\n} from \"@hey-api/client-fetch\";\nimport type {\n AuthenticateData,\n AuthenticateResponse,\n AuthenticateError,\n ListExchangesData,\n ListExchangesResponse,\n ListInstrumentsData,\n ListInstrumentsResponse,\n ListInstrumentsError,\n ListSegmentInstrumentsData,\n ListSegmentInstrumentsResponse,\n ListSegmentInstrumentsError,\n DownloadTickersData,\n DownloadTickersResponse,\n DownloadTickersError,\n DownloadKlinesData,\n DownloadKlinesResponse,\n DownloadKlinesError,\n ListStrategiesData,\n ListStrategiesResponse,\n CompileStrategyData,\n CompileStrategyResponse,\n CompileStrategyError,\n ValidateStrategyData,\n ValidateStrategyResponse,\n ValidateStrategyError,\n DeleteStrategyData,\n DeleteStrategyResponse,\n DeleteStrategyError,\n GetStrategyData,\n GetStrategyResponse,\n GetStrategyError,\n GetStrategyCodeData,\n GetStrategyCodeResponse,\n GetStrategyCodeError,\n PrepareBacktestData,\n PrepareBacktestResponse,\n PrepareBacktestError,\n GetPrepareStatusData,\n GetPrepareStatusResponse,\n GetPrepareStatusError,\n ExecuteSweepData,\n ExecuteSweepResponse,\n ExecuteSweepError,\n CancelSweepData,\n CancelSweepResponse,\n CancelSweepError,\n GetSweepResultData,\n GetSweepResultResponse,\n GetSweepResultError,\n GetSweepSensitivityData,\n GetSweepSensitivityResponse,\n GetSweepSensitivityError,\n ExecuteBacktestData,\n ExecuteBacktestResponse,\n ExecuteBacktestError,\n CancelBacktestData,\n CancelBacktestResponse,\n CancelBacktestError,\n GetBacktestResultData,\n GetBacktestResultResponse,\n GetBacktestResultError,\n} from \"./types.gen\";\nimport { client as _heyApiClient } from \"./client.gen\";\n\nexport type Options<\n TData extends TDataShape = TDataShape,\n ThrowOnError extends boolean = boolean\n> = ClientOptions<TData, ThrowOnError> & {\n /**\n * You can provide a client instance returned by `createClient()` instead of\n * individual options. This might be also useful if you want to implement a\n * custom client.\n */\n client?: Client;\n /**\n * You can pass arbitrary values through the `meta` object. This can be\n * used to access values that aren't defined as part of the SDK function.\n */\n meta?: Record<string, unknown>;\n};\n\n/**\n * Exchange API key for a short-lived JWT\n * Exchanges a long-lived API key for a short-lived JWT used by every other\n * endpoint. This is the only endpoint that accepts an API key directly —\n * callers should obtain a JWT here, then send it as `Authorization: Bearer\n * <token>` to all other operations.\n *\n * The returned JWT carries the caller's subscription `tier` as a claim and\n * expires after `expires_in` seconds. Callers should refresh the token\n * before expiry (or on a `401` response) by calling this endpoint again.\n *\n */\nexport const authenticate = <ThrowOnError extends boolean = false>(\n options?: Options<AuthenticateData, ThrowOnError>\n) => {\n return (options?.client ?? _heyApiClient).post<\n AuthenticateResponse,\n AuthenticateError,\n ThrowOnError\n >({\n security: [\n {\n name: \"X-API-Key\",\n type: \"apiKey\",\n },\n ],\n url: \"/auth/token\",\n ...options,\n });\n};\n\n/**\n * List the available exchanges\n */\nexport const listExchanges = <ThrowOnError extends boolean = false>(\n options?: Options<ListExchangesData, ThrowOnError>\n) => {\n return (options?.client ?? _heyApiClient).get<\n ListExchangesResponse,\n unknown,\n ThrowOnError\n >({\n url: \"/exchanges\",\n ...options,\n });\n};\n\n/**\n * List an exchange's instruments (default spot segment)\n * \"Give me binance instruments\" — returns the exchange's DEFAULT segment (`spot`)\n * in `data`, each instrument with per-data-type coverage and market info. `meta`\n * confirms the served `segment` (`spot`); HAL `_links` carry `self` plus the\n * `spot` / `futures` segment-discovery links.\n *\n */\nexport const listInstruments = <ThrowOnError extends boolean = false>(\n options: Options<ListInstrumentsData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n ListInstrumentsResponse,\n ListInstrumentsError,\n ThrowOnError\n >({\n url: \"/exchange/{exchangeId}/instruments\",\n ...options,\n });\n};\n\n/**\n * List an exchange segment's instruments\n * Returns the instruments for one market segment of the exchange, each with\n * per-data-type coverage and market info. HAL `_links` carry `self` plus the\n * `spot` / `futures` segment-discovery links; the default-segment shortcut is\n * `GET /exchange/{exchangeId}/instruments` (spot).\n *\n */\nexport const listSegmentInstruments = <ThrowOnError extends boolean = false>(\n options: Options<ListSegmentInstrumentsData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n ListSegmentInstrumentsResponse,\n ListSegmentInstrumentsError,\n ThrowOnError\n >({\n url: \"/exchange/{exchangeId}/{segment}/instruments\",\n ...options,\n });\n};\n\n/**\n * Download one hour of tickers for an instrument as a Lastra segment\n * Serves exactly one hour of raw ticker data for the given instrument on the\n * requested exchange. The payload is a native [Lastra](https://github.com/QTSurfer/lastra-java)\n * file — QTSurfer's columnar format for tick-precision timeseries — with\n * no JSON envelope.\n *\n * One segment = one hour, aligned to UTC. The `hour` query parameter selects\n * the segment and must match `YYYY-MM-DDTHH` (no minutes/seconds, no timezone\n * suffix). Example: `hour=2026-01-15T10` returns `h10.lastra` for\n * 2026-01-15, covering `[10:00:00Z, 11:00:00Z)`. Hours not yet available\n * return `404`.\n *\n * A `format=parquet` query parameter switches the response to on-the-fly\n * Parquet conversion via [lastra-convert](https://github.com/QTSurfer/lastra-convert)\n * for clients that don't yet read Lastra. Lastra is the primary format\n * and cheaper when the client can consume it.\n *\n * Clients:\n * - [lastra-java](https://github.com/QTSurfer/lastra-java) — reference\n * Java reader/writer with per-column codecs (ALP, Gorilla, delta-varint,\n * ZSTD) and CRC32 integrity.\n * - [lastra-ts](https://github.com/QTSurfer/lastra-ts) — TypeScript reader\n * (~4 kB bundle, browser + Node.js).\n * - [duckdb-lastra](https://github.com/QTSurfer/duckdb-lastra) — DuckDB\n * extension for ad-hoc SQL over Lastra files.\n * - [lastra-convert](https://github.com/QTSurfer/lastra-convert) — CLI + Java\n * API for converting to/from Parquet, Reef, and CSV.\n * - `curl -OJ` for offline dumps (the `Content-Disposition` header sets a\n * descriptive filename).\n *\n */\nexport const downloadTickers = <ThrowOnError extends boolean = false>(\n options: Options<DownloadTickersData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n DownloadTickersResponse,\n DownloadTickersError,\n ThrowOnError\n >({\n url: \"/exchange/{exchangeId}/tickers/{base}/{quote}\",\n ...options,\n });\n};\n\n/**\n * Download one hour of klines for an instrument as a Lastra segment\n * Same shape and semantics as `/exchange/{exchangeId}/tickers/{base}/{quote}`,\n * but serves klines (aggregated bars) instead of raw ticks. One\n * [Lastra](https://github.com/QTSurfer/lastra-java) segment = one hour of\n * klines at the exchange's native kline cadence, aligned to UTC.\n *\n * Klines use the same columnar layout as tickers — readers that handle one\n * format read the other with the same code. Use this endpoint when a\n * per-tick payload would be too large for the window of interest.\n *\n */\nexport const downloadKlines = <ThrowOnError extends boolean = false>(\n options: Options<DownloadKlinesData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n DownloadKlinesResponse,\n DownloadKlinesError,\n ThrowOnError\n >({\n url: \"/exchange/{exchangeId}/klines/{base}/{quote}\",\n ...options,\n });\n};\n\n/**\n * List your registered strategies\n * Every strategy you have registered and not deleted, most recently compiled first.\n *\n * Each entry carries the same provenance `GET /strategy/{strategyId}` does — `compiledAt`,\n * `requiredSources` — but not its validation state, so listing stays cheap regardless of how\n * many strategies you have. Check a specific strategy's validation with `GET\n * /strategy/{strategyId}`.\n *\n */\nexport const listStrategies = <ThrowOnError extends boolean = false>(\n options?: Options<ListStrategiesData, ThrowOnError>\n) => {\n return (options?.client ?? _heyApiClient).get<\n ListStrategiesResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/strategies\",\n ...options,\n });\n};\n\n/**\n * Compile and register a strategy\n * Compiles raw strategy source and registers it, returning its `strategyId`.\n *\n * **This answers one question: is the source valid Java.** It compiles, registers, and hands\n * back the id — nothing more. Whether the class can actually run is\n * `POST /strategy/{strategyId}/validate`, and everything known about a strategy, validation\n * included, is read from `GET /strategy/{strategyId}`. One place to ask, so there is no second\n * answer to keep in step.\n *\n * The `strategyId` is derived from what the code *means*, not from how it is written. Adding a\n * comment, inserting a blank line, re-indenting, reordering imports, or moving a method around\n * all return the **same** id — you have not created a second strategy. Renaming a variable,\n * changing an identifier's case, reordering fields, or reordering statements inside a method\n * return a **different** one.\n *\n * Two rules follow, and they are worth designing around:\n *\n * - re-submitting a strategy you have only reformatted is free, and gives you back the id you\n * already had, along with any validation already recorded against it;\n * - the id says nothing about *behaviour*. Two sources that compute the same thing by\n * different means are two strategies, because deciding otherwise would mean deciding program\n * equivalence.\n *\n */\nexport const compileStrategy = <ThrowOnError extends boolean = false>(\n options: Options<CompileStrategyData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).post<\n CompileStrategyResponse,\n CompileStrategyError,\n ThrowOnError\n >({\n bodySerializer: null,\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/strategy\",\n ...options,\n headers: {\n \"Content-Type\": \"text/plain\",\n ...options?.headers,\n },\n });\n};\n\n/**\n * Check that a registered strategy can actually run\n * Instantiates the compiled class and drives it through a bounded synthetic series, so a wiring\n * fault surfaces here instead of at your first backtest. The verdict — pass or fail, plus any\n * engine notices — is recorded and served from `GET /strategy/{strategyId}`.\n *\n * **Idempotent.** If a verdict already exists for the current compilation it comes straight\n * back with `200` and nothing is queued. Otherwise the check is queued and this returns `202`;\n * poll `GET /strategy/{strategyId}` until `validation` is `passed` or `failed`.\n *\n * Recompiling supersedes a verdict, which makes this callable again — the old answer described\n * bytecode that is no longer what would run.\n *\n */\nexport const validateStrategy = <ThrowOnError extends boolean = false>(\n options: Options<ValidateStrategyData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).post<\n ValidateStrategyResponse,\n ValidateStrategyError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/strategy/{strategyId}/validate\",\n ...options,\n });\n};\n\n/**\n * Release a registered strategy\n * Removes a strategy from `GET /strategy/{strategyId}` and `GET /strategies`. This is not\n * undone by re-submitting the same source to `POST /strategy` — that registers a new\n * strategy, with a new id.\n *\n * **Backtests you already ran against this strategy are unaffected.** Deleting it stops it\n * from counting against your account and stops you from validating or re-running it under\n * this id — it does not erase what already happened.\n *\n * Only removes a strategy you registered yourself. If you copied someone else's strategy\n * (a shared/marketplace listing), deleting your copy never affects theirs, or anyone else's.\n *\n */\nexport const deleteStrategy = <ThrowOnError extends boolean = false>(\n options: Options<DeleteStrategyData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).delete<\n DeleteStrategyResponse,\n DeleteStrategyError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/strategy/{strategyId}\",\n ...options,\n });\n};\n\n/**\n * Get a strategy by id, including its validation state\n * Reports that the strategy is registered — implied by a `200` at all — and what validating it\n * found.\n *\n * A `404` means one thing: no such registered strategy for this user. It is never a stale or\n * expired answer; registration and verdict are stored durably, not cached.\n *\n */\nexport const getStrategy = <ThrowOnError extends boolean = false>(\n options: Options<GetStrategyData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n GetStrategyResponse,\n GetStrategyError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/strategy/{strategyId}\",\n ...options,\n });\n};\n\n/**\n * Get a registered strategy's source, if you still have one to read\n * The exact source you last submitted for this id — the same text `POST /strategy` derives\n * `strategyId` from, whitespace and comments included.\n *\n * **\"If available\", not \"always\".** A strategy you resolve only through a shared/marketplace\n * listing you copied by reference carries no source of its own, and reads as a `404` here the\n * same as a `strategyId` you never registered — that is the honest answer either way, since\n * from this endpoint's point of view nothing is there to return.\n *\n */\nexport const getStrategyCode = <ThrowOnError extends boolean = false>(\n options: Options<GetStrategyCodeData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n GetStrategyCodeResponse,\n GetStrategyCodeError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/strategy/{strategyId}/code\",\n ...options,\n });\n};\n\n/**\n * Prepare backtest data\n * Enqueues a prepare task over the requested date range. Returns immediately with a `jobId`;\n * poll `GET /backtest/{exchangeId}/{type}/prepare/{jobId}` for completion.\n *\n * The same params always return the same `jobId` (idempotent). Repeated calls with identical\n * params do not enqueue duplicate work — they reuse the existing job.\n *\n */\nexport const prepareBacktest = <ThrowOnError extends boolean = false>(\n options: Options<PrepareBacktestData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).post<\n PrepareBacktestResponse,\n PrepareBacktestError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/prepare\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n },\n });\n};\n\n/**\n * Get the status of a prepare job\n * Retrieves the current state of the prepare job identified by `jobId`.\n * Poll until `status` is `Completed`, `Failed`, or `Aborted`.\n *\n */\nexport const getPrepareStatus = <ThrowOnError extends boolean = false>(\n options: Options<GetPrepareStatusData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n GetPrepareStatusResponse,\n GetPrepareStatusError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/prepare/{jobId}\",\n ...options,\n });\n};\n\n/**\n * Execute a parameter sweep over prepared data\n * Runs a parameter matrix over the single immutable dataset identified by `requestId`.\n * The backend expands and executes the matrix internally; clients poll the returned\n * `sweepId` for incremental results.\n *\n * Supplying `walkForward` runs the sweep in a different mode entirely. Instead of scoring\n * every parameter vector once over the whole range, the data is split into F sequential\n * folds; each fold optimizes the full grid on its own window and then scores only its winner\n * on the window immediately after — data that winner was not chosen on. It answers a harder\n * question than a leaderboard: not \"which parameters won\", but \"does re-optimizing this\n * periodically actually work\". Omit the block and nothing changes, including the response.\n *\n * The cost is the reason it is opt-in rather than always on: F folds × N vectors, so a\n * 4-fold run over a 500-point grid is 2004 backtests where the plain sweep is 500. The\n * request is rejected when `folds × totalRuns` exceeds the server's sweep budget.\n *\n */\nexport const executeSweep = <ThrowOnError extends boolean = false>(\n options: Options<ExecuteSweepData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).post<\n ExecuteSweepResponse,\n ExecuteSweepError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/executeSweep/{requestId}\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n },\n });\n};\n\n/**\n * Cancel a running parameter sweep\n * Requests cancellation between parameter vectors. Completed rows remain readable.\n */\nexport const cancelSweep = <ThrowOnError extends boolean = false>(\n options: Options<CancelSweepData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).delete<\n CancelSweepResponse,\n CancelSweepError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}\",\n ...options,\n });\n};\n\n/**\n * Get sweep progress and results\n * Returns incremental sweep progress. The default `ranked` view sorts and may truncate the\n * display leaderboard. `order=natural` returns every available row, untruncated, ordered by\n * deterministic `runIx`; use that view when materialising durable trial rows.\n *\n * The `ranked` view is ordered by **plateau score** by default, not by the raw objective. A\n * plateau score is the objective of the worst run in a parameter point's immediate\n * neighbourhood, so a point scores well only if the region around it also does — the highest\n * raw score is frequently a spike that does not survive the parameters moving slightly. Pass\n * `ranking=raw` for the unadjusted objective order.\n *\n * Rows in the `ranked` view carry `plateauScore` and `neighbourCount` when plateau ranking\n * applied. Read them together: `neighbourCount: 0` means the point had no neighbours to\n * compare against, so its plateau score is unevidenced rather than confirmed. Sweeps\n * submitted before plateau ranking existed have no stored parameter grid to rebuild a\n * neighbourhood from and are always ranked raw; the response's `ranking` field says which\n * ordering was actually used.\n *\n * A sweep submitted with `walkForward` answers in a different shape, and the `walkForward`\n * field on the response is what tells the two apart — it appears as soon as the sweep is\n * accepted, before any fold has finished, so it is safe to branch on while polling. There\n * the leaderboard is one row per completed fold: that fold's winner as it scored\n * **out-of-sample**, with `runIx` carrying the fold index rather than a grid position. The\n * in-sample runs behind those winners are not retained — they are an optimization's working\n * set, and only the winner survives its fold. `ranking` is always `raw` and no plateau, DSR\n * or PBO figure is reported: the out-of-sample scores are already the honest number, and\n * layering a certification computed over F observations on top of them would overstate what\n * was measured.\n *\n */\nexport const getSweepResult = <ThrowOnError extends boolean = false>(\n options: Options<GetSweepResultData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n GetSweepResultResponse,\n GetSweepResultError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}\",\n ...options,\n });\n};\n\n/**\n * Get sweep sensitivity surfaces\n * How the objective moves as each parameter moves — the question a leaderboard cannot answer.\n * A leaderboard says which point won; a sweep can spend its entire budget on an axis that\n * never moved the objective at all, and showing only the top rows hides that completely.\n *\n * A **marginal** takes one axis and collapses every other one: for each value of that axis,\n * it aggregates every run that used it, whatever the rest of the parameters were. A flat\n * marginal means the axis is irrelevant over the range swept. `best`, `mean` and `worst` are\n * all reported because them disagreeing is itself the signal — a value with a high `best` and\n * a poor `mean` works only in specific company, which is an interaction between parameters\n * and would be invisible behind a single number.\n *\n * A **heatmap** does the same over a pair of axes, where that interaction becomes visible\n * directly.\n *\n * Served from the sweep's stored rows: no re-run, no engine call, and it works on a sweep\n * still in flight — the aggregates then describe the runs finished so far. Aborted runs are\n * excluded throughout, since a run that threw measured nothing and counting it as a bad\n * outcome would invent evidence against a parameter value that was never really tested.\n *\n * This is a separate endpoint rather than extra fields on the result view because the\n * two-dimensional half is quadratic in the axis count (N axes give N(N-1)/2 surfaces, each\n * the product of two axes' value counts) and is not wanted on the poll that drives progress.\n *\n */\nexport const getSweepSensitivity = <ThrowOnError extends boolean = false>(\n options: Options<GetSweepSensitivityData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n GetSweepSensitivityResponse,\n GetSweepSensitivityError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/executeSweep/{requestId}/{sweepId}/sensitivity\",\n ...options,\n });\n};\n\n/**\n * Execute a compiled strategy against a prepared dataset\n * Enqueues an execute task that runs the strategy identified by `strategyId` over the data\n * prepared by the prepare job identified by `prepareJobId`. The instrument and date range are\n * recovered from the prepare job — they do not need to be sent again.\n *\n * Returns immediately with a `jobId`; poll `GET /backtest/{exchangeId}/{type}/execute/{jobId}`\n * for the result.\n *\n * The same params (same `prepareJobId`, `strategyId`, `storeSignals`) always return the same\n * `jobId` (idempotent).\n *\n */\nexport const executeBacktest = <ThrowOnError extends boolean = false>(\n options: Options<ExecuteBacktestData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).post<\n ExecuteBacktestResponse,\n ExecuteBacktestError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/execute\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n },\n });\n};\n\n/**\n * Cancel a running backtest execution\n * Requests cancellation of the specified execution. The execution\n * status will transition to `Aborted` once the cancellation is\n * processed. Cancellation is asynchronous — poll the GET endpoint\n * to confirm the final status.\n *\n */\nexport const cancelBacktest = <ThrowOnError extends boolean = false>(\n options: Options<CancelBacktestData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).delete<\n CancelBacktestResponse,\n CancelBacktestError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/execute/{jobId}\",\n ...options,\n });\n};\n\n/**\n * Get the result of a backtest execution job\n * Retrieves the current state and results of the execute job identified by `jobId`.\n * Poll until `state.status` is `Completed`, `Failed`, or `Aborted`.\n *\n * A `202` means the result is not readable yet — keep polling. It is never a terminal\n * outcome, and it carries no `state`, so a poll loop that stops on a terminal status will\n * not stop on it.\n *\n */\nexport const getBacktestResult = <ThrowOnError extends boolean = false>(\n options: Options<GetBacktestResultData, ThrowOnError>\n) => {\n return (options.client ?? _heyApiClient).get<\n GetBacktestResultResponse,\n GetBacktestResultError,\n ThrowOnError\n >({\n security: [\n {\n scheme: \"bearer\",\n type: \"http\",\n },\n ],\n url: \"/backtest/{exchangeId}/{type}/execute/{jobId}\",\n ...options,\n });\n};\n"],"mappings":"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","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qtsurfer/api-client",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Auto-generated TypeScript API client for the QTSurfer API (from OpenAPI 3.1 spec)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -23,6 +23,6 @@ export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> =
23
23
 
24
24
  export const client = createClient(
25
25
  createConfig<ClientOptions>({
26
- baseUrl: "https://api.staging.qtsurfer.com/v1",
26
+ baseUrl: "https://api.qtsurfer.net/v1",
27
27
  })
28
28
  );
@@ -104,6 +104,30 @@ export const InstrumentLinksSchema = {
104
104
  },
105
105
  } as const;
106
106
 
107
+ export const StrategyLinksSchema = {
108
+ description: `HAL \`_links\` for a strategy — present on a full \`StrategyState\` body (\`GET
109
+ /strategy/{strategyId}\`, and \`POST /strategy/{strategyId}/validate\`'s already-validated
110
+ \`200\`), absent from that same endpoint's \`202\` — a deliberately partial stub carrying only
111
+ what is known before a check has even started. Following \`code\` can still \`404\` once
112
+ present: it documents its own honest "nothing to return" for a strategy with no source of
113
+ its own (a \`REFERENCE\` marketplace copy, or one resolved only through the platform's shared
114
+ pool). This link says where to look, not that something is there.
115
+ `,
116
+ type: "object",
117
+ required: ["code"],
118
+ properties: {
119
+ code: {
120
+ allOf: [
121
+ {
122
+ $ref: "#/components/schemas/HalLink",
123
+ },
124
+ ],
125
+ description:
126
+ "Link to this strategy's registered source, `GET /strategy/{strategyId}/code`.",
127
+ },
128
+ },
129
+ } as const;
130
+
107
131
  export const HalLinkSchema = {
108
132
  description: "A HAL link object (Hypertext Application Language)",
109
133
  type: "object",
@@ -1417,6 +1441,35 @@ real run (\`execute\`) is a clean bill of health, while an empty list from
1417
1441
  },
1418
1442
  } as const;
1419
1443
 
1444
+ export const StrategySummarySchema = {
1445
+ type: "object",
1446
+ description: `One entry from \`GET /strategies\` — the same provenance a full \`StrategyState\` carries
1447
+ (\`compiledAt\`, \`requiredSources\`), without its validation state, so listing stays cheap
1448
+ regardless of how many strategies you have registered. Check a specific strategy's
1449
+ validation with \`GET /strategy/{strategyId}\`.
1450
+ `,
1451
+ required: ["strategyId"],
1452
+ properties: {
1453
+ strategyId: {
1454
+ $ref: "#/components/schemas/strategyId",
1455
+ },
1456
+ compiledAt: {
1457
+ type: "string",
1458
+ format: "date-time",
1459
+ description: "When the live compilation was produced.",
1460
+ },
1461
+ requiredSources: {
1462
+ type: "array",
1463
+ description: `The market data this strategy needs. Absent, not empty, when it could
1464
+ not be established without constructing the strategy.
1465
+ `,
1466
+ items: {
1467
+ type: "string",
1468
+ },
1469
+ },
1470
+ },
1471
+ } as const;
1472
+
1420
1473
  export const StrategyStateSchema = {
1421
1474
  type: "object",
1422
1475
  description: `What is known about a registered strategy: that it compiled, and what validating it found.
@@ -1505,6 +1558,9 @@ went; it simply reached less than a full run would.
1505
1558
  the strategy — the check has not run. Stop waiting and re-request it later.
1506
1559
  `,
1507
1560
  },
1561
+ _links: {
1562
+ $ref: "#/components/schemas/StrategyLinks",
1563
+ },
1508
1564
  },
1509
1565
  example: {
1510
1566
  strategyId: "6bsh31ikwkuivhtgcoa6s4",
@@ -1520,6 +1576,11 @@ the strategy — the check has not run. Stop waiting and re-request it later.
1520
1576
  provenance: "compile-dry-run",
1521
1577
  },
1522
1578
  ],
1579
+ _links: {
1580
+ code: {
1581
+ href: "/v1/strategy/6bsh31ikwkuivhtgcoa6s4/code",
1582
+ },
1583
+ },
1523
1584
  },
1524
1585
  } as const;
1525
1586
 
@@ -23,15 +23,23 @@ import type {
23
23
  DownloadKlinesData,
24
24
  DownloadKlinesResponse,
25
25
  DownloadKlinesError,
26
+ ListStrategiesData,
27
+ ListStrategiesResponse,
26
28
  CompileStrategyData,
27
29
  CompileStrategyResponse,
28
30
  CompileStrategyError,
29
31
  ValidateStrategyData,
30
32
  ValidateStrategyResponse,
31
33
  ValidateStrategyError,
34
+ DeleteStrategyData,
35
+ DeleteStrategyResponse,
36
+ DeleteStrategyError,
32
37
  GetStrategyData,
33
38
  GetStrategyResponse,
34
39
  GetStrategyError,
40
+ GetStrategyCodeData,
41
+ GetStrategyCodeResponse,
42
+ GetStrategyCodeError,
35
43
  PrepareBacktestData,
36
44
  PrepareBacktestResponse,
37
45
  PrepareBacktestError,
@@ -238,6 +246,35 @@ export const downloadKlines = <ThrowOnError extends boolean = false>(
238
246
  });
239
247
  };
240
248
 
249
+ /**
250
+ * List your registered strategies
251
+ * Every strategy you have registered and not deleted, most recently compiled first.
252
+ *
253
+ * Each entry carries the same provenance `GET /strategy/{strategyId}` does — `compiledAt`,
254
+ * `requiredSources` — but not its validation state, so listing stays cheap regardless of how
255
+ * many strategies you have. Check a specific strategy's validation with `GET
256
+ * /strategy/{strategyId}`.
257
+ *
258
+ */
259
+ export const listStrategies = <ThrowOnError extends boolean = false>(
260
+ options?: Options<ListStrategiesData, ThrowOnError>
261
+ ) => {
262
+ return (options?.client ?? _heyApiClient).get<
263
+ ListStrategiesResponse,
264
+ unknown,
265
+ ThrowOnError
266
+ >({
267
+ security: [
268
+ {
269
+ scheme: "bearer",
270
+ type: "http",
271
+ },
272
+ ],
273
+ url: "/strategies",
274
+ ...options,
275
+ });
276
+ };
277
+
241
278
  /**
242
279
  * Compile and register a strategy
243
280
  * Compiles raw strategy source and registers it, returning its `strategyId`.
@@ -320,6 +357,39 @@ export const validateStrategy = <ThrowOnError extends boolean = false>(
320
357
  });
321
358
  };
322
359
 
360
+ /**
361
+ * Release a registered strategy
362
+ * Removes a strategy from `GET /strategy/{strategyId}` and `GET /strategies`. This is not
363
+ * undone by re-submitting the same source to `POST /strategy` — that registers a new
364
+ * strategy, with a new id.
365
+ *
366
+ * **Backtests you already ran against this strategy are unaffected.** Deleting it stops it
367
+ * from counting against your account and stops you from validating or re-running it under
368
+ * this id — it does not erase what already happened.
369
+ *
370
+ * Only removes a strategy you registered yourself. If you copied someone else's strategy
371
+ * (a shared/marketplace listing), deleting your copy never affects theirs, or anyone else's.
372
+ *
373
+ */
374
+ export const deleteStrategy = <ThrowOnError extends boolean = false>(
375
+ options: Options<DeleteStrategyData, ThrowOnError>
376
+ ) => {
377
+ return (options.client ?? _heyApiClient).delete<
378
+ DeleteStrategyResponse,
379
+ DeleteStrategyError,
380
+ ThrowOnError
381
+ >({
382
+ security: [
383
+ {
384
+ scheme: "bearer",
385
+ type: "http",
386
+ },
387
+ ],
388
+ url: "/strategy/{strategyId}",
389
+ ...options,
390
+ });
391
+ };
392
+
323
393
  /**
324
394
  * Get a strategy by id, including its validation state
325
395
  * Reports that the strategy is registered — implied by a `200` at all — and what validating it
@@ -348,6 +418,36 @@ export const getStrategy = <ThrowOnError extends boolean = false>(
348
418
  });
349
419
  };
350
420
 
421
+ /**
422
+ * Get a registered strategy's source, if you still have one to read
423
+ * The exact source you last submitted for this id — the same text `POST /strategy` derives
424
+ * `strategyId` from, whitespace and comments included.
425
+ *
426
+ * **"If available", not "always".** A strategy you resolve only through a shared/marketplace
427
+ * listing you copied by reference carries no source of its own, and reads as a `404` here the
428
+ * same as a `strategyId` you never registered — that is the honest answer either way, since
429
+ * from this endpoint's point of view nothing is there to return.
430
+ *
431
+ */
432
+ export const getStrategyCode = <ThrowOnError extends boolean = false>(
433
+ options: Options<GetStrategyCodeData, ThrowOnError>
434
+ ) => {
435
+ return (options.client ?? _heyApiClient).get<
436
+ GetStrategyCodeResponse,
437
+ GetStrategyCodeError,
438
+ ThrowOnError
439
+ >({
440
+ security: [
441
+ {
442
+ scheme: "bearer",
443
+ type: "http",
444
+ },
445
+ ],
446
+ url: "/strategy/{strategyId}/code",
447
+ ...options,
448
+ });
449
+ };
450
+
351
451
  /**
352
452
  * Prepare backtest data
353
453
  * Enqueues a prepare task over the requested date range. Returns immediately with a `jobId`;
@@ -67,6 +67,23 @@ export type InstrumentLinks = {
67
67
  futures?: HalLink;
68
68
  };
69
69
 
70
+ /**
71
+ * HAL `_links` for a strategy — present on a full `StrategyState` body (`GET
72
+ * /strategy/{strategyId}`, and `POST /strategy/{strategyId}/validate`'s already-validated
73
+ * `200`), absent from that same endpoint's `202` — a deliberately partial stub carrying only
74
+ * what is known before a check has even started. Following `code` can still `404` once
75
+ * present: it documents its own honest "nothing to return" for a strategy with no source of
76
+ * its own (a `REFERENCE` marketplace copy, or one resolved only through the platform's shared
77
+ * pool). This link says where to look, not that something is there.
78
+ *
79
+ */
80
+ export type StrategyLinks = {
81
+ /**
82
+ * Link to this strategy's registered source, `GET /strategy/{strategyId}/code`.
83
+ */
84
+ code: HalLink;
85
+ };
86
+
70
87
  /**
71
88
  * A HAL link object (Hypertext Application Language)
72
89
  */
@@ -800,6 +817,27 @@ export type Notice = {
800
817
  provenance?: "execute" | "compile-dry-run";
801
818
  };
802
819
 
820
+ /**
821
+ * One entry from `GET /strategies` — the same provenance a full `StrategyState` carries
822
+ * (`compiledAt`, `requiredSources`), without its validation state, so listing stays cheap
823
+ * regardless of how many strategies you have registered. Check a specific strategy's
824
+ * validation with `GET /strategy/{strategyId}`.
825
+ *
826
+ */
827
+ export type StrategySummary = {
828
+ strategyId: StrategyId;
829
+ /**
830
+ * When the live compilation was produced.
831
+ */
832
+ compiledAt?: string;
833
+ /**
834
+ * The market data this strategy needs. Absent, not empty, when it could
835
+ * not be established without constructing the strategy.
836
+ *
837
+ */
838
+ requiredSources?: Array<string>;
839
+ };
840
+
803
841
  /**
804
842
  * What is known about a registered strategy: that it compiled, and what validating it found.
805
843
  *
@@ -871,6 +909,7 @@ export type StrategyState = {
871
909
  *
872
910
  */
873
911
  validationStalled?: boolean;
912
+ _links?: StrategyLinks;
874
913
  };
875
914
 
876
915
  export type AuthTokenResponse = {
@@ -1155,6 +1194,26 @@ export type DownloadKlinesResponses = {
1155
1194
  export type DownloadKlinesResponse =
1156
1195
  DownloadKlinesResponses[keyof DownloadKlinesResponses];
1157
1196
 
1197
+ export type ListStrategiesData = {
1198
+ body?: never;
1199
+ path?: never;
1200
+ query?: never;
1201
+ url: "/strategies";
1202
+ };
1203
+
1204
+ export type ListStrategiesResponses = {
1205
+ /**
1206
+ * Your registered strategies. An empty array if you have none — this is never a `404`.
1207
+ *
1208
+ */
1209
+ 200: {
1210
+ strategies: Array<StrategySummary>;
1211
+ };
1212
+ };
1213
+
1214
+ export type ListStrategiesResponse =
1215
+ ListStrategiesResponses[keyof ListStrategiesResponses];
1216
+
1158
1217
  export type CompileStrategyData = {
1159
1218
  /**
1160
1219
  * Raw strategy Java source code
@@ -1237,6 +1296,41 @@ export type ValidateStrategyResponses = {
1237
1296
  export type ValidateStrategyResponse =
1238
1297
  ValidateStrategyResponses[keyof ValidateStrategyResponses];
1239
1298
 
1299
+ export type DeleteStrategyData = {
1300
+ body?: never;
1301
+ path: {
1302
+ /**
1303
+ * The id returned by `POST /strategy`
1304
+ */
1305
+ strategyId: StrategyId;
1306
+ };
1307
+ query?: never;
1308
+ url: "/strategy/{strategyId}";
1309
+ };
1310
+
1311
+ export type DeleteStrategyErrors = {
1312
+ /**
1313
+ * No such registered strategy for this user
1314
+ */
1315
+ 404: ResponseError;
1316
+ };
1317
+
1318
+ export type DeleteStrategyError =
1319
+ DeleteStrategyErrors[keyof DeleteStrategyErrors];
1320
+
1321
+ export type DeleteStrategyResponses = {
1322
+ /**
1323
+ * Deleted
1324
+ */
1325
+ 200: {
1326
+ strategyId: StrategyId;
1327
+ deleted: true;
1328
+ };
1329
+ };
1330
+
1331
+ export type DeleteStrategyResponse =
1332
+ DeleteStrategyResponses[keyof DeleteStrategyResponses];
1333
+
1240
1334
  export type GetStrategyData = {
1241
1335
  body?: never;
1242
1336
  path: {
@@ -1268,6 +1362,44 @@ export type GetStrategyResponses = {
1268
1362
  export type GetStrategyResponse =
1269
1363
  GetStrategyResponses[keyof GetStrategyResponses];
1270
1364
 
1365
+ export type GetStrategyCodeData = {
1366
+ body?: never;
1367
+ path: {
1368
+ /**
1369
+ * The id returned by `POST /strategy`
1370
+ */
1371
+ strategyId: StrategyId;
1372
+ };
1373
+ query?: never;
1374
+ url: "/strategy/{strategyId}/code";
1375
+ };
1376
+
1377
+ export type GetStrategyCodeErrors = {
1378
+ /**
1379
+ * No such registered strategy for this user, or nothing to read for this id
1380
+ */
1381
+ 404: ResponseError;
1382
+ };
1383
+
1384
+ export type GetStrategyCodeError =
1385
+ GetStrategyCodeErrors[keyof GetStrategyCodeErrors];
1386
+
1387
+ export type GetStrategyCodeResponses = {
1388
+ /**
1389
+ * The registered source
1390
+ */
1391
+ 200: {
1392
+ strategyId: StrategyId;
1393
+ /**
1394
+ * Raw strategy Java source code, exactly as registered.
1395
+ */
1396
+ code: string;
1397
+ };
1398
+ };
1399
+
1400
+ export type GetStrategyCodeResponse =
1401
+ GetStrategyCodeResponses[keyof GetStrategyCodeResponses];
1402
+
1271
1403
  export type PrepareBacktestData = {
1272
1404
  /**
1273
1405
  * The required data to prepare a backtesting
@@ -1674,7 +1806,7 @@ export type GetBacktestResultResponse =
1674
1806
 
1675
1807
  export type ClientOptions = {
1676
1808
  baseUrl:
1677
- | "https://api.staging.qtsurfer.com/v1"
1809
+ | "https://api.qtsurfer.net/v1"
1678
1810
  | "https://api.qtsurfer.com/v1"
1679
1811
  | (string & {});
1680
1812
  };