feat(research): disclose saved result provenance and limitations

This commit is contained in:
Boki 2026-10-22 14:50:24 -04:00
parent 43ffb547be
commit fe00ecd0e2
12 changed files with 456 additions and 12 deletions

View file

@ -57,6 +57,17 @@ export interface BacktestRunTrade {
duration?: number;
}
/** Read-only evidence from saved results, not a certification of economic correctness. */
export interface BacktestRunProvenance {
/** Legacy config remains a compatibility display fallback, never historical evidence. */
configurationSource: 'stored-snapshot' | 'legacy-definition-fallback';
datasetHash: string | null;
engineVersion: string | null;
economicsVersion: string | null;
strategyArtifactHash: string | null;
limitations: { code: string; message: string }[];
}
export interface BacktestRunResult {
runId: string;
backtestId: string;
@ -65,6 +76,8 @@ export interface BacktestRunResult {
legacy?: boolean;
status: 'completed' | 'cancelled';
completedAt: string;
/** Optional for older API clients/results. Missing provenance must display as unknown. */
provenance?: BacktestRunProvenance;
config: BacktestRunConfiguration;
metrics: BacktestRunMetrics;
equity: { date: string; value: number }[];
@ -83,7 +96,8 @@ export interface BacktestRunResult {
}[];
/** Returns, drawdowns, and exposure use fractions here as well. */
analytics: {
exposureTime: number;
/** Null when unavailable or a known placeholder; genuine measured zero remains zero. */
exposureTime: number | null;
drawdownSeries?: { timestamp: number; value: number }[];
dailyReturns?: number[];
monthlyReturns?: Record<string, number>;

View file

@ -47,6 +47,7 @@ export type { BacktestResults } from './backtesting';
export type {
BacktestRunConfiguration,
BacktestRunMetrics,
BacktestRunProvenance,
BacktestRunTrade,
BacktestRunResult,
} from './backtest-run';