data stream working
This commit is contained in:
@@ -2303,4 +2303,39 @@ class TradingOrchestrator:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return summary
|
||||
return summary
|
||||
|
||||
def get_cob_data(self, symbol: str, limit: int = 300) -> List:
|
||||
"""Get COB data for a symbol with specified limit."""
|
||||
try:
|
||||
if hasattr(self, 'cob_integration') and self.cob_integration:
|
||||
return self.cob_integration.get_cob_history(symbol, limit)
|
||||
return []
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting COB data: {e}")
|
||||
return []
|
||||
|
||||
def get_ohlcv_data(self, symbol: str, timeframe: str, limit: int = 300) -> List:
|
||||
"""Get OHLCV data for a symbol with specified timeframe and limit."""
|
||||
try:
|
||||
ohlcv_df = self.data_provider.get_ohlcv(symbol, timeframe, limit=limit)
|
||||
if ohlcv_df is None or ohlcv_df.empty:
|
||||
return []
|
||||
|
||||
# Convert to list of dictionaries
|
||||
result = []
|
||||
for _, row in ohlcv_df.iterrows():
|
||||
data_point = {
|
||||
'timestamp': row.name.isoformat() if hasattr(row.name, 'isoformat') else str(row.name),
|
||||
'open': float(row['open']),
|
||||
'high': float(row['high']),
|
||||
'low': float(row['low']),
|
||||
'close': float(row['close']),
|
||||
'volume': float(row['volume'])
|
||||
}
|
||||
result.append(data_point)
|
||||
|
||||
return result
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting OHLCV data: {e}")
|
||||
return []
|
Reference in New Issue
Block a user