device tensor fix
This commit is contained in:
@ -449,5 +449,37 @@ class StandardizedDataProvider(DataProvider):
|
||||
|
||||
logger.info("Stopped real-time processing for standardized data")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error stopping real-time processing: {e}")
|
||||
|
||||
def get_recent_prices(self, symbol: str, limit: int = 10) -> List[float]:
|
||||
"""
|
||||
Get recent prices for a symbol
|
||||
|
||||
Args:
|
||||
symbol: Trading symbol
|
||||
limit: Number of recent prices to return
|
||||
|
||||
Returns:
|
||||
List[float]: List of recent prices
|
||||
"""
|
||||
try:
|
||||
# Get recent OHLCV data using parent class method
|
||||
df = self.get_historical_data(symbol, '1m', limit)
|
||||
if df is None or df.empty:
|
||||
return []
|
||||
|
||||
# Extract close prices from DataFrame
|
||||
if 'close' in df.columns:
|
||||
prices = df['close'].tolist()
|
||||
return prices[-limit:] # Return most recent prices
|
||||
else:
|
||||
logger.warning(f"No 'close' column found in OHLCV data for {symbol}")
|
||||
return []
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting recent prices for {symbol}: {e}")
|
||||
return []
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error stopping real-time processing: {e}")
|
Reference in New Issue
Block a user