T-123: M1.3h — @stock-bot/research: pure event-study panel builder (MarketDataStore daily bars + events table → Vault-safe EventStudyInput) with an end-to-end qmFilings event study test (store → runEventStudy → trial_ledger → DSR) and local benchmark (no new dependencies)

This commit is contained in:
Studio 2026-11-29 16:40:52 -05:00
parent 5e626b083b
commit ee983cb349
5 changed files with 459 additions and 114 deletions

View file

@ -1,4 +1,8 @@
import { type EventObservation, buildEventStudyInput } from '../src/event-panel';
import {
type EventObservation,
type EventStudyExchangeCalendars,
buildEventStudyInput,
} from '../src/event-panel';
import type { BarRecord } from '../src/market-data-store';
const SEED = 20261129;
@ -129,6 +133,22 @@ for (let l = 0; l < LISTINGS; l += 1) {
}
}
const sessionCloses = calendar.dates.map((date, idx) => ({
date,
closeTs: calendar.closeTs[idx] as number,
}));
const listingCalendarId = new Map<number, string>();
for (let l = 0; l < LISTINGS; l += 1) {
listingCalendarId.set(l + 1, l % 2 === 0 ? 'XNYS' : 'XTSE');
}
const exchangeCalendars: EventStudyExchangeCalendars = {
calendars: new Map([
['XNYS', sessionCloses],
['XTSE', sessionCloses],
]),
listingCalendarId,
};
// Timed section: pure buildEventStudyInput execution (no fixture generation or checksum).
const started = performance.now();
const result = buildEventStudyInput({
@ -136,6 +156,7 @@ const result = buildEventStudyInput({
events,
vaultCutoffDate,
benchmark: 'equal_weight',
exchangeCalendars,
});
const elapsedMs = performance.now() - started;