From f6aecfece4b7ab60fe47be50e883be79414640a0 Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Tue, 16 Jun 2026 06:35:31 +0200 Subject: [PATCH] refactor(b1): tidy ForwardTracker imports + module docstring Co-Authored-By: Claude Opus 4.8 (1M context) --- src/fxhnt/application/forward_tracker.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/fxhnt/application/forward_tracker.py b/src/fxhnt/application/forward_tracker.py index 3024a7d..1b176fd 100644 --- a/src/fxhnt/application/forward_tracker.py +++ b/src/fxhnt/application/forward_tracker.py @@ -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