Giter Site home page Giter Site logo

shikha-code36 / real-time-stock-price-tracker-using-kafka Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 8 KB

A real time stock prices tracker using Kafka

License: MIT License

Python 83.18% HTML 16.82%
confluent-kafka consumer kafka kafka-consumer kafka-producer kafka-producer-consumer kafka-streams producer producer-consumer python

real-time-stock-price-tracker-using-kafka's Introduction

Real-Time Stock Price Monitoring Using Kafka

This project is a real-time stock price monitoring web application built with Flask, Kafka, and Plotly. It allows users to track real-time and historical stock prices of selected companies.

Table of Contents

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Python 3.7 or higher installed on your system.
  • Access to a Confluent Cloud Kafka cluster.
  • Confluent Kafka Python library installed (included in requirements.txt).
  • A valid API key and secret for accessing the Confluent Cloud Kafka cluster.

Getting Started

To get this project up and running on your local machine, follow these steps:

1. Clone the Repository

git clone https://github.com/Shikha-code36/Real-Time-Stock-Price-Tracker-using-Kafka.git
cd Real-Time-Stock-Price-Tracker-using-Kafka

2. Set Up a Virtual Environment

It's a good practice to create a virtual environment to isolate project dependencies. Run the following commands to create and activate a virtual environment:

python -m venv venv
venv\Scripts\activate # On Windows
source ./venv/bin/activate # On Linux & Mac OS X

3. Install Dependencies

Use pip to install the project's dependencies from the requirements.txt file:

pip install -r requirements.txt

4. Configure the Project

Edit the config.py file and provide the following details:

  • KAFKA_BOOTSTRAP_SERVERS: The Confluent Cloud
  • Kafka cluster's bootstrap servers.
  • KAFKA_TOPIC: The Kafka topic where stock prices will be published and consumed.
  • API_KEY: Your Confluent Cloud API key.
  • API_SECRET: Your Confluent Cloud API secret.

5. Run the Application

Start the Flask web application by running the following command:

python main.py

The app should now be available at http://localhost:5000/.

Usage

  • Visit http://localhost:5000 to access the main dashboard.
  • You can start and stop data production and consumption by clicking the respective buttons.
  • Real-time and historical stock price charts will be displayed on the dashboard.

Project Structure

The project is organized as follows:

  • producer.py: Handles fetching real-time stock prices and publishing them to Kafka.
  • consumer.py: Consumes stock price data from Kafka and places it in a queue for the main thread.
  • main.py: The main Flask application that serves the web interface.
  • config.py: Configuration file for Kafka and API credentials.
  • templates/: Contains HTML templates for the web pages.

Configuration

In the config.py file, you can configure the following settings:

  • KAFKA_BOOTSTRAP_SERVERS: The Kafka bootstrap servers.
  • KAFKA_TOPIC: The Kafka topic for stock price data.
  • API_KEY: Your Confluent Cloud API key.
  • API_SECRET: Your Confluent Cloud API secret.

License

This project is licensed under the MIT License. See the LICENSE file for details.

real-time-stock-price-tracker-using-kafka's People

Contributors

shikha-code36 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

myrfa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.