Files
robinhood/backend/app/streaming/bootstrap.py
T
Krikorios 48e60d015f feat: Add Phase 4 advanced metrics and components
- Add advanced metrics dashboard with trade analytics
- Add new trading components (EntryTypeAnalysis, MultiDayPositionTracker, NewsEventTracker, etc.)
- Add strategy mode selector and trend confirmation
- Add risk automation panel and slippage correlation analysis
- Add daily trading plan enhancements with modal components
- Add custom hooks (useApi, useLocalStorage, useAdvancedTradeMetrics)
- Add broker service integration and trading API
- Add test setup and vitest configuration
- Include parquet data files for live market data
- Add comprehensive documentation in docs/ folder
2025-11-27 10:23:58 +02:00

30 lines
933 B
Python

from __future__ import annotations
import asyncio
from typing import Iterable, Awaitable
from app.config import settings
from app.streaming.binance_hub import hub as binance_hub
from app.streaming.data_provider import data_provider
async def bootstrap_streams() -> None:
"""Ensure configured streams are hot even before clients connect."""
if not settings.STREAM_AUTO_BOOTSTRAP:
return
symbols: Iterable[str] = settings.STREAM_WARM_SYMBOLS or []
timeframe = settings.STREAM_WARM_TIMEFRAME or "1m"
coros: list[Awaitable[None]] = []
for raw in symbols:
sym = (raw or "").strip()
if not sym:
continue
if sym.upper().startswith("XAU"):
coros.append(data_provider.ensure_stream(sym, timeframe))
else:
coros.append(binance_hub.ensure_stream(sym, timeframe))
if coros:
await asyncio.gather(*coros, return_exceptions=True)