INNER CODE UNIT · Python

api_stream

marc-shade/world-intel-mcp · src/world_intel_mcp/dashboard/app.py:328

async def api_stream(request):
    """SSE endpoint — progressive: emits each source as it completes."""

    async def event_generator():
        while True:
            try:
                fetcher = _ensure_fetcher()

                # Sources to fetch, grouped so fast ones arrive first
                source_defs = {
                    "market_quotes": lambda: markets.fetch_market_quotes(fetcher),
                    "crypto_quotes": lambda: markets.fetch_crypto_quotes(fetcher),
                    "macro_signals": lambda: markets.fetch_macro_signals(fetcher),
                    "sector_heatmap": lambda: markets.fetch_sector_heatmap(fetcher),
                    "earthquakes": lambda: seismology.fetch_earthquakes(fetcher),
                    "military_flights": lambda: military.fetch_military_flights(
                        fetcher
                    ),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…