training fixes and enhancements wip
This commit is contained in:
@ -437,13 +437,34 @@ class TradingOrchestrator:
|
||||
|
||||
def predict(self, data=None):
|
||||
try:
|
||||
# ExtremaTrainer provides context features, not a direct prediction
|
||||
# We assume 'data' here is the 'symbol' string to pass to get_context_features_for_model
|
||||
if not isinstance(data, str):
|
||||
logger.warning(f"ExtremaTrainerInterface.predict received non-string data: {type(data)}. Cannot get context features.")
|
||||
# Handle different data types that might be passed to ExtremaTrainer
|
||||
symbol = None
|
||||
|
||||
if isinstance(data, str):
|
||||
# Direct symbol string
|
||||
symbol = data
|
||||
elif isinstance(data, dict):
|
||||
# Dictionary with symbol information
|
||||
symbol = data.get('symbol')
|
||||
elif isinstance(data, np.ndarray):
|
||||
# Numpy array - extract symbol from metadata or use default
|
||||
# For now, use the first symbol from the model's symbols list
|
||||
if hasattr(self.model, 'symbols') and self.model.symbols:
|
||||
symbol = self.model.symbols[0]
|
||||
else:
|
||||
symbol = 'ETH/USDT' # Default fallback
|
||||
else:
|
||||
# Unknown data type - use default symbol
|
||||
if hasattr(self.model, 'symbols') and self.model.symbols:
|
||||
symbol = self.model.symbols[0]
|
||||
else:
|
||||
symbol = 'ETH/USDT' # Default fallback
|
||||
|
||||
if not symbol:
|
||||
logger.warning(f"ExtremaTrainerInterface.predict could not determine symbol from data: {type(data)}")
|
||||
return None
|
||||
|
||||
features = self.model.get_context_features_for_model(symbol=data)
|
||||
features = self.model.get_context_features_for_model(symbol=symbol)
|
||||
if features is not None and features.size > 0:
|
||||
# The presence of features indicates a signal. We'll return a generic HOLD
|
||||
# with a neutral confidence. This can be refined if ExtremaTrainer provides
|
||||
|
Reference in New Issue
Block a user