Live Stock ticker using Python

In this example we will be knowing that how to show live stock price using Python with various python packages.

Lets have an example

from yahoo_fin import stock_info
from tkinter import *


def stock_price():
    price = stock_info.get_live_price(e1.get())
    Current_stock.set(price)

master = Tk()
master.geometry('300x150')
master.title('Global Stock Price')
Current_stock = StringVar()

Label(master, text="Live Stock Price", font='sans 14', fg='yellow', bg='blue').grid(row=0, sticky=NSEW, columnspan=4)
Label(master, text="Company Symbol : ").grid(row=1, sticky=W)
Label(master, text="Stock Result:").grid(row=3, sticky=W)

result2 = Label(master, text="", textvariable=Current_stock).grid(row=3, column=1, sticky=W)

e1 = Entry(master)
e1.grid(row=1, column=1)

b = Button(master, text="Show", command=stock_price)
b.grid(row=1, column=2, columnspan=2, rowspan=2, padx=5, pady=5)

master.mainloop()

Here is output of the above program:

 

Share
Share
Scroll to Top