This commit is contained in:
Dobromir Popov
2025-10-22 17:48:44 +03:00
parent 68b91f37bd
commit f456b2747e
5 changed files with 127 additions and 7 deletions

View File

@@ -116,6 +116,11 @@ class AnnotationDashboard:
# Initialize core components
self.data_provider = DataProvider() if DataProvider else None
# Enable unified storage for real-time data access
if self.data_provider:
self._enable_unified_storage_async()
self.orchestrator = TradingOrchestrator(
data_provider=self.data_provider
) if TradingOrchestrator and self.data_provider else None
@@ -133,6 +138,42 @@ class AnnotationDashboard:
logger.info("Annotation Dashboard initialized")
def _enable_unified_storage_async(self):
"""Enable unified storage system in background thread"""
def enable_storage():
try:
import asyncio
import threading
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
# Enable unified storage
success = loop.run_until_complete(
self.data_provider.enable_unified_storage()
)
if success:
logger.info("✅ ANNOTATE: Unified storage enabled for real-time data")
# Get statistics
stats = self.data_provider.get_unified_storage_stats()
if stats.get('initialized'):
logger.info(" Real-time data access: <10ms")
logger.info(" Historical data access: <100ms")
logger.info(" Annotation data: Available at any timestamp")
else:
logger.warning("⚠️ ANNOTATE: Unified storage not available, using cached data only")
except Exception as e:
logger.warning(f"ANNOTATE: Could not enable unified storage: {e}")
logger.info("ANNOTATE: Continuing with cached data access")
# Start in background thread
import threading
storage_thread = threading.Thread(target=enable_storage, daemon=True)
storage_thread.start()
def _setup_routes(self):
"""Setup Flask routes"""