@qtsurfer/api-client 0.1.1 → 0.1.2

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 CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2026 QTSurfer
189
+ Copyright 2026 Wualabs LTD
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -49,6 +49,8 @@ All operations are exported as standalone functions; every operation accepts an
49
49
  | -------- | ------ | ---- | ------- |
50
50
  | `getExchanges` | GET | `/exchanges` | List available exchanges |
51
51
  | `getInstruments` | GET | `/exchange/{exchangeId}/instruments` | List instruments for an exchange |
52
+ | `getExchangeTickersHour` | GET | `/exchange/{exchangeId}/tickers/{base}/{quote}` | Download one hour of tickers as Lastra/Parquet |
53
+ | `getExchangeKlinesHour` | GET | `/exchange/{exchangeId}/klines/{base}/{quote}` | Download one hour of klines as Lastra/Parquet |
52
54
  | `postStrategy` | POST | `/strategy` | Compile a strategy |
53
55
  | `getStrategyStatus` | GET | `/strategy/{strategyId}` | Poll strategy compilation status |
54
56
  | `prepareBacktesting` | POST | `/backtesting/prepare` | Start a data preparation job |
package/dist/index.d.ts CHANGED
@@ -69,7 +69,7 @@ type Exchange = {
69
69
  description?: string;
70
70
  };
71
71
  /**
72
- * Managed exchange data sources available for backtesting. Currently only ticker is supported; kline and funding rate support is planned.
72
+ * Managed exchange data sources available for backtesting.
73
73
  */
74
74
  type DataSourceType = 'ticker';
75
75
  /**
@@ -77,13 +77,17 @@ type DataSourceType = 'ticker';
77
77
  */
78
78
  type JobState = {
79
79
  /**
80
- * Unique context ID for the job
80
+ * Opaque context identifier for the job
81
81
  */
82
82
  contextId: string;
83
83
  /**
84
- * Current status of the job
84
+ * Current status of the job. `Partial` (prepare only) means some
85
+ * hours are still being produced asynchronously — keep polling.
86
+ * Treat `Completed | Aborted | Failed` as terminal; anything else
87
+ * means keep polling.
88
+ *
85
89
  */
86
- status: 'New' | 'Started' | 'Completed' | 'Aborted' | 'Failed';
90
+ status: 'New' | 'Started' | 'Partial' | 'Completed' | 'Aborted' | 'Failed';
87
91
  /**
88
92
  * Detailed status information, if available
89
93
  */
@@ -128,7 +132,7 @@ type BacktestJobResult = {
128
132
  */
129
133
  type ResultMap = {
130
134
  /**
131
- * Hostname of the worker node that executed the strategy
135
+ * Identifier of the worker that executed the strategy. Useful when reporting issues so support can correlate with logs.
132
136
  */
133
137
  hostName?: string;
134
138
  /**
@@ -136,7 +140,7 @@ type ResultMap = {
136
140
  */
137
141
  iops?: number;
138
142
  /**
139
- * Redis key of the compiled strategy used for execution. Format: strategy:{userId}:ticker:{compilationId}
143
+ * Identifier of the compiled strategy that produced this result
140
144
  */
141
145
  strategyId: string;
142
146
  /**
@@ -180,15 +184,15 @@ type ResultMap = {
180
184
  */
181
185
  signalCount?: number;
182
186
  /**
183
- * Storage key for the signal Parquet file. Format: {userId}/exec/{exchange}/{jobId}
187
+ * Storage key for the signals file. Treat as opaque; use signalsUrl to download.
184
188
  */
185
189
  signalsId?: string;
186
190
  /**
187
- * Public HTTPS URL to the Parquet file. Computed at setup time from publicBaseUrl + signalsId + .parquet. Available even before upload completes.
191
+ * HTTPS URL to download the signals Parquet file. Use signalsUpload to know when it's ready.
188
192
  */
189
193
  signalsUrl?: string;
190
194
  /**
191
- * Upload status. Done = file uploaded to R2. Failed = upload error (see signalsUploadReason). Skipped = no signals emitted or storage not configured.
195
+ * Upload status. Done = signal file is available at signalsUrl. Failed = upload error (see signalsUploadReason). Skipped = no signals emitted.
192
196
  */
193
197
  signalsUpload?: 'Done' | 'Failed' | 'Skipped';
194
198
  /**
@@ -242,6 +246,122 @@ type GetInstrumentsResponses = {
242
246
  200: Array<InstrumentDetail>;
243
247
  };
244
248
  type GetInstrumentsResponse = GetInstrumentsResponses[keyof GetInstrumentsResponses];
249
+ type GetExchangeTickersHourData = {
250
+ body?: never;
251
+ path: {
252
+ /**
253
+ * ID of the exchange (e.g. `binance`).
254
+ */
255
+ exchangeId: string;
256
+ /**
257
+ * Base asset symbol (first leg of the pair).
258
+ */
259
+ base: string;
260
+ /**
261
+ * Quote asset symbol (second leg of the pair).
262
+ */
263
+ quote: string;
264
+ };
265
+ query: {
266
+ /**
267
+ * Hour selector in `YYYY-MM-DDTHH` (UTC). The returned segment covers
268
+ * `[HH:00:00Z, HH+1:00:00Z)`.
269
+ *
270
+ */
271
+ hour: string;
272
+ /**
273
+ * Response wire format. `lastra` (default) returns raw Lastra bytes.
274
+ * `parquet` returns Parquet via on-the-fly conversion using
275
+ * [lastra-convert](https://github.com/QTSurfer/lastra-convert).
276
+ *
277
+ */
278
+ format?: 'lastra' | 'parquet';
279
+ };
280
+ url: '/exchange/{exchangeId}/tickers/{base}/{quote}';
281
+ };
282
+ type GetExchangeTickersHourErrors = {
283
+ /**
284
+ * Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
285
+ */
286
+ 400: ResponseError;
287
+ /**
288
+ * No Lastra segment exists for the requested instrument/hour.
289
+ */
290
+ 404: ResponseError;
291
+ /**
292
+ * Unexpected I/O error serving the file.
293
+ */
294
+ 500: ResponseError;
295
+ };
296
+ type GetExchangeTickersHourError = GetExchangeTickersHourErrors[keyof GetExchangeTickersHourErrors];
297
+ type GetExchangeTickersHourResponses = {
298
+ /**
299
+ * One hour of tickers for the instrument. `Content-Type` is
300
+ * `application/vnd.lastra` by default or
301
+ * `application/vnd.apache.parquet` when `format=parquet` was
302
+ * requested.
303
+ *
304
+ */
305
+ 200: Blob | File;
306
+ };
307
+ type GetExchangeTickersHourResponse = GetExchangeTickersHourResponses[keyof GetExchangeTickersHourResponses];
308
+ type GetExchangeKlinesHourData = {
309
+ body?: never;
310
+ path: {
311
+ /**
312
+ * ID of the exchange (e.g. `binance`).
313
+ */
314
+ exchangeId: string;
315
+ /**
316
+ * Base asset symbol.
317
+ */
318
+ base: string;
319
+ /**
320
+ * Quote asset symbol.
321
+ */
322
+ quote: string;
323
+ };
324
+ query: {
325
+ /**
326
+ * Hour selector in `YYYY-MM-DDTHH` (UTC). The returned segment covers
327
+ * `[HH:00:00Z, HH+1:00:00Z)`.
328
+ *
329
+ */
330
+ hour: string;
331
+ /**
332
+ * Response wire format. `lastra` (default) returns raw Lastra bytes.
333
+ * `parquet` returns Parquet via on-the-fly conversion.
334
+ *
335
+ */
336
+ format?: 'lastra' | 'parquet';
337
+ };
338
+ url: '/exchange/{exchangeId}/klines/{base}/{quote}';
339
+ };
340
+ type GetExchangeKlinesHourErrors = {
341
+ /**
342
+ * Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
343
+ */
344
+ 400: ResponseError;
345
+ /**
346
+ * No Lastra segment exists for the requested instrument/hour.
347
+ */
348
+ 404: ResponseError;
349
+ /**
350
+ * Unexpected I/O error serving the file.
351
+ */
352
+ 500: ResponseError;
353
+ };
354
+ type GetExchangeKlinesHourError = GetExchangeKlinesHourErrors[keyof GetExchangeKlinesHourErrors];
355
+ type GetExchangeKlinesHourResponses = {
356
+ /**
357
+ * One hour of klines for the instrument. `Content-Type` is
358
+ * `application/vnd.lastra` by default or
359
+ * `application/vnd.apache.parquet` when `format=parquet`.
360
+ *
361
+ */
362
+ 200: Blob | File;
363
+ };
364
+ type GetExchangeKlinesHourResponse = GetExchangeKlinesHourResponses[keyof GetExchangeKlinesHourResponses];
245
365
  type PostStrategyData = {
246
366
  /**
247
367
  * Raw strategy Java source code
@@ -335,6 +455,15 @@ type PrepareBacktestingData = {
335
455
  *
336
456
  */
337
457
  to: string;
458
+ /**
459
+ * Output bar cadence for the prepared range. Defaults to the publisher's
460
+ * native cadence (`1s`); coarser cadences are produced on demand via
461
+ * resampling and stored alongside the native blob in cache. Coarser-than-
462
+ * source values must be exact multiples of the source cadence — invalid
463
+ * labels return `400`.
464
+ *
465
+ */
466
+ cadence?: '1s' | '5s' | '1m' | '5m' | '15m' | '1h' | '4h' | '1d';
338
467
  };
339
468
  path: {
340
469
  /**
@@ -556,6 +685,52 @@ declare const getExchanges: <ThrowOnError extends boolean = false>(options?: Opt
556
685
  * Get a list of Instruments from a specific exchange
557
686
  */
558
687
  declare const getInstruments: <ThrowOnError extends boolean = false>(options: Options<GetInstrumentsData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<InstrumentDetail[], ResponseError, ThrowOnError>;
688
+ /**
689
+ * Download one hour of tickers for an instrument as a Lastra segment
690
+ * Serves exactly one hour of raw ticker data for the given instrument on the
691
+ * requested exchange. The payload is a native [Lastra](https://github.com/QTSurfer/lastra-java)
692
+ * file — QTSurfer's columnar format for tick-precision timeseries — with
693
+ * no JSON envelope.
694
+ *
695
+ * One segment = one hour, aligned to UTC. The `hour` query parameter selects
696
+ * the segment and must match `YYYY-MM-DDTHH` (no minutes/seconds, no timezone
697
+ * suffix). Example: `hour=2026-01-15T10` returns `h10.lastra` for
698
+ * 2026-01-15, covering `[10:00:00Z, 11:00:00Z)`. Hours not yet available
699
+ * return `404`.
700
+ *
701
+ * A `format=parquet` query parameter switches the response to on-the-fly
702
+ * Parquet conversion via [lastra-convert](https://github.com/QTSurfer/lastra-convert)
703
+ * for clients that don't yet read Lastra. Lastra is the primary format
704
+ * and cheaper when the client can consume it.
705
+ *
706
+ * Clients:
707
+ * - [lastra-java](https://github.com/QTSurfer/lastra-java) — reference
708
+ * Java reader/writer with per-column codecs (ALP, Gorilla, delta-varint,
709
+ * ZSTD) and CRC32 integrity.
710
+ * - [lastra-ts](https://github.com/QTSurfer/lastra-ts) — TypeScript reader
711
+ * (~4 kB bundle, browser + Node.js).
712
+ * - [duckdb-lastra](https://github.com/QTSurfer/duckdb-lastra) — DuckDB
713
+ * extension for ad-hoc SQL over Lastra files.
714
+ * - [lastra-convert](https://github.com/QTSurfer/lastra-convert) — CLI + Java
715
+ * API for converting to/from Parquet, Reef, and CSV.
716
+ * - `curl -OJ` for offline dumps (the `Content-Disposition` header sets a
717
+ * descriptive filename).
718
+ *
719
+ */
720
+ declare const getExchangeTickersHour: <ThrowOnError extends boolean = false>(options: Options<GetExchangeTickersHourData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Blob | File, ResponseError, ThrowOnError>;
721
+ /**
722
+ * Download one hour of klines for an instrument as a Lastra segment
723
+ * Same shape and semantics as `/exchange/{exchangeId}/tickers/{base}/{quote}`,
724
+ * but serves klines (aggregated bars) instead of raw ticks. One
725
+ * [Lastra](https://github.com/QTSurfer/lastra-java) segment = one hour of
726
+ * klines at the exchange's native kline cadence, aligned to UTC.
727
+ *
728
+ * Klines use the same columnar layout as tickers — readers that handle one
729
+ * format read the other with the same code. Use this endpoint when a
730
+ * per-tick payload would be too large for the window of interest.
731
+ *
732
+ */
733
+ declare const getExchangeKlinesHour: <ThrowOnError extends boolean = false>(options: Options<GetExchangeKlinesHourData, ThrowOnError>) => _hey_api_client_fetch.RequestResult<Blob | File, ResponseError, ThrowOnError>;
559
734
  /**
560
735
  * Compile a strategy from source code
561
736
  * Submits raw strategy source for compilation. By default the call is synchronous and returns
@@ -633,4 +808,4 @@ declare const getExecutionResult: <ThrowOnError extends boolean = false>(options
633
808
 
634
809
  declare const client: _hey_api_client_fetch.Client;
635
810
 
636
- export { type AcceptedJob, type BacktestJobResult, type CancelExecutionData, type CancelExecutionError, type CancelExecutionErrors, type CancelExecutionResponse, type CancelExecutionResponses, type ClientOptions, type DataSourceType, type Exchange, type ExecuteBacktestingData, type ExecuteBacktestingError, type ExecuteBacktestingErrors, type ExecuteBacktestingResponse, type ExecuteBacktestingResponses, type GetExchangesData, type GetExchangesResponse, type GetExchangesResponses, type GetExecutionResultData, type GetExecutionResultError, type GetExecutionResultErrors, type GetExecutionResultResponse, type GetExecutionResultResponses, type GetInstrumentsData, type GetInstrumentsError, type GetInstrumentsErrors, type GetInstrumentsResponse, type GetInstrumentsResponses, type GetPreparationStatusData, type GetPreparationStatusError, type GetPreparationStatusErrors, type GetPreparationStatusResponse, type GetPreparationStatusResponses, type GetStrategyStatusData, type GetStrategyStatusError, type GetStrategyStatusErrors, type GetStrategyStatusResponse, type GetStrategyStatusResponses, type Instrument, type InstrumentDetail, type JobState, type Options, type PostStrategyData, type PostStrategyError, type PostStrategyErrors, type PostStrategyResponse, type PostStrategyResponses, type PrepareBacktestingData, type PrepareBacktestingError, type PrepareBacktestingErrors, type PrepareBacktestingResponse, type PrepareBacktestingResponses, type ResponseError, type ResultMap, type StrategyId, cancelExecution, client, executeBacktesting, getExchanges, getExecutionResult, getInstruments, getPreparationStatus, getStrategyStatus, postStrategy, prepareBacktesting };
811
+ export { type AcceptedJob, type BacktestJobResult, type CancelExecutionData, type CancelExecutionError, type CancelExecutionErrors, type CancelExecutionResponse, type CancelExecutionResponses, type ClientOptions, type DataSourceType, type Exchange, type ExecuteBacktestingData, type ExecuteBacktestingError, type ExecuteBacktestingErrors, type ExecuteBacktestingResponse, type ExecuteBacktestingResponses, type GetExchangeKlinesHourData, type GetExchangeKlinesHourError, type GetExchangeKlinesHourErrors, type GetExchangeKlinesHourResponse, type GetExchangeKlinesHourResponses, type GetExchangeTickersHourData, type GetExchangeTickersHourError, type GetExchangeTickersHourErrors, type GetExchangeTickersHourResponse, type GetExchangeTickersHourResponses, type GetExchangesData, type GetExchangesResponse, type GetExchangesResponses, type GetExecutionResultData, type GetExecutionResultError, type GetExecutionResultErrors, type GetExecutionResultResponse, type GetExecutionResultResponses, type GetInstrumentsData, type GetInstrumentsError, type GetInstrumentsErrors, type GetInstrumentsResponse, type GetInstrumentsResponses, type GetPreparationStatusData, type GetPreparationStatusError, type GetPreparationStatusErrors, type GetPreparationStatusResponse, type GetPreparationStatusResponses, type GetStrategyStatusData, type GetStrategyStatusError, type GetStrategyStatusErrors, type GetStrategyStatusResponse, type GetStrategyStatusResponses, type Instrument, type InstrumentDetail, type JobState, type Options, type PostStrategyData, type PostStrategyError, type PostStrategyErrors, type PostStrategyResponse, type PostStrategyResponses, type PrepareBacktestingData, type PrepareBacktestingError, type PrepareBacktestingErrors, type PrepareBacktestingResponse, type PrepareBacktestingResponses, type ResponseError, type ResultMap, type StrategyId, cancelExecution, client, executeBacktesting, getExchangeKlinesHour, getExchangeTickersHour, getExchanges, getExecutionResult, getInstruments, getPreparationStatus, getStrategyStatus, postStrategy, prepareBacktesting };
package/dist/index.js CHANGED
@@ -17,6 +17,18 @@ var getInstruments = (options) => {
17
17
  ...options
18
18
  });
19
19
  };
20
+ var getExchangeTickersHour = (options) => {
21
+ return (options.client ?? client).get({
22
+ url: "/exchange/{exchangeId}/tickers/{base}/{quote}",
23
+ ...options
24
+ });
25
+ };
26
+ var getExchangeKlinesHour = (options) => {
27
+ return (options.client ?? client).get({
28
+ url: "/exchange/{exchangeId}/klines/{base}/{quote}",
29
+ ...options
30
+ });
31
+ };
20
32
  var postStrategy = (options) => {
21
33
  return (options.client ?? client).post({
22
34
  bodySerializer: null,
@@ -118,6 +130,8 @@ export {
118
130
  cancelExecution,
119
131
  client,
120
132
  executeBacktesting,
133
+ getExchangeKlinesHour,
134
+ getExchangeTickersHour,
121
135
  getExchanges,
122
136
  getExecutionResult,
123
137
  getInstruments,
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 { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } 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> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>;\n\nexport const client = createClient(createConfig<ClientOptions>({\n baseUrl: 'https://api.staging.qtsurfer.com/v1'\n}));","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';\nimport type { GetExchangesData, GetExchangesResponse, GetInstrumentsData, GetInstrumentsResponse, GetInstrumentsError, PostStrategyData, PostStrategyResponse, PostStrategyError, GetStrategyStatusData, GetStrategyStatusResponse, GetStrategyStatusError, PrepareBacktestingData, PrepareBacktestingResponse, PrepareBacktestingError, GetPreparationStatusData, GetPreparationStatusResponse, GetPreparationStatusError, ExecuteBacktestingData, ExecuteBacktestingResponse, ExecuteBacktestingError, CancelExecutionData, CancelExecutionResponse, CancelExecutionError, GetExecutionResultData, GetExecutionResultResponse, GetExecutionResultError } from './types.gen';\nimport { client as _heyApiClient } from './client.gen';\n\nexport type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = 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 * Get a list of available exchanges\n */\nexport const getExchanges = <ThrowOnError extends boolean = false>(options?: Options<GetExchangesData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<GetExchangesResponse, unknown, ThrowOnError>({\n url: '/exchanges',\n ...options\n });\n};\n\n/**\n * Get a list of Instruments from a specific exchange\n */\nexport const getInstruments = <ThrowOnError extends boolean = false>(options: Options<GetInstrumentsData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<GetInstrumentsResponse, GetInstrumentsError, ThrowOnError>({\n url: '/exchange/{exchangeId}/instruments',\n ...options\n });\n};\n\n/**\n * Compile a strategy from source code\n * Submits raw strategy source for compilation. By default the call is synchronous and returns\n * the `strategyId` once compilation succeeds. Set the header `X-Compile-Async: true` to enqueue\n * the compile task and return immediately with a `jobId` — poll\n * `GET /strategy/{strategyId}` to check status.\n *\n * The `strategyId` is deterministic: the same source for the same user always produces the\n * same id.\n *\n */\nexport const postStrategy = <ThrowOnError extends boolean = false>(options: Options<PostStrategyData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<PostStrategyResponse, PostStrategyError, ThrowOnError>({\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 * Get the status of an async compile task\n * Polls the status of a strategy compilation. Useful when the strategy was submitted with\n * `X-Compile-Async: true`. Returns the resolved `strategyId` once compilation completes.\n *\n */\nexport const getStrategyStatus = <ThrowOnError extends boolean = false>(options: Options<GetStrategyStatusData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<GetStrategyStatusResponse, GetStrategyStatusError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/strategy/{strategyId}',\n ...options\n });\n};\n\n/**\n * Prepare backtesting 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 prepareBacktesting = <ThrowOnError extends boolean = false>(options: Options<PrepareBacktestingData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<PrepareBacktestingResponse, PrepareBacktestingError, ThrowOnError>({\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 getPreparationStatus = <ThrowOnError extends boolean = false>(options: Options<GetPreparationStatusData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<GetPreparationStatusResponse, GetPreparationStatusError, ThrowOnError>({\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 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 executeBacktesting = <ThrowOnError extends boolean = false>(options: Options<ExecuteBacktestingData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<ExecuteBacktestingResponse, ExecuteBacktestingError, ThrowOnError>({\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 cancelExecution = <ThrowOnError extends boolean = false>(options: Options<CancelExecutionData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).delete<CancelExecutionResponse, CancelExecutionError, ThrowOnError>({\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 */\nexport const getExecutionResult = <ThrowOnError extends boolean = false>(options: Options<GetExecutionResultData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<GetExecutionResultResponse, GetExecutionResultError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/backtest/{exchangeId}/{type}/execute/{jobId}',\n ...options\n });\n};"],"mappings":";AAGA,SAAkE,cAAc,oBAAoB;AAY7F,IAAM,SAAS,aAAa,aAA4B;AAAA,EAC3D,SAAS;AACb,CAAC,CAAC;;;ACMK,IAAM,eAAe,CAAuC,YAAsD;AACrH,UAAQ,SAAS,UAAU,QAAe,IAAiD;AAAA,IACvF,KAAK;AAAA,IACL,GAAG;AAAA,EACP,CAAC;AACL;AAKO,IAAM,iBAAiB,CAAuC,YAAuD;AACxH,UAAQ,QAAQ,UAAU,QAAe,IAA+D;AAAA,IACpG,KAAK;AAAA,IACL,GAAG;AAAA,EACP,CAAC;AACL;AAaO,IAAM,eAAe,CAAuC,YAAqD;AACpH,UAAQ,QAAQ,UAAU,QAAe,KAA4D;AAAA,IACjG,gBAAgB;AAAA,IAChB,UAAU;AAAA,MACN;AAAA,QACI,QAAQ;AAAA,QACR,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,IACH,SAAS;AAAA,MACL,gBAAgB;AAAA,MAChB,GAAG,SAAS;AAAA,IAChB;AAAA,EACJ,CAAC;AACL;AAQO,IAAM,oBAAoB,CAAuC,YAA0D;AAC9H,UAAQ,QAAQ,UAAU,QAAe,IAAqE;AAAA,IAC1G,UAAU;AAAA,MACN;AAAA,QACI,QAAQ;AAAA,QACR,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,EACP,CAAC;AACL;AAWO,IAAM,qBAAqB,CAAuC,YAA2D;AAChI,UAAQ,QAAQ,UAAU,QAAe,KAAwE;AAAA,IAC7G,UAAU;AAAA,MACN;AAAA,QACI,QAAQ;AAAA,QACR,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,IACH,SAAS;AAAA,MACL,gBAAgB;AAAA,MAChB,GAAG,SAAS;AAAA,IAChB;AAAA,EACJ,CAAC;AACL;AAQO,IAAM,uBAAuB,CAAuC,YAA6D;AACpI,UAAQ,QAAQ,UAAU,QAAe,IAA2E;AAAA,IAChH,UAAU;AAAA,MACN;AAAA,QACI,QAAQ;AAAA,QACR,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,EACP,CAAC;AACL;AAeO,IAAM,qBAAqB,CAAuC,YAA2D;AAChI,UAAQ,QAAQ,UAAU,QAAe,KAAwE;AAAA,IAC7G,UAAU;AAAA,MACN;AAAA,QACI,QAAQ;AAAA,QACR,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,IACH,SAAS;AAAA,MACL,gBAAgB;AAAA,MAChB,GAAG,SAAS;AAAA,IAChB;AAAA,EACJ,CAAC;AACL;AAUO,IAAM,kBAAkB,CAAuC,YAAwD;AAC1H,UAAQ,QAAQ,UAAU,QAAe,OAAoE;AAAA,IACzG,UAAU;AAAA,MACN;AAAA,QACI,QAAQ;AAAA,QACR,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,EACP,CAAC;AACL;AAQO,IAAM,qBAAqB,CAAuC,YAA2D;AAChI,UAAQ,QAAQ,UAAU,QAAe,IAAuE;AAAA,IAC5G,UAAU;AAAA,MACN;AAAA,QACI,QAAQ;AAAA,QACR,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,EACP,CAAC;AACL;","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 { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } 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> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>;\n\nexport const client = createClient(createConfig<ClientOptions>({\n baseUrl: 'https://api.staging.qtsurfer.com/v1'\n}));","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';\nimport type { GetExchangesData, GetExchangesResponse, GetInstrumentsData, GetInstrumentsResponse, GetInstrumentsError, GetExchangeTickersHourData, GetExchangeTickersHourResponse, GetExchangeTickersHourError, GetExchangeKlinesHourData, GetExchangeKlinesHourResponse, GetExchangeKlinesHourError, PostStrategyData, PostStrategyResponse, PostStrategyError, GetStrategyStatusData, GetStrategyStatusResponse, GetStrategyStatusError, PrepareBacktestingData, PrepareBacktestingResponse, PrepareBacktestingError, GetPreparationStatusData, GetPreparationStatusResponse, GetPreparationStatusError, ExecuteBacktestingData, ExecuteBacktestingResponse, ExecuteBacktestingError, CancelExecutionData, CancelExecutionResponse, CancelExecutionError, GetExecutionResultData, GetExecutionResultResponse, GetExecutionResultError } from './types.gen';\nimport { client as _heyApiClient } from './client.gen';\n\nexport type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = 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 * Get a list of available exchanges\n */\nexport const getExchanges = <ThrowOnError extends boolean = false>(options?: Options<GetExchangesData, ThrowOnError>) => {\n return (options?.client ?? _heyApiClient).get<GetExchangesResponse, unknown, ThrowOnError>({\n url: '/exchanges',\n ...options\n });\n};\n\n/**\n * Get a list of Instruments from a specific exchange\n */\nexport const getInstruments = <ThrowOnError extends boolean = false>(options: Options<GetInstrumentsData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<GetInstrumentsResponse, GetInstrumentsError, ThrowOnError>({\n url: '/exchange/{exchangeId}/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 getExchangeTickersHour = <ThrowOnError extends boolean = false>(options: Options<GetExchangeTickersHourData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<GetExchangeTickersHourResponse, GetExchangeTickersHourError, ThrowOnError>({\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 getExchangeKlinesHour = <ThrowOnError extends boolean = false>(options: Options<GetExchangeKlinesHourData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<GetExchangeKlinesHourResponse, GetExchangeKlinesHourError, ThrowOnError>({\n url: '/exchange/{exchangeId}/klines/{base}/{quote}',\n ...options\n });\n};\n\n/**\n * Compile a strategy from source code\n * Submits raw strategy source for compilation. By default the call is synchronous and returns\n * the `strategyId` once compilation succeeds. Set the header `X-Compile-Async: true` to enqueue\n * the compile task and return immediately with a `jobId` — poll\n * `GET /strategy/{strategyId}` to check status.\n *\n * The `strategyId` is deterministic: the same source for the same user always produces the\n * same id.\n *\n */\nexport const postStrategy = <ThrowOnError extends boolean = false>(options: Options<PostStrategyData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<PostStrategyResponse, PostStrategyError, ThrowOnError>({\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 * Get the status of an async compile task\n * Polls the status of a strategy compilation. Useful when the strategy was submitted with\n * `X-Compile-Async: true`. Returns the resolved `strategyId` once compilation completes.\n *\n */\nexport const getStrategyStatus = <ThrowOnError extends boolean = false>(options: Options<GetStrategyStatusData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<GetStrategyStatusResponse, GetStrategyStatusError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/strategy/{strategyId}',\n ...options\n });\n};\n\n/**\n * Prepare backtesting 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 prepareBacktesting = <ThrowOnError extends boolean = false>(options: Options<PrepareBacktestingData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<PrepareBacktestingResponse, PrepareBacktestingError, ThrowOnError>({\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 getPreparationStatus = <ThrowOnError extends boolean = false>(options: Options<GetPreparationStatusData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<GetPreparationStatusResponse, GetPreparationStatusError, ThrowOnError>({\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 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 executeBacktesting = <ThrowOnError extends boolean = false>(options: Options<ExecuteBacktestingData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).post<ExecuteBacktestingResponse, ExecuteBacktestingError, ThrowOnError>({\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 cancelExecution = <ThrowOnError extends boolean = false>(options: Options<CancelExecutionData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).delete<CancelExecutionResponse, CancelExecutionError, ThrowOnError>({\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 */\nexport const getExecutionResult = <ThrowOnError extends boolean = false>(options: Options<GetExecutionResultData, ThrowOnError>) => {\n return (options.client ?? _heyApiClient).get<GetExecutionResultResponse, GetExecutionResultError, ThrowOnError>({\n security: [\n {\n scheme: 'bearer',\n type: 'http'\n }\n ],\n url: '/backtest/{exchangeId}/{type}/execute/{jobId}',\n ...options\n });\n};"],"mappings":";AAGA,SAAkE,cAAc,oBAAoB;AAY7F,IAAM,SAAS,aAAa,aAA4B;AAAA,EAC3D,SAAS;AACb,CAAC,CAAC;;;ACMK,IAAM,eAAe,CAAuC,YAAsD;AACrH,UAAQ,SAAS,UAAU,QAAe,IAAiD;AAAA,IACvF,KAAK;AAAA,IACL,GAAG;AAAA,EACP,CAAC;AACL;AAKO,IAAM,iBAAiB,CAAuC,YAAuD;AACxH,UAAQ,QAAQ,UAAU,QAAe,IAA+D;AAAA,IACpG,KAAK;AAAA,IACL,GAAG;AAAA,EACP,CAAC;AACL;AAkCO,IAAM,yBAAyB,CAAuC,YAA+D;AACxI,UAAQ,QAAQ,UAAU,QAAe,IAA+E;AAAA,IACpH,KAAK;AAAA,IACL,GAAG;AAAA,EACP,CAAC;AACL;AAcO,IAAM,wBAAwB,CAAuC,YAA8D;AACtI,UAAQ,QAAQ,UAAU,QAAe,IAA6E;AAAA,IAClH,KAAK;AAAA,IACL,GAAG;AAAA,EACP,CAAC;AACL;AAaO,IAAM,eAAe,CAAuC,YAAqD;AACpH,UAAQ,QAAQ,UAAU,QAAe,KAA4D;AAAA,IACjG,gBAAgB;AAAA,IAChB,UAAU;AAAA,MACN;AAAA,QACI,QAAQ;AAAA,QACR,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,IACH,SAAS;AAAA,MACL,gBAAgB;AAAA,MAChB,GAAG,SAAS;AAAA,IAChB;AAAA,EACJ,CAAC;AACL;AAQO,IAAM,oBAAoB,CAAuC,YAA0D;AAC9H,UAAQ,QAAQ,UAAU,QAAe,IAAqE;AAAA,IAC1G,UAAU;AAAA,MACN;AAAA,QACI,QAAQ;AAAA,QACR,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,EACP,CAAC;AACL;AAWO,IAAM,qBAAqB,CAAuC,YAA2D;AAChI,UAAQ,QAAQ,UAAU,QAAe,KAAwE;AAAA,IAC7G,UAAU;AAAA,MACN;AAAA,QACI,QAAQ;AAAA,QACR,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,IACH,SAAS;AAAA,MACL,gBAAgB;AAAA,MAChB,GAAG,SAAS;AAAA,IAChB;AAAA,EACJ,CAAC;AACL;AAQO,IAAM,uBAAuB,CAAuC,YAA6D;AACpI,UAAQ,QAAQ,UAAU,QAAe,IAA2E;AAAA,IAChH,UAAU;AAAA,MACN;AAAA,QACI,QAAQ;AAAA,QACR,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,EACP,CAAC;AACL;AAeO,IAAM,qBAAqB,CAAuC,YAA2D;AAChI,UAAQ,QAAQ,UAAU,QAAe,KAAwE;AAAA,IAC7G,UAAU;AAAA,MACN;AAAA,QACI,QAAQ;AAAA,QACR,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,IACH,SAAS;AAAA,MACL,gBAAgB;AAAA,MAChB,GAAG,SAAS;AAAA,IAChB;AAAA,EACJ,CAAC;AACL;AAUO,IAAM,kBAAkB,CAAuC,YAAwD;AAC1H,UAAQ,QAAQ,UAAU,QAAe,OAAoE;AAAA,IACzG,UAAU;AAAA,MACN;AAAA,QACI,QAAQ;AAAA,QACR,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,EACP,CAAC;AACL;AAQO,IAAM,qBAAqB,CAAuC,YAA2D;AAChI,UAAQ,QAAQ,UAAU,QAAe,IAAuE;AAAA,IAC5G,UAAU;AAAA,MACN;AAAA,QACI,QAAQ;AAAA,QACR,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,EACP,CAAC;AACL;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qtsurfer/api-client",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
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",
@@ -96,7 +96,7 @@ export const ExchangeSchema = {
96
96
 
97
97
  export const DataSourceTypeSchema = {
98
98
  type: 'string',
99
- description: 'Managed exchange data sources available for backtesting. Currently only ticker is supported; kline and funding rate support is planned.',
99
+ description: 'Managed exchange data sources available for backtesting.',
100
100
  enum: ['ticker'],
101
101
  example: 'ticker'
102
102
  } as const;
@@ -108,13 +108,17 @@ export const JobStateSchema = {
108
108
  properties: {
109
109
  contextId: {
110
110
  type: 'string',
111
- description: 'Unique context ID for the job',
112
- example: 'jctx:ticker:4a627755-7f5a-4297-b647-8dddd8aee416:binance:1rabbrpk5r4kkegs83w6qr:btc/usdt:2o8heaioicr0edvx5ybcap'
111
+ description: 'Opaque context identifier for the job',
112
+ example: 'ctx_2o8heaioicr0edvx5ybcap'
113
113
  },
114
114
  status: {
115
115
  type: 'string',
116
- description: 'Current status of the job',
117
- enum: ['New', 'Started', 'Completed', 'Aborted', 'Failed'],
116
+ description: `Current status of the job. \`Partial\` (prepare only) means some
117
+ hours are still being produced asynchronously — keep polling.
118
+ Treat \`Completed | Aborted | Failed\` as terminal; anything else
119
+ means keep polling.
120
+ `,
121
+ enum: ['New', 'Started', 'Partial', 'Completed', 'Aborted', 'Failed'],
118
122
  example: 'Completed'
119
123
  },
120
124
  statusDetail: {
@@ -186,8 +190,8 @@ export const ResultMapSchema = {
186
190
  properties: {
187
191
  hostName: {
188
192
  type: 'string',
189
- description: 'Hostname of the worker node that executed the strategy',
190
- example: 'backtesting-job-worker-84b569dff9-dr4lb'
193
+ description: 'Identifier of the worker that executed the strategy. Useful when reporting issues so support can correlate with logs.',
194
+ example: 'executor10'
191
195
  },
192
196
  iops: {
193
197
  type: 'number',
@@ -197,8 +201,8 @@ export const ResultMapSchema = {
197
201
  },
198
202
  strategyId: {
199
203
  type: 'string',
200
- description: 'Redis key of the compiled strategy used for execution. Format: strategy:{userId}:ticker:{compilationId}',
201
- example: 'strategy:4a627755-7f5a-4297-b647-8dddd8aee416:ticker:2iyvtenlzh9dabqtxn7nbv'
204
+ description: 'Identifier of the compiled strategy that produced this result',
205
+ example: 'strategy:00000000-0000-0000-0000-000000000000:ticker:2iyvtenlzh9dabqtxn7nbv'
202
206
  },
203
207
  instrument: {
204
208
  type: 'string',
@@ -260,19 +264,19 @@ export const ResultMapSchema = {
260
264
  },
261
265
  signalsId: {
262
266
  type: 'string',
263
- description: 'Storage key for the signal Parquet file. Format: {userId}/exec/{exchange}/{jobId}',
264
- example: '4a627755-7f5a-4297-b647-8dddd8aee416/exec/binance/3vsndwikcuaatjmb83fjtl'
267
+ description: 'Storage key for the signals file. Treat as opaque; use signalsUrl to download.',
268
+ example: '00000000-0000-0000-0000-000000000000/exec/binance/3vsndwikcuaatjmb83fjtl'
265
269
  },
266
270
  signalsUrl: {
267
271
  type: 'string',
268
272
  format: 'uri',
269
- description: 'Public HTTPS URL to the Parquet file. Computed at setup time from publicBaseUrl + signalsId + .parquet. Available even before upload completes.',
270
- example: 'https://storage.qtsurfer.com/4a627755-7f5a-4297-b647-8dddd8aee416/exec/binance/3vsndwikcuaatjmb83fjtl.parquet'
273
+ description: "HTTPS URL to download the signals Parquet file. Use signalsUpload to know when it's ready.",
274
+ example: 'https://storage.qtsurfer.com/00000000-0000-0000-0000-000000000000/exec/binance/3vsndwikcuaatjmb83fjtl.parquet'
271
275
  },
272
276
  signalsUpload: {
273
277
  type: 'string',
274
278
  enum: ['Done', 'Failed', 'Skipped'],
275
- description: 'Upload status. Done = file uploaded to R2. Failed = upload error (see signalsUploadReason). Skipped = no signals emitted or storage not configured.',
279
+ description: 'Upload status. Done = signal file is available at signalsUrl. Failed = upload error (see signalsUploadReason). Skipped = no signals emitted.',
276
280
  example: 'Done'
277
281
  },
278
282
  signalsUploadedAt: {
@@ -284,7 +288,7 @@ export const ResultMapSchema = {
284
288
  signalsUploadReason: {
285
289
  type: 'string',
286
290
  description: 'Human-readable reason when signalsUpload is Failed or Skipped.',
287
- example: 'parquet file empty or missing after close'
291
+ example: 'signal file generation failed'
288
292
  }
289
293
  }
290
294
  } as const;
@@ -1,7 +1,7 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
 
3
3
  import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
4
- import type { GetExchangesData, GetExchangesResponse, GetInstrumentsData, GetInstrumentsResponse, GetInstrumentsError, PostStrategyData, PostStrategyResponse, PostStrategyError, GetStrategyStatusData, GetStrategyStatusResponse, GetStrategyStatusError, PrepareBacktestingData, PrepareBacktestingResponse, PrepareBacktestingError, GetPreparationStatusData, GetPreparationStatusResponse, GetPreparationStatusError, ExecuteBacktestingData, ExecuteBacktestingResponse, ExecuteBacktestingError, CancelExecutionData, CancelExecutionResponse, CancelExecutionError, GetExecutionResultData, GetExecutionResultResponse, GetExecutionResultError } from './types.gen';
4
+ import type { GetExchangesData, GetExchangesResponse, GetInstrumentsData, GetInstrumentsResponse, GetInstrumentsError, GetExchangeTickersHourData, GetExchangeTickersHourResponse, GetExchangeTickersHourError, GetExchangeKlinesHourData, GetExchangeKlinesHourResponse, GetExchangeKlinesHourError, PostStrategyData, PostStrategyResponse, PostStrategyError, GetStrategyStatusData, GetStrategyStatusResponse, GetStrategyStatusError, PrepareBacktestingData, PrepareBacktestingResponse, PrepareBacktestingError, GetPreparationStatusData, GetPreparationStatusResponse, GetPreparationStatusError, ExecuteBacktestingData, ExecuteBacktestingResponse, ExecuteBacktestingError, CancelExecutionData, CancelExecutionResponse, CancelExecutionError, GetExecutionResultData, GetExecutionResultResponse, GetExecutionResultError } from './types.gen';
5
5
  import { client as _heyApiClient } from './client.gen';
6
6
 
7
7
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
@@ -38,6 +38,64 @@ export const getInstruments = <ThrowOnError extends boolean = false>(options: Op
38
38
  });
39
39
  };
40
40
 
41
+ /**
42
+ * Download one hour of tickers for an instrument as a Lastra segment
43
+ * Serves exactly one hour of raw ticker data for the given instrument on the
44
+ * requested exchange. The payload is a native [Lastra](https://github.com/QTSurfer/lastra-java)
45
+ * file — QTSurfer's columnar format for tick-precision timeseries — with
46
+ * no JSON envelope.
47
+ *
48
+ * One segment = one hour, aligned to UTC. The `hour` query parameter selects
49
+ * the segment and must match `YYYY-MM-DDTHH` (no minutes/seconds, no timezone
50
+ * suffix). Example: `hour=2026-01-15T10` returns `h10.lastra` for
51
+ * 2026-01-15, covering `[10:00:00Z, 11:00:00Z)`. Hours not yet available
52
+ * return `404`.
53
+ *
54
+ * A `format=parquet` query parameter switches the response to on-the-fly
55
+ * Parquet conversion via [lastra-convert](https://github.com/QTSurfer/lastra-convert)
56
+ * for clients that don't yet read Lastra. Lastra is the primary format
57
+ * and cheaper when the client can consume it.
58
+ *
59
+ * Clients:
60
+ * - [lastra-java](https://github.com/QTSurfer/lastra-java) — reference
61
+ * Java reader/writer with per-column codecs (ALP, Gorilla, delta-varint,
62
+ * ZSTD) and CRC32 integrity.
63
+ * - [lastra-ts](https://github.com/QTSurfer/lastra-ts) — TypeScript reader
64
+ * (~4 kB bundle, browser + Node.js).
65
+ * - [duckdb-lastra](https://github.com/QTSurfer/duckdb-lastra) — DuckDB
66
+ * extension for ad-hoc SQL over Lastra files.
67
+ * - [lastra-convert](https://github.com/QTSurfer/lastra-convert) — CLI + Java
68
+ * API for converting to/from Parquet, Reef, and CSV.
69
+ * - `curl -OJ` for offline dumps (the `Content-Disposition` header sets a
70
+ * descriptive filename).
71
+ *
72
+ */
73
+ export const getExchangeTickersHour = <ThrowOnError extends boolean = false>(options: Options<GetExchangeTickersHourData, ThrowOnError>) => {
74
+ return (options.client ?? _heyApiClient).get<GetExchangeTickersHourResponse, GetExchangeTickersHourError, ThrowOnError>({
75
+ url: '/exchange/{exchangeId}/tickers/{base}/{quote}',
76
+ ...options
77
+ });
78
+ };
79
+
80
+ /**
81
+ * Download one hour of klines for an instrument as a Lastra segment
82
+ * Same shape and semantics as `/exchange/{exchangeId}/tickers/{base}/{quote}`,
83
+ * but serves klines (aggregated bars) instead of raw ticks. One
84
+ * [Lastra](https://github.com/QTSurfer/lastra-java) segment = one hour of
85
+ * klines at the exchange's native kline cadence, aligned to UTC.
86
+ *
87
+ * Klines use the same columnar layout as tickers — readers that handle one
88
+ * format read the other with the same code. Use this endpoint when a
89
+ * per-tick payload would be too large for the window of interest.
90
+ *
91
+ */
92
+ export const getExchangeKlinesHour = <ThrowOnError extends boolean = false>(options: Options<GetExchangeKlinesHourData, ThrowOnError>) => {
93
+ return (options.client ?? _heyApiClient).get<GetExchangeKlinesHourResponse, GetExchangeKlinesHourError, ThrowOnError>({
94
+ url: '/exchange/{exchangeId}/klines/{base}/{quote}',
95
+ ...options
96
+ });
97
+ };
98
+
41
99
  /**
42
100
  * Compile a strategy from source code
43
101
  * Submits raw strategy source for compilation. By default the call is synchronous and returns
@@ -72,7 +72,7 @@ export type Exchange = {
72
72
  };
73
73
 
74
74
  /**
75
- * Managed exchange data sources available for backtesting. Currently only ticker is supported; kline and funding rate support is planned.
75
+ * Managed exchange data sources available for backtesting.
76
76
  */
77
77
  export type DataSourceType = 'ticker';
78
78
 
@@ -81,13 +81,17 @@ export type DataSourceType = 'ticker';
81
81
  */
82
82
  export type JobState = {
83
83
  /**
84
- * Unique context ID for the job
84
+ * Opaque context identifier for the job
85
85
  */
86
86
  contextId: string;
87
87
  /**
88
- * Current status of the job
88
+ * Current status of the job. `Partial` (prepare only) means some
89
+ * hours are still being produced asynchronously — keep polling.
90
+ * Treat `Completed | Aborted | Failed` as terminal; anything else
91
+ * means keep polling.
92
+ *
89
93
  */
90
- status: 'New' | 'Started' | 'Completed' | 'Aborted' | 'Failed';
94
+ status: 'New' | 'Started' | 'Partial' | 'Completed' | 'Aborted' | 'Failed';
91
95
  /**
92
96
  * Detailed status information, if available
93
97
  */
@@ -135,7 +139,7 @@ export type BacktestJobResult = {
135
139
  */
136
140
  export type ResultMap = {
137
141
  /**
138
- * Hostname of the worker node that executed the strategy
142
+ * Identifier of the worker that executed the strategy. Useful when reporting issues so support can correlate with logs.
139
143
  */
140
144
  hostName?: string;
141
145
  /**
@@ -143,7 +147,7 @@ export type ResultMap = {
143
147
  */
144
148
  iops?: number;
145
149
  /**
146
- * Redis key of the compiled strategy used for execution. Format: strategy:{userId}:ticker:{compilationId}
150
+ * Identifier of the compiled strategy that produced this result
147
151
  */
148
152
  strategyId: string;
149
153
  /**
@@ -187,15 +191,15 @@ export type ResultMap = {
187
191
  */
188
192
  signalCount?: number;
189
193
  /**
190
- * Storage key for the signal Parquet file. Format: {userId}/exec/{exchange}/{jobId}
194
+ * Storage key for the signals file. Treat as opaque; use signalsUrl to download.
191
195
  */
192
196
  signalsId?: string;
193
197
  /**
194
- * Public HTTPS URL to the Parquet file. Computed at setup time from publicBaseUrl + signalsId + .parquet. Available even before upload completes.
198
+ * HTTPS URL to download the signals Parquet file. Use signalsUpload to know when it's ready.
195
199
  */
196
200
  signalsUrl?: string;
197
201
  /**
198
- * Upload status. Done = file uploaded to R2. Failed = upload error (see signalsUploadReason). Skipped = no signals emitted or storage not configured.
202
+ * Upload status. Done = signal file is available at signalsUrl. Failed = upload error (see signalsUploadReason). Skipped = no signals emitted.
199
203
  */
200
204
  signalsUpload?: 'Done' | 'Failed' | 'Skipped';
201
205
  /**
@@ -259,6 +263,132 @@ export type GetInstrumentsResponses = {
259
263
 
260
264
  export type GetInstrumentsResponse = GetInstrumentsResponses[keyof GetInstrumentsResponses];
261
265
 
266
+ export type GetExchangeTickersHourData = {
267
+ body?: never;
268
+ path: {
269
+ /**
270
+ * ID of the exchange (e.g. `binance`).
271
+ */
272
+ exchangeId: string;
273
+ /**
274
+ * Base asset symbol (first leg of the pair).
275
+ */
276
+ base: string;
277
+ /**
278
+ * Quote asset symbol (second leg of the pair).
279
+ */
280
+ quote: string;
281
+ };
282
+ query: {
283
+ /**
284
+ * Hour selector in `YYYY-MM-DDTHH` (UTC). The returned segment covers
285
+ * `[HH:00:00Z, HH+1:00:00Z)`.
286
+ *
287
+ */
288
+ hour: string;
289
+ /**
290
+ * Response wire format. `lastra` (default) returns raw Lastra bytes.
291
+ * `parquet` returns Parquet via on-the-fly conversion using
292
+ * [lastra-convert](https://github.com/QTSurfer/lastra-convert).
293
+ *
294
+ */
295
+ format?: 'lastra' | 'parquet';
296
+ };
297
+ url: '/exchange/{exchangeId}/tickers/{base}/{quote}';
298
+ };
299
+
300
+ export type GetExchangeTickersHourErrors = {
301
+ /**
302
+ * Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
303
+ */
304
+ 400: ResponseError;
305
+ /**
306
+ * No Lastra segment exists for the requested instrument/hour.
307
+ */
308
+ 404: ResponseError;
309
+ /**
310
+ * Unexpected I/O error serving the file.
311
+ */
312
+ 500: ResponseError;
313
+ };
314
+
315
+ export type GetExchangeTickersHourError = GetExchangeTickersHourErrors[keyof GetExchangeTickersHourErrors];
316
+
317
+ export type GetExchangeTickersHourResponses = {
318
+ /**
319
+ * One hour of tickers for the instrument. `Content-Type` is
320
+ * `application/vnd.lastra` by default or
321
+ * `application/vnd.apache.parquet` when `format=parquet` was
322
+ * requested.
323
+ *
324
+ */
325
+ 200: Blob | File;
326
+ };
327
+
328
+ export type GetExchangeTickersHourResponse = GetExchangeTickersHourResponses[keyof GetExchangeTickersHourResponses];
329
+
330
+ export type GetExchangeKlinesHourData = {
331
+ body?: never;
332
+ path: {
333
+ /**
334
+ * ID of the exchange (e.g. `binance`).
335
+ */
336
+ exchangeId: string;
337
+ /**
338
+ * Base asset symbol.
339
+ */
340
+ base: string;
341
+ /**
342
+ * Quote asset symbol.
343
+ */
344
+ quote: string;
345
+ };
346
+ query: {
347
+ /**
348
+ * Hour selector in `YYYY-MM-DDTHH` (UTC). The returned segment covers
349
+ * `[HH:00:00Z, HH+1:00:00Z)`.
350
+ *
351
+ */
352
+ hour: string;
353
+ /**
354
+ * Response wire format. `lastra` (default) returns raw Lastra bytes.
355
+ * `parquet` returns Parquet via on-the-fly conversion.
356
+ *
357
+ */
358
+ format?: 'lastra' | 'parquet';
359
+ };
360
+ url: '/exchange/{exchangeId}/klines/{base}/{quote}';
361
+ };
362
+
363
+ export type GetExchangeKlinesHourErrors = {
364
+ /**
365
+ * Missing or malformed parameters (e.g. `hour` not `YYYY-MM-DDTHH`).
366
+ */
367
+ 400: ResponseError;
368
+ /**
369
+ * No Lastra segment exists for the requested instrument/hour.
370
+ */
371
+ 404: ResponseError;
372
+ /**
373
+ * Unexpected I/O error serving the file.
374
+ */
375
+ 500: ResponseError;
376
+ };
377
+
378
+ export type GetExchangeKlinesHourError = GetExchangeKlinesHourErrors[keyof GetExchangeKlinesHourErrors];
379
+
380
+ export type GetExchangeKlinesHourResponses = {
381
+ /**
382
+ * One hour of klines for the instrument. `Content-Type` is
383
+ * `application/vnd.lastra` by default or
384
+ * `application/vnd.apache.parquet` when `format=parquet`.
385
+ *
386
+ */
387
+ 200: Blob | File;
388
+ };
389
+
390
+ export type GetExchangeKlinesHourResponse = GetExchangeKlinesHourResponses[keyof GetExchangeKlinesHourResponses];
391
+
262
392
  export type PostStrategyData = {
263
393
  /**
264
394
  * Raw strategy Java source code
@@ -362,6 +492,15 @@ export type PrepareBacktestingData = {
362
492
  *
363
493
  */
364
494
  to: string;
495
+ /**
496
+ * Output bar cadence for the prepared range. Defaults to the publisher's
497
+ * native cadence (`1s`); coarser cadences are produced on demand via
498
+ * resampling and stored alongside the native blob in cache. Coarser-than-
499
+ * source values must be exact multiples of the source cadence — invalid
500
+ * labels return `400`.
501
+ *
502
+ */
503
+ cadence?: '1s' | '5s' | '1m' | '5m' | '15m' | '1h' | '4h' | '1d';
365
504
  };
366
505
  path: {
367
506
  /**