python-scripts/scripts/StockVisualizer/stock.py
William Wang 05bd8134f2 stock
Create README.md

sc

Update README.md

Added the stock.py which will perform the stock visualization, as well as the README.md along with the screenshot files.
2023-05-06 22:54:55 -04:00

20 lines
432 B
Python

import pandas as pd
import yfinance as yf
import matplotlib.pyplot as plt
ticker = input('Stock Symbol: ')
start_date = input('Start Date (YYYY-MM-DD): ')
end_date = input('End Date (YYYY-MM-DD): ')
stock = yf.Ticker(ticker)
df = stock.history(start=start_date, end=end_date)
plt.figure(figsize=(14, 8))
plt.plot(df['Close'])
plt.title(f'{ticker} Stock Price')
plt.xlabel('Date')
plt.ylabel('Price (USD)')
plt.grid()
plt.show()