Build a Real-Time Market Pulse Dashboard in Streamlit
Summary
This tutorial details the construction of a real-time "market pulse" dashboard using Python and Streamlit, designed to provide immediate insights into market movements across stocks, forex, and crypto. The application integrates EODHD's WebSocket feeds to stream live price data, which is then processed by a background worker thread. This worker maintains rolling buffers, computes live metrics such as 1-minute, 5-minute, and 15-minute returns, 15-minute volatility, and trend, and identifies market regimes (normal/high_vol). The dashboard features a Pulse table ranking top movers, a Stress feed that emits event-style alerts for significant price or volatility thresholds, and a Correlation card showing top correlated stocks, adapting its lookback window based on volatility regimes. The architecture emphasizes separating the streaming and computation logic from the Streamlit UI to ensure stability and continuous operation.
Key takeaway
For software engineers building real-time financial applications, you should adopt a decoupled architecture where data streaming and heavy computation run in a background thread, separate from the UI. This approach prevents UI freezes and ensures continuous data processing, allowing your Streamlit dashboards to remain stable and responsive even with constant updates and user interactions. Consider implementing asset-aware thresholds and dynamic lookback windows for metrics to provide more relevant and less noisy insights.
Key insights
Separate streaming, state management, and UI logic for stable, real-time market dashboards.
Principles
- Reduce noise with event-style alerts.
- Adapt metrics to asset class characteristics.
- Align prices by time for meaningful correlation.
Method
Ingest real-time ticks via WebSockets, normalize data, maintain rolling buffers for metrics, detect stress events with cooldowns and asset-aware thresholds, and compute regime-aware correlations, all within a background worker that feeds a lightweight UI.
In practice
- Use `st.session_state` to guard background thread startup.
- Implement asset-specific thresholds for event detection.
- Bucket ticks into fixed time bins for correlation alignment.
Topics
- Streamlit Dashboard
- Real-time Market Data
- WebSocket Feeds
- Background Worker Architecture
- Financial Metrics
Best for: Software Engineer, Data Scientist, Data Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by HackerNoon.