Skip to content

Commit

Permalink
(feat) refactor all pages
Browse files Browse the repository at this point in the history
  • Loading branch information
cardosofede committed Jul 24, 2023
1 parent a3ff2bf commit 9a1df4e
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 104 deletions.
1 change: 0 additions & 1 deletion pages/backtest_manager/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import webbrowser

import streamlit as st
from pathlib import Path
from streamlit_ace import st_ace

import constants
Expand Down
21 changes: 4 additions & 17 deletions pages/bot_orchestration/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,14 @@
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 = "🐙"

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())
from utils.st_utils import initialize_st_page


initialize_st_page(title="Bot Orchestration", icon="🐙")

# Start content here
docker_manager = DockerManager()
Expand Down
17 changes: 2 additions & 15 deletions pages/candles_downloader/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,15 @@
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()
Expand Down
21 changes: 4 additions & 17 deletions pages/db_inspector/app.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
import streamlit as st
from pathlib import Path

import sqlite3
import pandas as pd

# Page metadata
title = "DB Inspector"
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())
from utils.st_utils import initialize_st_page


initialize_st_page(title="DB Inspector", icon="🔍")

# Start content here
@st.cache_data
Expand Down
14 changes: 7 additions & 7 deletions pages/reference_data/7_📋_Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@
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()
Expand Down
19 changes: 3 additions & 16 deletions pages/strategy_performance/app.py
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -35,6 +21,7 @@
"1d": 60 * 60 * 24,
}


@st.cache_resource
def get_database(db_name: str):
db_manager = DatabaseManager(db_name)
Expand Down
18 changes: 2 additions & 16 deletions pages/token_spreads/app.py
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
17 changes: 2 additions & 15 deletions pages/tvl_vs_mcap/app.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit 9a1df4e

Please sign in to comment.