How to Integrate Yahoo Finance with Python TKinter

In this Python TKinter article we want to learn How to Integrate Yahoo Finance with Python TKinter, Yahoo Finance API is an excellent source of financial data that provides real time and historical market data for stocks, currencies, commodities and many more. It is used by traders, investors and researchers worldwide to access financial data programmatically. in this article we want to learn how to use Yahoo Finance API with Python TKinter. so Tkinter is  popular Python GUI toolkit.                           

 

 

 

How to Integrate Yahoo Finance with Python TKinter

TKinter is already installed with Python, but we need to install Yahoo Finance API.

 

 

This is the complete code for this article

This code creates Tkinter window with label to display the stock price. after that we have defined a function get_stock_price() that retrieves the stock price using yf.Ticker() method from yfinance library and updates the label with new price. this function is scheduled to run every 5 seconds using root.after() method. and lastly the function is called to start retrieving and displaying the stock price.

Note that in this example, we are using yf.Ticker() method to retrieve the stock price for Apple Inc. (AAPL). you can change this to any other stock symbol to retrieve prices for different stock.

 

 

Run the complete code and this will be the result

How to Integrate Yahoo Finance with Python TKinter
How to Integrate Yahoo Finance with Python TKinter

 

 

Learn More on Python GUI

Leave a Comment