Unify analytics calculations and fail closed on unavailable data

This commit is contained in:
Boki 2026-10-21 19:28:21 -04:00
parent 783b619846
commit ccce401f72
31 changed files with 1978 additions and 1553 deletions

View file

@ -256,6 +256,16 @@ describe('orchestrator architecture boundaries', () => {
expect(dependencies).toEqual(['backtest/BacktestPlayback.ts', 'backtest/execution-engine.ts']);
});
it('shared analytics math is pure and cannot load report facades or application adapters', () => {
for (const entry of ['equity', 'performance', 'return-statistics', 'trade-statistics']) {
for (const file of reachable(join(root, 'analytics/' + entry + '.ts'))) {
expect(relative(root, file)).toMatch(/^analytics\//);
expect(relative(root, file)).not.toBe('analytics/PerformanceAnalyzer.ts');
expect((imports.get(file) ?? []).every(specifier => specifier.startsWith('.'))).toBe(true);
}
}
});
it('backtest reports are independent of run control, native engines, data loading and financial mutation', () => {
for (const entry of ['backtest/BacktestReport.ts', 'backtest/report-format.ts']) {
for (const file of reachable(join(root, entry))) {