You must have visited to check the stock prices of any company on Google and found a complete chart that represents the latest and the historical stock prices. You can also create such a real-time stock price data visualization system using Python where you will enter the name of a company and the stock prices data will be visualized as an output. So, in this article, I will take you through the task of real-time stock price data visualization using Python.
Real-time Stock Price Data Visualization using Python
To create a realtime stock price data visualization application, I will be using the streamlit library in Python. In this task, we can use the streamlit library to create an interactive user interface where a user will enter the name of any company and the stock price data will be visualized as the final output.
For the task of visualizing stock prices, we can use any data visualization library in Python compatible with the streamlit framework. But to keep it simple, I’ll be using the matplotlib library in Python. Now below is how you can create a real-time stock price data visualization application using Python:
Make sure that you run this Python code in an IDE or a code editor. To run your file just execute the streamlit run filename.py in your terminal. In the output, you will get to see a user interface as shown below.

Just write the name of any company in the user input. Make sure that you write the shortcut of the name of the company listed in the stock exchange. Below is how you will see your final result after clicking enter.

Summary
So this is how you can create a realtime stock price data visualization application using Python. You can use some more interactive tools provided by the streamlit framework to make your final application look more interactive. I hope you liked this article on the task of realtime stock price data visualization using Python.
Sir Your all articles are amazing roadmap to data science
thanks ♥️
Great post. Update August 2023, acordingly to this answer https://stackoverflow.com/questions/74832296/typeerror-string-indices-must-be-integers-when-getting-data-of-a-stock-from-y some change in the Yahoo side broke the compatibility with pandas_datareader. I changed the line number 16 and replaced with
data=yf.download(a, start=start_date, end=end_date)
Requires impor yfinance as yf and change date format to %Y-%m-%d
This worked for me.
Thanks again for this great post.