feat(research): run trusted SMA strategies through native workers

This commit is contained in:
Boki 2026-10-23 14:07:53 -04:00
parent 4f6e44a853
commit ca5abdde0e
16 changed files with 1682 additions and 28 deletions

View file

@ -1,5 +1,6 @@
import { z } from 'zod';
import { replayTraceSchema } from '../contracts/native-replay';
import { strategyReplayRequestSchema } from '../contracts/strategy-replay';
import { BacktestConfigSchema } from '../types';
const finite = z.number().finite();
@ -21,7 +22,11 @@ const legacyRequestSchema = z.object({
),
});
export const nativeWorkerRequestSchema = z.union([legacyRequestSchema, replayTraceSchema]);
export const nativeWorkerRequestSchema = z.union([
legacyRequestSchema,
replayTraceSchema,
strategyReplayRequestSchema,
]);
export const nativeWorkerMessageSchema = z.discriminatedUnion('type', [
z.object({ type: z.literal('progress'), progress: finite.min(0).max(100), message: z.string() }),
@ -29,5 +34,5 @@ export const nativeWorkerMessageSchema = z.discriminatedUnion('type', [
z.object({ type: z.literal('error'), message: z.string() }),
]);
export type NativeWorkerRequest = z.infer<typeof nativeWorkerRequestSchema>;
export type NativeWorkerRequest = z.input<typeof nativeWorkerRequestSchema>;
export type NativeWorkerMessage = z.infer<typeof nativeWorkerMessageSchema>;