From 1cbe598691592b043320d13e5bbef64489566817 Mon Sep 17 00:00:00 2001 From: kingakshat Date: Wed, 19 Apr 2023 14:50:33 +0530 Subject: [PATCH] script for stock visualiser added --- scripts/STOCK VISUALISER/script.py | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 scripts/STOCK VISUALISER/script.py diff --git a/scripts/STOCK VISUALISER/script.py b/scripts/STOCK VISUALISER/script.py new file mode 100644 index 0000000..746a613 --- /dev/null +++ b/scripts/STOCK VISUALISER/script.py @@ -0,0 +1,49 @@ +# # import required packages + +import yfinance as yf +import mplfinance as mpf +import matplotlib.pyplot as plt +import pandas as pd +import tkinter as tk +import tkcalendar + +# Top level window +frame = tk.Tk() +frame.title("TextBox Input") +frame.geometry('500x250') + +def printInput(): + + # getting Stock Data + msft = yf.Ticker(inputtxt.get(1.0)) + a = msft.history(start=start_date.get_date(), end=end_date.get_date()) + + # ploting graph + mpf.plot(a, type='candle', volume=True, title = inputtxt.get(1.0)) + +# TextBox Creation +inputtxt = tk.Text(frame, + height = 2, + width = 25 + ) +inputtxt.pack() + + +start_date = tkcalendar.DateEntry(frame, text = "Start Date") +start_date.pack(padx=10,pady=10) + +end_date = tkcalendar.DateEntry(frame, text = "End Date") +end_date.pack(padx=10,pady=10) + + + +# Button Creation +printButton = tk.Button(frame, + text = "Print", + command = printInput) +printButton.pack() + +# Label Creation +lbl = tk.Label(frame, text = "") +lbl.pack() +frame.mainloop() \ No newline at end of file