]> Piment Noir Git Repositories - freqai-strategies.git/commit
refactor(quickadapter): post-merge harmonization follow-up (#99)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 22 Jun 2026 02:12:50 +0000 (04:12 +0200)
committerGitHub <noreply@github.com>
Mon, 22 Jun 2026 02:12:50 +0000 (04:12 +0200)
commit653cb07ec06c57510b70b5e7421a87bd19a17053
tree4d1aed2bc926e95c3d7e4c8797afbd7666c85551
parent3e71ee87f0b2fe7b53df2b45cac153f6641465b6
refactor(quickadapter): post-merge harmonization follow-up (#99)

Consolidates SAFE + DRY + COSMETIC findings from the 4-axis review of
`add1fb7..d6a718f` (PRs #90, #94, #95, #96, #97 + 2 style + d6a718f).

Migration (PR #94 carry-over to `QuickAdapterV3.py`):
- `_TRADE_DIRECTIONS_SET` and `_ORDER_TYPES_SET` are
  `Final[frozenset[T]]` constants adjacent to the canonical
  `_TRADE_DIRECTIONS` / `_ORDER_TYPES` tuples; the strategy reads
  them directly at all 3 call sites. The
  `@staticmethod @lru_cache(maxsize=None)` set-views are absent at
  HEAD.

Context-prefix harmonization (PR #97 carry-over):
- The 2 `sanitize_and_renormalize` calls in
  `QuickAdapterRegressorV3._apply_pipelines` carry the `[<pair>]`
  prefix (`f"[{pair}] post_feature_pipeline:train"` / `:test`),
  matching the PR #97 convention at the 4 `compose_sample_weights`
  call sites.

Alias removal (PR #96 carry-over):
- `Utils.label_known_at_column_name` is absent at HEAD. The
  underlying column has zero external callers in the repo, and
  PR #96 shifted semantics (absolute index -> per-row offset);
  no back-compat alias is warranted.

DRY (`d6a718f` carry-over):
- The 8-tuple swap blocks in `_make_train_test_split_datasets`
  and `_make_timeseries_split_datasets` use pythonic parallel
  pair-swap (`a, b = b, a` per slot pair); 4 lines per slot pair
  instead of the 18-line 8-tuple parallel assignment.

Dead constant removal:
- `QuickAdapterRegressorV3._AGGREGATE_DISTANCE_METRICS_SET` is
  absent at HEAD; the constant has no caller. The
  `_CLUSTER_DENSITY_DISTANCE_METRICS_SET` block comment lists the
  7 aggregate metrics inline for reference (`harmonic_mean`,
  `geometric_mean`, `arithmetic_mean`, `quadratic_mean`,
  `cubic_mean`, `power_mean`, `weighted_sum`).

Cosmetic:
- `_LABEL_KNOWN_AT_LOOKAHEAD_SUFFIX` placement is adjacent to
  `LABEL_WEIGHT_SUFFIX` (both are label-aux column suffixes).
- `_known_at_lookahead` returns `int64` on both single-series and
  multi-series paths (symmetric dtype contract).
- Schema-version reset log: `f"v{existing_schema_version!r}"`
  renders unambiguously for non-int corrupt values (booleans,
  strings).
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/QuickAdapterV3.py
quickadapter/user_data/strategies/Utils.py