Retire completed GTL tuning harnesses

This commit is contained in:
2026-07-13 16:40:29 +02:00
parent 1d84a40c04
commit 8e09f239c8
16 changed files with 59 additions and 2057 deletions
+7 -24
View File
@@ -93,7 +93,6 @@ def _zone_representative_levels(
entry_price: float,
*,
strength_mode: str = "sum",
tolerance: float = _SR_ZONE_TOLERANCE,
) -> list[Any]:
"""Collapse near-duplicate S/R levels into one representative per zone.
@@ -125,7 +124,7 @@ def _zone_representative_levels(
zones = cluster_sr_zones(
level_dicts,
entry_price,
tolerance=tolerance,
tolerance=_SR_ZONE_TOLERANCE,
strength_mode=strength_mode,
)
@@ -316,16 +315,9 @@ class TargetGenerator:
stop_loss: float,
sr_levels: list[SRLevel],
atr_value: float,
*,
max_targets: int | None = 5,
max_atr_multiple_override: float | None = None,
) -> list[dict[str, Any]]:
if atr_value <= 0:
return []
if max_targets is not None and max_targets < 1:
raise ValueError("max_targets must be positive or None")
if max_atr_multiple_override is not None and max_atr_multiple_override <= 0:
raise ValueError("max_atr_multiple_override must be positive or None")
risk = abs(entry_price - stop_loss)
if risk <= 0:
@@ -334,12 +326,11 @@ class TargetGenerator:
candidates: list[dict[str, Any]] = []
atr_pct = atr_value / entry_price if entry_price > 0 else 0.0
max_atr_multiple: float | None = max_atr_multiple_override
if max_atr_multiple is None:
if atr_pct > 0.05:
max_atr_multiple = 10.0
elif atr_pct < 0.02:
max_atr_multiple = 3.0
max_atr_multiple: float | None = None
if atr_pct > 0.05:
max_atr_multiple = 10.0
elif atr_pct < 0.02:
max_atr_multiple = 3.0
for level in sr_levels:
is_candidate = False
@@ -392,12 +383,6 @@ class TargetGenerator:
if not candidates:
return []
if max_targets is None:
candidates.sort(key=lambda row: row["distance_from_entry"])
for target in candidates:
target.pop("quality", None)
return candidates
# Select up to 5 targets that SPAN the distance range, instead of the
# top-5 by quality (which biases toward far, high-R:R levels and buries
# every nearby target). Guarantees the nearest level plus a
@@ -411,8 +396,6 @@ class TargetGenerator:
selected_ids: set[int] = set()
def _add(candidate: dict[str, Any] | None) -> None:
if len(selected) >= max_targets:
return
if candidate is not None and candidate["sr_level_id"] not in selected_ids:
selected.append(candidate)
selected_ids.add(candidate["sr_level_id"])
@@ -425,7 +408,7 @@ class TargetGenerator:
_add(max(bucket, key=lambda c: c["quality"]))
# Fill remaining slots with the next-best by quality
for candidate in sorted(candidates, key=lambda c: c["quality"], reverse=True):
if len(selected) >= max_targets:
if len(selected) >= 5:
break
_add(candidate)