Optional numeric return head (predicts percent change for 1s,1m,1h,1d)
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user