(feat) refactor all pages

This commit is contained in:
cardosofede
2023-07-24 17:29:21 +02:00
parent a3ff2bf0ed
commit 9a1df4ec31
8 changed files with 20 additions and 100 deletions

View File

@@ -3,7 +3,6 @@ import threading
import webbrowser
import streamlit as st
from pathlib import Path
from streamlit_ace import st_ace
import constants

View File

@@ -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()

View File

@@ -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()

View File

@@ -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

View File

@@ -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()

View File

@@ -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)

View File

@@ -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()

View File

@@ -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.