Skip to content

Commit

Permalink
Update dashboard design, adding in video and updating texts
Browse files Browse the repository at this point in the history
  • Loading branch information
JerBouma committed Jun 30, 2024
1 parent 8349169 commit f66bd1d
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 33 deletions.
32 changes: 32 additions & 0 deletions app/helpers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
"""Helpers Module"""

import streamlit as st

from financetoolkit import helpers


def check_api_key_status(api_key: str):
"""
Check the status of an API key.
Args:
api_key (str): The API key to check.
Returns:
Tuple[bool, bool, str]: A tuple containing the following values:
- invalid_api_key (bool): True if the API key is invalid, False otherwise.
- premium_plan (bool): True if the API key is associated with a premium plan, False otherwise.
- reason (str): The reason for the status of the API key. None if the API key is valid and associated
with a premium plan.
"""
determine_plan = helpers.get_financial_data(
url=f"https://financialmodelingprep.com/api/v3/income-statement/AAPL?period=quarter&apikey={api_key}",
sleep_timer=False,
Expand All @@ -25,3 +43,17 @@ def check_api_key_status(api_key: str):
reason = "API Key Limit Reached."

return invalid_api_key, premium_plan, reason


def load_css(file_name):
"""
Loads and applies custom CSS styles from a file.
Args:
file_name (str): The name of the CSS file to load.
Returns:
Markdown object from Streamlit.
"""
with open(file_name) as f:
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
13 changes: 12 additions & 1 deletion app/socials_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@


def create_socials_sidebar():
"""
Creates a sidebar with social media links and additional information.
This function adds a divider and displays social media badges with links to GitHub, Twitter, LinkedIn,
GitHub Sponsors, and Buy Me a Coffee. It also includes additional information about the Finance Toolkit
and provides a link to open a ticket for sharing thoughts or issues.
Returns:
Divided and Markdown objects from Streamlit.
"""
st.divider()
st.markdown(
unsafe_allow_html=True,
Expand All @@ -14,6 +24,7 @@ def create_socials_sidebar():
[![GitHub Sponsors](https://img.shields.io/badge/Sponsor_this_Project-grey?logo=github)](https://github.com/sponsors/JerBouma)
[![Buy Me a Coffee](https://img.shields.io/badge/Buy_Me_a_Coffee-grey?logo=buymeacoffee)](https://www.buymeacoffee.com/jerbouma)
\n\n The Finance Toolkit is written and maintained by [Jeroen Bouma](https://www.jeroenbouma.com)
\n\n The Finance Toolkit is written and maintained by [Jeroen Bouma](https://www.jeroenbouma.com).
Like to share your thoughts? Please open a ticket [here](https://github.com/JerBouma/FinanceToolkit/issues/new/choose).
""",
)
74 changes: 43 additions & 31 deletions dashboard.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Dashboard Module"""

import streamlit as st

from app import initalization_model, metrics_view, socials_model
from app import helpers, initalization_model, metrics_view, socials_model

st.set_page_config(
page_title="Finance Toolkit in Streamlit", page_icon="📈", layout="wide"
page_title="Finance Toolkit Dashboard", page_icon="🛠️", layout="wide"
)


Expand All @@ -13,43 +15,53 @@
st.session_state["is_expanded"] = True

if st.session_state["invalid_api_key"]:
st.session_state["welcome_msg"].markdown(
helpers.load_css("app/assets/style.css")

st.markdown(
"""
""",
unsafe_allow_html=True,
)

st.session_state["welcome_msg"].markdown(
body="""
## Welcome to the Finance Toolkit dashboard! 👋
While browsing a variety of websites, I repeatedly observed significant fluctuations in the same financial metric
among different sources.
Similarly, the reported financial statements often didn't line up, and there was limited information on the
methodology used to calculate each metric.
For example, Microsoft's Price-to-Earnings (PE) ratio on the 6th of May, 2023 is reported to
be 28.93 (Stockopedia), 32.05 (Morningstar),
32.66 (Macrotrends), 33.09 (Finance Charts), 33.66 (Y Charts), 33.67 (Wall Street Journal), 33.80
(Yahoo Finance) and 34.4 (Companies Market Cap). All of these calculations are correct, however the
method of calculation varies leading to different results. Therefore, collecting data from multiple
sources can lead to wrong interpretation of the results given that one source could apply a different
definition than another. And that is, if that definition is even available as often the underlying
methods are hidden behind a paid subscription.
**This is why I designed the Finance Toolkit**, this is an open-source toolkit in which all relevant financial
ratios 200+ indicators
and performance measurements are written down in the most simplistic way allowing for complete transparency
of the method of calculation.
This dashboard is powered entirely by the Finance Toolkit and gves access to all relevant financial ratios,
indicators and performance measurements. Key features of the dashboard are:
- Compare a small or large selection of tickers for any period (10+ years for Premium users, max 5 years for
This dashboard is powered by the Finance Toolkit, an open-source toolkit in which 200+ relevant financial ratios,
indicators and performance measurements are written down in the most simplistic way allowing for complete
transparency of the method of calculation. Once you've entered you're API key you are ready to go!
The key features of this dashboard are as follows:
- 🏢 Compare a small or large selection of tickers for any period (10+ years for Premium users, max 5 years for
Free users).
- Plot any item from the Financial Statements (Balance Sheet, Income Statement, Cash Flow Statement).
- Compare a large selection of financial ratios, technical indicators, performance metrics and risk metrics.
- Show quarterly results, growth rates, trailing twelve months (TTM) as well as tables (with download
to CSV option)
- 📃 Plot any item from the Financial Statements, e.g. Shareholder's Equity from the Balance Sheet, Revenue from
the Income Statement and Operating Cash Flow from the Cash Flow Statement.
- 💸 Compare 150+ financial ratios, technical indicators, performance metrics and risk metrics.
- 📈 Show quarterly results, growth rates, trailing twelve months (TTM) as well as tables (with the option
to download the data)
Once you've entered you're API key you are ready to go!
Find below a demonstration of what is possible once you have entered your API key.
"""
)

st.video(
"app/assets/financetoolkit-dashboard.mov",
autoplay=True,
muted=True,
start_time=3,
end_time=66,
)

st.markdown(
"""
<div class="mobile-only"><h3>📱 Mobile Users</h3><b>Given that you are viewing this page on mobile,
please open the sidebar (arrow in the top left) to get started! Once you've entered your API key it
should automatically proceed.</b></div>
""",
unsafe_allow_html=True,
)

st.session_state = initalization_model.create_api_key_sidebar(st.session_state)


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ ignore-words-list = 'te,hsi,amplitud,nam,tha,plaform'
skip = '*.json,./.git,pyproject.toml,poetry.lock,examples'

[tool.mypy]
disable_error_code = "misc"
disable_error_code = "misc, valid-type, attr-defined, index"

[tool.pytest.ini_options]
filterwarnings = [
Expand Down

0 comments on commit f66bd1d

Please sign in to comment.