fix: require live calibration to authorise a live order
Offline evidence can no longer authorise anything. createDecisions used to prefer a live snapshot and fall back to the pooled historical one, so once the live lane woke up a live prediction could have drawn a BUY off backfill data. Backfill and replay are fine evidence that the pipeline works, they are not a live track record. No live snapshot now means ABSTAIN. The abstain says whether offline evidence existed for that cohort, so "we have 60 offline samples but no live ones" stays distinguishable from "we know nothing about this cohort". Also split the health counter. It counted qualifying cohorts across every source, which overstated how close we are to being able to trade now that only live cohorts can authorise. It reports qualifying_live_cohorts and qualifying_offline_cohorts separately, and applies the concentration cap it was previously ignoring. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WnNxwxfXSbeNtjvtz5gayb
This commit is contained in:
@@ -93,10 +93,24 @@ test('a big single ticker historical cohort still cannot authorise a live buy',
|
||||
assert.equal(createDecisions(db), 1);
|
||||
const decision = db.prepare('SELECT * FROM autonomy_decisions WHERE prediction_id=?').get(prediction);
|
||||
assert.equal(decision.action, 'ABSTAIN');
|
||||
assert.match(decision.rationale, /diversity|dominated/);
|
||||
// offline evidence never authorises a live order, however much of it there is,
|
||||
// and the abstain has to say the offline data existed so it isnt mistaken for
|
||||
// "we know nothing about this cohort"
|
||||
assert.match(decision.rationale, /no live calibration/);
|
||||
assert.match(decision.rationale, /offline_only source=historical n=60/);
|
||||
assert.match(decision.rationale, new RegExp(cohortKey({ direction: 'positive', eventType: 'earnings_beat', horizonDays: 10 }).replace(/\|/g, '\\|')));
|
||||
});
|
||||
|
||||
test('a cohort with no evidence at all is distinguishable from an offline only one', () => {
|
||||
const db = seedDb();
|
||||
const prediction = addPrediction(db, { instrument: 'NVDA', status: 'open' });
|
||||
|
||||
assert.equal(createDecisions(db), 1);
|
||||
const decision = db.prepare('SELECT * FROM autonomy_decisions WHERE prediction_id=?').get(prediction);
|
||||
assert.equal(decision.action, 'ABSTAIN');
|
||||
assert.match(decision.rationale, /no evidence/);
|
||||
});
|
||||
|
||||
test('calibration health reports the stall instead of staying silent', () => {
|
||||
const db = seedDb();
|
||||
addPrediction(db, { instrument: 'NVDA', origin: 'historical', excessReturn: 0.02, correct: 1 });
|
||||
|
||||
Reference in New Issue
Block a user