Optional numeric return head (predicts percent change for 1s,1m,1h,1d)

This commit is contained in:
Dobromir Popov
2025-08-23 15:17:04 +03:00
parent 9992b226ea
commit 81749ee18e
8 changed files with 124 additions and 30 deletions

View File

@@ -140,6 +140,7 @@ class EnhancedRewardCalculator:
symbol: str,
timeframe: TimeFrame,
predicted_price: float,
predicted_return: Optional[float] = None,
predicted_direction: int,
confidence: float,
current_price: float,
@@ -171,6 +172,14 @@ class EnhancedRewardCalculator:
model_name=model_name
)
# If predicted_return provided, prefer computing implied predicted_price
# to avoid synthetic price fabrication
try:
if predicted_return is not None and current_price > 0:
prediction.predicted_price = current_price * (1.0 + float(predicted_return))
except Exception:
pass
# Store prediction
if symbol not in self.predictions:
self._initialize_data_structures()