mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-03-13 17:19:50 +00:00
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.
This commit is contained in:
parent
5c6431d000
commit
05bd8134f2
10
scripts/StockVisualizer/README.md
Normal file
10
scripts/StockVisualizer/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Stock Visualizer
|
||||
|
||||
## About
|
||||
A stock visualizer, that uses the Yahoo Finance library to create a customizable graph for the user to see.
|
||||
It will ask the user for input, specifically for the stock symbol, and the start and end dates in the form (YYYY-MM-DD).
|
||||
Then, it will output a graph with those specifications.
|
||||
### Input Queried from User
|
||||

|
||||
### Output Graph Generated
|
||||

|
BIN
scripts/StockVisualizer/assets/input.png
Normal file
BIN
scripts/StockVisualizer/assets/input.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
BIN
scripts/StockVisualizer/assets/output.png
Normal file
BIN
scripts/StockVisualizer/assets/output.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 MiB |
19
scripts/StockVisualizer/stock.py
Normal file
19
scripts/StockVisualizer/stock.py
Normal file
@ -0,0 +1,19 @@
|
||||
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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user