@qtsurfer/api-client 0.1.0 → 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/dist/index.js CHANGED
@@ -1,3 +1,143 @@
1
- export * from './generated';
2
- export { client } from './generated/client.gen';
1
+ // src/generated/client.gen.ts
2
+ import { createClient, createConfig } from "@hey-api/client-fetch";
3
+ var client = createClient(createConfig({
4
+ baseUrl: "https://api.staging.qtsurfer.com/v1"
5
+ }));
6
+
7
+ // src/generated/sdk.gen.ts
8
+ var getExchanges = (options) => {
9
+ return (options?.client ?? client).get({
10
+ url: "/exchanges",
11
+ ...options
12
+ });
13
+ };
14
+ var getInstruments = (options) => {
15
+ return (options.client ?? client).get({
16
+ url: "/exchange/{exchangeId}/instruments",
17
+ ...options
18
+ });
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
+ };
32
+ var postStrategy = (options) => {
33
+ return (options.client ?? client).post({
34
+ bodySerializer: null,
35
+ security: [
36
+ {
37
+ scheme: "bearer",
38
+ type: "http"
39
+ }
40
+ ],
41
+ url: "/strategy",
42
+ ...options,
43
+ headers: {
44
+ "Content-Type": "text/plain",
45
+ ...options?.headers
46
+ }
47
+ });
48
+ };
49
+ var getStrategyStatus = (options) => {
50
+ return (options.client ?? client).get({
51
+ security: [
52
+ {
53
+ scheme: "bearer",
54
+ type: "http"
55
+ }
56
+ ],
57
+ url: "/strategy/{strategyId}",
58
+ ...options
59
+ });
60
+ };
61
+ var prepareBacktesting = (options) => {
62
+ return (options.client ?? client).post({
63
+ security: [
64
+ {
65
+ scheme: "bearer",
66
+ type: "http"
67
+ }
68
+ ],
69
+ url: "/backtest/{exchangeId}/{type}/prepare",
70
+ ...options,
71
+ headers: {
72
+ "Content-Type": "application/json",
73
+ ...options?.headers
74
+ }
75
+ });
76
+ };
77
+ var getPreparationStatus = (options) => {
78
+ return (options.client ?? client).get({
79
+ security: [
80
+ {
81
+ scheme: "bearer",
82
+ type: "http"
83
+ }
84
+ ],
85
+ url: "/backtest/{exchangeId}/{type}/prepare/{jobId}",
86
+ ...options
87
+ });
88
+ };
89
+ var executeBacktesting = (options) => {
90
+ return (options.client ?? client).post({
91
+ security: [
92
+ {
93
+ scheme: "bearer",
94
+ type: "http"
95
+ }
96
+ ],
97
+ url: "/backtest/{exchangeId}/{type}/execute",
98
+ ...options,
99
+ headers: {
100
+ "Content-Type": "application/json",
101
+ ...options?.headers
102
+ }
103
+ });
104
+ };
105
+ var cancelExecution = (options) => {
106
+ return (options.client ?? client).delete({
107
+ security: [
108
+ {
109
+ scheme: "bearer",
110
+ type: "http"
111
+ }
112
+ ],
113
+ url: "/backtest/{exchangeId}/{type}/execute/{jobId}",
114
+ ...options
115
+ });
116
+ };
117
+ var getExecutionResult = (options) => {
118
+ return (options.client ?? client).get({
119
+ security: [
120
+ {
121
+ scheme: "bearer",
122
+ type: "http"
123
+ }
124
+ ],
125
+ url: "/backtest/{exchangeId}/{type}/execute/{jobId}",
126
+ ...options
127
+ });
128
+ };
129
+ export {
130
+ cancelExecution,
131
+ client,
132
+ executeBacktesting,
133
+ getExchangeKlinesHour,
134
+ getExchangeTickersHour,
135
+ getExchanges,
136
+ getExecutionResult,
137
+ getInstruments,
138
+ getPreparationStatus,
139
+ getStrategyStatus,
140
+ postStrategy,
141
+ prepareBacktesting
142
+ };
3
143
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC"}
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":"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","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qtsurfer/api-client",
3
- "version": "0.1.0",
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",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "scripts": {
22
22
  "generate": "openapi-ts",
23
- "build": "tsc",
23
+ "build": "tsup",
24
24
  "lint": "tsc --noEmit",
25
25
  "prepublishOnly": "npm run build"
26
26
  },
@@ -48,6 +48,7 @@
48
48
  },
49
49
  "devDependencies": {
50
50
  "@hey-api/openapi-ts": "^0.66",
51
+ "tsup": "^8.5.1",
51
52
  "typescript": "^5.8.0"
52
53
  },
53
54
  "dependencies": {
@@ -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
  /**
@@ -1,13 +0,0 @@
1
- import type { ClientOptions } from './types.gen';
2
- import { type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch';
3
- /**
4
- * The `createClientConfig()` function will be called on client initialization
5
- * and the returned object will become the client's initial configuration.
6
- *
7
- * You may want to initialize your client this way instead of calling
8
- * `setConfig()`. This is useful for example if you're using Next.js
9
- * to ensure your client always has the correct values.
10
- */
11
- export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>;
12
- export declare const client: import("@hey-api/client-fetch").Client;
13
- //# sourceMappingURL=client.gen.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.gen.d.ts","sourceRoot":"","sources":["../../src/generated/client.gen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,IAAI,oBAAoB,EAA8B,MAAM,uBAAuB,CAAC;AAE5H;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,oBAAoB,GAAG,aAAa,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,oBAAoB,GAAG,CAAC,CAAC,KAAK,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;AAE7K,eAAO,MAAM,MAAM,wCAEhB,CAAC"}
@@ -1,6 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
- import { createClient, createConfig } from '@hey-api/client-fetch';
3
- export const client = createClient(createConfig({
4
- baseUrl: 'https://api.staging.qtsurfer.com/v1'
5
- }));
6
- //# sourceMappingURL=client.gen.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.gen.js","sourceRoot":"","sources":["../../src/generated/client.gen.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAGrD,OAAO,EAA2D,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAY5H,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,YAAY,CAAgB;IAC3D,OAAO,EAAE,qCAAqC;CACjD,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from './types.gen';
2
- export * from './sdk.gen';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generated/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
@@ -1,4 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
- export * from './types.gen';
3
- export * from './sdk.gen';
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generated/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}