feat(research): isolate candidates and add reviewed paper promotion
This commit is contained in:
parent
26b97265c6
commit
25b5cbf481
128 changed files with 13038 additions and 1388 deletions
|
|
@ -1,4 +1,8 @@
|
|||
import { z } from 'zod';
|
||||
import {
|
||||
candidateExecutionSchema,
|
||||
type CandidateExecution,
|
||||
} from '@stock-bot/stock-config/candidate-execution';
|
||||
import {
|
||||
canonicalBuildIdentitySchema,
|
||||
canonicalRunRequestSchema,
|
||||
|
|
@ -19,6 +23,11 @@ export const retainedStrategyRequestSchema = z
|
|||
type: z.literal('runRetainedStrategy'),
|
||||
request: canonicalRunRequestSchema,
|
||||
dataset: z.unknown(),
|
||||
executionDeadlineAt: z.number().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),
|
||||
candidateContainerName: z
|
||||
.string()
|
||||
.regex(/^stock-bot-candidate-[0-9a-f-]{36}$/)
|
||||
.optional(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
|
|
@ -33,6 +42,7 @@ export interface RetainedStrategyResult {
|
|||
version: 1;
|
||||
build: CanonicalBuildIdentity;
|
||||
artifactHash: string;
|
||||
execution?: CandidateExecution;
|
||||
financial: ReplayReportResult;
|
||||
analytics: CanonicalBacktestAnalytics;
|
||||
}
|
||||
|
|
@ -43,6 +53,7 @@ const retainedStrategyResultSchema = z
|
|||
version: z.literal(1),
|
||||
build: canonicalBuildIdentitySchema,
|
||||
artifactHash: z.string().regex(/^[a-f0-9]{64}$/),
|
||||
execution: candidateExecutionSchema.optional(),
|
||||
financial: z.unknown(),
|
||||
analytics: z.unknown(),
|
||||
})
|
||||
|
|
@ -60,6 +71,14 @@ export function parseRetainedStrategyResult(
|
|||
) {
|
||||
throw new Error('Retained strategy result build/artifact identity mismatch');
|
||||
}
|
||||
if (
|
||||
request.strategy.origin === 'candidate'
|
||||
? canonicalStrategyJson(envelope.execution) !==
|
||||
canonicalStrategyJson(request.strategy.execution)
|
||||
: envelope.execution !== undefined
|
||||
) {
|
||||
throw new Error('Retained strategy result execution identity mismatch');
|
||||
}
|
||||
const financial = parseCanonicalFinancialResult(envelope.financial, request);
|
||||
const analytics = buildCanonicalBacktestReport(financial, request.analyticsPolicy).analytics;
|
||||
if (canonicalStrategyJson(envelope.analytics) !== canonicalStrategyJson(analytics)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue