Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a Stock Visualizer #481

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 56 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Noor Ahmed</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Khushi260">
<img src="https://avatars.githubusercontent.com/u/94845508?v=4" width="100;" alt="Khushi260"/>
<br />
<sub><b>Khushi Jha</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/muratonuryildirim">
<img src="https://avatars.githubusercontent.com/u/77264793?v=4" width="100;" alt="muratonuryildirim"/>
Expand All @@ -122,21 +129,14 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Vallabh Chugh</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/Abbhiishek">
<img src="https://avatars.githubusercontent.com/u/86338762?v=4" width="100;" alt="Abbhiishek"/>
<br />
<sub><b>Abhishek Kushwaha</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/Khushi260">
<img src="https://avatars.githubusercontent.com/u/94845508?v=4" width="100;" alt="Khushi260"/>
<br />
<sub><b>Khushi Jha</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/yunghog">
Expand Down Expand Up @@ -339,13 +339,20 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
</a>
</td>
<td align="center">
<a href="https://github.com/tolgakurtuluss">
<img src="https://avatars.githubusercontent.com/u/22731161?v=4" width="100;" alt="tolgakurtuluss"/>
<a href="https://github.com/smeax">
<img src="https://avatars.githubusercontent.com/u/114774652?v=4" width="100;" alt="smeax"/>
<br />
<sub><b>Null</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/tolgakurtuluss">
<img src="https://avatars.githubusercontent.com/u/22731161?v=4" width="100;" alt="tolgakurtuluss"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/srinjoy-26">
<img src="https://avatars.githubusercontent.com/u/91176055?v=4" width="100;" alt="srinjoy-26"/>
Expand Down Expand Up @@ -380,15 +387,22 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Aditya Tiwari</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/Asmita-Dutta">
<img src="https://avatars.githubusercontent.com/u/100194878?v=4" width="100;" alt="Asmita-Dutta"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/BassCoder2808">
<img src="https://avatars.githubusercontent.com/u/65075935?v=4" width="100;" alt="BassCoder2808"/>
<br />
<sub><b>Vedant Jolly</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/Hemant2801">
<img src="https://avatars.githubusercontent.com/u/87967889?v=4" width="100;" alt="Hemant2801"/>
Expand Down Expand Up @@ -416,7 +430,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Parinthapat P.</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/iamrahul8">
<img src="https://avatars.githubusercontent.com/u/72541381?v=4" width="100;" alt="iamrahul8"/>
Expand All @@ -430,8 +445,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Riya Roy</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/royninja">
<img src="https://avatars.githubusercontent.com/u/26019882?v=4" width="100;" alt="royninja"/>
Expand Down Expand Up @@ -459,7 +473,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Yash Indane</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/ambushneupane">
<img src="https://avatars.githubusercontent.com/u/56769633?v=4" width="100;" alt="ambushneupane"/>
Expand All @@ -473,8 +488,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Aswin Shailajan</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/jrafaaael">
<img src="https://avatars.githubusercontent.com/u/70046023?v=4" width="100;" alt="jrafaaael"/>
Expand Down Expand Up @@ -502,7 +516,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Aiman Aisha</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/akashJainAJ11">
<img src="https://avatars.githubusercontent.com/u/94193834?v=4" width="100;" alt="akashJainAJ11"/>
Expand All @@ -516,8 +531,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Arijit Ghosh</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/Yaswanth820">
<img src="https://avatars.githubusercontent.com/u/55750562?v=4" width="100;" alt="Yaswanth820"/>
Expand Down Expand Up @@ -545,7 +559,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Heshanthaka</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/Gokul-Ks">
<img src="https://avatars.githubusercontent.com/u/73174047?v=4" width="100;" alt="Gokul-Ks"/>
Expand All @@ -559,8 +574,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>KUMAR SANTOSH</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/Manice18">
<img src="https://avatars.githubusercontent.com/u/91601706?v=4" width="100;" alt="Manice18"/>
Expand Down Expand Up @@ -588,7 +602,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Raj Saha </b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/ramonsaraiva">
<img src="https://avatars.githubusercontent.com/u/5559120?v=4" width="100;" alt="ramonsaraiva"/>
Expand All @@ -602,8 +617,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Riya Jaiswal</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/sarthakroy2002">
<img src="https://avatars.githubusercontent.com/u/47187468?v=4" width="100;" alt="sarthakroy2002"/>
Expand Down Expand Up @@ -631,7 +645,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Anjali Chauhan</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/anshrusia200">
<img src="https://avatars.githubusercontent.com/u/85791796?v=4" width="100;" alt="anshrusia200"/>
Expand All @@ -645,8 +660,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Arpit Bhardwaj</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/artemis-i-guess">
<img src="https://avatars.githubusercontent.com/u/65388018?v=4" width="100;" alt="artemis-i-guess"/>
Expand Down Expand Up @@ -674,6 +688,14 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Yash Nilesh Brid</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/mclmza">
<img src="https://avatars.githubusercontent.com/u/7353871?v=4" width="100;" alt="mclmza"/>
<br />
<sub><b>Michele Mazza</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/mer747">
Expand All @@ -688,8 +710,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Mubeen Ahmad</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/neocollege">
<img src="https://avatars.githubusercontent.com/u/86466839?v=4" width="100;" alt="neocollege"/>
Expand All @@ -710,7 +731,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Sameer Sahu</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/shatanikmahanty">
<img src="https://avatars.githubusercontent.com/u/67138059?v=4" width="100;" alt="shatanikmahanty"/>
Expand Down
10 changes: 10 additions & 0 deletions scripts/StockVisualizer/README.md
Original file line number Diff line number Diff line change
@@ -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
![](assets/input.png)
### Output Graph Generated
![](assets/output.png)
Binary file added scripts/StockVisualizer/assets/input.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added scripts/StockVisualizer/assets/output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions scripts/StockVisualizer/stock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import pandas as pd
import yfinance as yf
import matplotlib.pyplot as plt

def get_df(ticker, start_date, end_date):
stock = yf.Ticker(ticker)
df = stock.history(start=start_date, end=end_date)
return df

def plot(df, ticker):
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()

def user_input():
ticker = input('Stock Symbol: ')
start_date = input('Start Date (YYYY-MM-DD): ')
end_date = input('End Date (YYYY-MM-DD): ')
return ticker, start_date, end_date

def stock_visualizer():
ticker, start_date, end_date = user_input()
df = get_df(ticker, start_date, end_date)
plot(df, ticker)





18 changes: 18 additions & 0 deletions scripts/StockVisualizer/tests/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import yfinance as yf
from stock import (
get_df,
plot,
user_input,
stock_visualizer
)

def test_df():
stock = yf.Ticker("MSFT")
assert (get_df(stock, "2023-01-01", "2023-02-01") != None)

def test_plot():
stock = yf.Ticker("MSFT")
df = get_df(stock, "2023-01-01", "2023-02-01")
assert(plot(df, stock) != None)


Loading