A real-time stock analytics system that streams stock data from Chartink, stores it in MongoDB, and visualizes it with Streamlit. Detects anomalies in stock prices using moving averages and provides both live and historical views.
- ⚡ Real-time streaming with Apache Kafka
- 🗃️ Persistent storage using MongoDB
- 📊 Interactive dashboard with Streamlit & Plotly
- 🧮 Anomaly detection via moving averages
- 🕒 View live or historical stock data
| Component | Purpose |
|---|---|
| Python | Core programming language |
| Apache Kafka | Real-time message streaming |
| MongoDB | NoSQL storage for historical stock data |
| Streamlit | Web-based visualization |
| Plotly | Interactive charts |
- Python 3.8+
- Kafka broker (local or Docker)
- MongoDB server running locally or in Docker
# Clone the repo
git clone https://github.com/your-username/real-time-stock-analytics.git
cd real-time-stock-analytics
# Install dependencies
pip install -r requirements.txt- Start Kafka & MongoDB
- Run Producer
python stock_producer.py- Run Consumer
python stock_consumer.py- Launch Dashboard
streamlit run app.pyOpen your browser at http://localhost:8501
real-time-stock-analytics/
│
├── stock_producer.py # Fetches data & sends to Kafka + MongoDB
├── stock_consumer.py # Consumes Kafka data & stores in MongoDB
├── app.py # Streamlit dashboard
├── requirements.txt # Dependencies
└── README.md # Documentation
- Live streaming of stock data every 60 seconds
- Automatic moving average calculations
- Anomalies highlighted in dashboard
- Interactive charts for trends & analysis