refactor(b1): tidy ForwardTracker imports + module docstring

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-06-16 06:35:31 +02:00
parent 4f9b6fcc0f
commit f6aecfece4

View File

@@ -1,15 +1,17 @@
"""Forward-validation tracker for the combined book — the only ground truth before capital.
"""Strategy-agnostic forward-validation tracker — the only ground truth before capital.
Freezes the strategy at INCEPTION (first run) and, on each subsequent run, books only the realized returns
of days STRICTLY AFTER inception — a genuine out-of-sample-in-time paper track (no capital risked). Run
daily on a cron alongside the data fetch; the forward NAV + forward Sharpe accumulate honestly. The
in-sample backtest Sharpe (~1.4) means nothing until the forward record confirms it.
`ForwardTracker` freezes any `ForwardStrategy` port at INCEPTION and thereafter books only realized
returns of days STRICTLY AFTER it — a genuine out-of-sample-in-time paper track (no capital risked).
The combined book is one (recomputable) strategy on it; in-sample backtest Sharpe means nothing until
the forward record confirms it.
"""
from __future__ import annotations
import datetime as _dt
import json
import os
from dataclasses import dataclass
from typing import Any, Protocol
import numpy as np
@@ -30,10 +32,6 @@ class ForwardStatus:
booked_today: int
import datetime as _dt
from typing import Any, Protocol
class ForwardStrategy(Protocol):
def advance(self, last_date: str | None, extra: dict[str, Any]) -> tuple[list[tuple[str, float]], dict[str, Any]]:
"""Return candidate (ISO-date, fractional-return) rows the strategy knows now, plus its updated