diff --git a/pages/backtest_manager/app.py b/pages/backtest_manager/app.py index 4e6a217..583e0d6 100644 --- a/pages/backtest_manager/app.py +++ b/pages/backtest_manager/app.py @@ -3,7 +3,6 @@ import threading import webbrowser import streamlit as st -from pathlib import Path from streamlit_ace import st_ace import constants diff --git a/pages/bot_orchestration/app.py b/pages/bot_orchestration/app.py index 9b810ad..92920a7 100644 --- a/pages/bot_orchestration/app.py +++ b/pages/bot_orchestration/app.py @@ -2,27 +2,14 @@ import time import constants import pandas as pd import streamlit as st -from pathlib import Path from docker_manager import DockerManager from hbotrc import BotCommands -# Page metadata -title = "Bot Orchestration" -icon = "🐙" +from utils.st_utils import initialize_st_page -st.set_page_config( - page_title=title, - page_icon=icon, - layout="wide", -) -st.title(f"{icon} {title}") -# About this page -current_directory = Path(__file__).parent -readme_path = current_directory / "README.md" -with st.expander("About This Page"): - st.write(readme_path.read_text()) +initialize_st_page(title="Bot Orchestration", icon="🐙") # Start content here docker_manager = DockerManager() diff --git a/pages/candles_downloader/app.py b/pages/candles_downloader/app.py index ed8a731..ecc11cf 100644 --- a/pages/candles_downloader/app.py +++ b/pages/candles_downloader/app.py @@ -2,28 +2,15 @@ import time from subprocess import CalledProcessError import streamlit as st -from pathlib import Path import constants from utils import os_utils from docker_manager import DockerManager -# Page metadata -title = "Candles Downloader" -icon = "🗂️" +from utils.st_utils import initialize_st_page -st.set_page_config( - page_title=title, - page_icon=icon, - layout="wide", -) -st.title(f"{icon} {title}") -# About this page -current_directory = Path(__file__).parent -readme_path = current_directory / "README.md" -with st.expander("About This Page"): - st.write(readme_path.read_text()) +initialize_st_page(title="Candles Downloader", icon="🗂️") # Start content here docker_manager = DockerManager() diff --git a/pages/db_inspector/app.py b/pages/db_inspector/app.py index 4212e2d..bde870f 100644 --- a/pages/db_inspector/app.py +++ b/pages/db_inspector/app.py @@ -1,25 +1,12 @@ import streamlit as st -from pathlib import Path import sqlite3 import pandas as pd -# Page metadata -title = "DB Inspector" -icon = "🔍" +from utils.st_utils import initialize_st_page -st.set_page_config( - page_title=title, - page_icon=icon, - layout="wide", -) -st.title(f"{icon} {title}") -# About this page -current_directory = Path(__file__).parent -readme_path = current_directory / "README.md" -with st.expander("About This Page"): - st.write(readme_path.read_text()) +initialize_st_page(title="DB Inspector", icon="🔍") # Start content here @st.cache_data diff --git a/pages/reference_data/7_📋_Data.py b/pages/reference_data/7_📋_Data.py index 70786ba..c75547e 100644 --- a/pages/reference_data/7_📋_Data.py +++ b/pages/reference_data/7_📋_Data.py @@ -3,30 +3,30 @@ import streamlit as st import CONFIG from utils.coingecko_utils import CoinGeckoUtils from utils.miner_utils import MinerUtils +from utils.st_utils import initialize_st_page + @st.cache_data def get_all_coins_df(): return CoinGeckoUtils().get_all_coins_df() + @st.cache_data def get_all_exchanges_df(): return CoinGeckoUtils().get_all_exchanges_df() + @st.cache_data def get_miner_stats_df(): return MinerUtils().get_miner_stats_df() + @st.cache_data def get_coin_tickers_by_id_list(coins_id: list): return CoinGeckoUtils().get_coin_tickers_by_id_list(coins_id) -st.set_page_config( - page_title="Crypto Data", - page_icon=":bar_chart:", - layout="wide", - initial_sidebar_state="collapsed" -) -st.title("📋 Data Available") + +initialize_st_page(title="Crypto Data", icon=":bar_chart:") with st.spinner(text='In progress'): exchanges_df = get_all_exchanges_df() diff --git a/pages/strategy_performance/app.py b/pages/strategy_performance/app.py index 1d72a1a..629565a 100644 --- a/pages/strategy_performance/app.py +++ b/pages/strategy_performance/app.py @@ -1,27 +1,13 @@ import os import pandas as pd import streamlit as st -from pathlib import Path from utils.database_manager import DatabaseManager from utils.graphs import CandlesGraph +from utils.st_utils import initialize_st_page -# Page metadata -title = "Strategy Performance" -icon = "🚀" -st.set_page_config( - page_title=title, - page_icon=icon, - layout="wide", -) -st.title(f"{icon} {title}") - -# About this page -current_directory = Path(__file__).parent -readme_path = current_directory / "README.md" -with st.expander("About This Page"): - st.write(readme_path.read_text()) +initialize_st_page(title="Strategy Performance", icon="🚀") # Start content here intervals = { @@ -35,6 +21,7 @@ intervals = { "1d": 60 * 60 * 24, } + @st.cache_resource def get_database(db_name: str): db_manager = DatabaseManager(db_name) diff --git a/pages/token_spreads/app.py b/pages/token_spreads/app.py index 75fe1a1..1fa8eb0 100644 --- a/pages/token_spreads/app.py +++ b/pages/token_spreads/app.py @@ -1,27 +1,13 @@ -import pandas as pd import streamlit as st from pathlib import Path import plotly.express as px import CONFIG from utils.coingecko_utils import CoinGeckoUtils from utils.miner_utils import MinerUtils +from utils.st_utils import initialize_st_page -# Page metadata -title = "Token Spreads" -icon = "🧙" -st.set_page_config( - page_title=title, - page_icon=icon, - layout="wide", -) -st.title(f"{icon} {title}") - -# About this page -current_directory = Path(__file__).parent -readme_path = current_directory / "README.md" -with st.expander("About This Page"): - st.write(readme_path.read_text()) +initialize_st_page(title="Token Spreads", icon="🧙") # Start content here cg_utils = CoinGeckoUtils() diff --git a/pages/tvl_vs_mcap/app.py b/pages/tvl_vs_mcap/app.py index c8ed614..e553e46 100644 --- a/pages/tvl_vs_mcap/app.py +++ b/pages/tvl_vs_mcap/app.py @@ -1,26 +1,13 @@ import numpy as np import streamlit as st -from pathlib import Path import pandas as pd import plotly.express as px from defillama import DefiLlama -# Page metadata -title = "TVL vs Market Cap" -icon = "🦉" +from utils.st_utils import initialize_st_page -st.set_page_config( - page_title=title, - page_icon=icon, - layout="wide", -) -st.title(f"{icon} {title}") -# About this page -current_directory = Path(__file__).parent -readme_path = current_directory / "README.md" -with st.expander("About This Page"): - st.write(readme_path.read_text()) +initialize_st_page(title="TVL vs Market Cap", icon="🦉") # Start content here MIN_TVL = 1000000.