mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-02-15 12:58:11 +00:00
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.
20 lines
432 B
Python
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()
|
|
|