docs(b1): note gd QQQ-alignment choice vs foxhunt original

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-06-16 06:58:10 +02:00
parent 6e004f1749
commit a2d7bfe512

View File

@@ -8,6 +8,10 @@ def daily_returns(qqq: dict[str, float], multistrat_closes: dict[str, dict[str,
w_equity: float = 0.70) -> list[tuple[str, float]]:
ms = dict(multistrat.book_series(multistrat_closes))
qdates = sorted(qqq)
# Intentional alignment choice vs foxhunt original: foxhunt samples QQQ on the book's date grid;
# this port computes QQQ returns on QQQ's own consecutive dates then intersects with the book dates.
# Identical on a clean shared trading calendar; on a data hole this drops the gap day's move rather
# than bridging it as a mislabelled 1-day return.
qret = {qdates[i]: qqq[qdates[i]] / qqq[qdates[i - 1]] - 1.0 for i in range(1, len(qdates))}
common = sorted(set(ms) & set(qret))
return [(d, w_equity * qret[d] + (1.0 - w_equity) * ms[d]) for d in common]