Skip to content

Commit

Permalink
Merge pull request #86 from hummingbot/feat/auth_system_configuration
Browse files Browse the repository at this point in the history
Feat/auth system configuration
  • Loading branch information
cardosofede committed Oct 23, 2023
2 parents 6918c8e + beee3c7 commit 9fa4774
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 182 deletions.
4 changes: 3 additions & 1 deletion CONFIG.py
Expand Up @@ -9,4 +9,6 @@
DEFAULT_MINER_COINS = ["Avalanche"]

CERTIFIED_EXCHANGES = ["ascendex", "binance", "bybit", "gate.io", "hitbtc", "huobi", "kucoin", "okx", "gateway"]
CERTIFIED_STRATEGIES = ["xemm", "cross exchange market making", "pmm", "pure market making"]
CERTIFIED_STRATEGIES = ["xemm", "cross exchange market making", "pmm", "pure market making"]

AUTH_SYSTEM_ENABLED = False
59 changes: 32 additions & 27 deletions main.py
Expand Up @@ -2,26 +2,11 @@
from st_pages import Page, Section, show_pages
from streamlit_authenticator import Authenticate

from CONFIG import AUTH_SYSTEM_ENABLED
from utils.os_utils import read_yaml_file, dump_dict_to_yaml


config = read_yaml_file("credentials.yml")

if "authenticator" not in st.session_state:
st.session_state.authenticator = Authenticate(
config['credentials'],
config['cookie']['name'],
config['cookie']['key'],
config['cookie']['expiry_days'],
config['preauthorized']
)

if st.session_state["authentication_status"]:
config["credentials"] = st.session_state.authenticator.credentials
dump_dict_to_yaml(config, "credentials.yml")
with st.sidebar:
st.write(f'Welcome {st.session_state["name"]}!')
st.session_state.authenticator.logout('Logout', 'sidebar')
def main_page():
show_pages(
[
Page("main.py", "Hummingbot Dashboard", "📊"),
Expand All @@ -30,11 +15,10 @@
Page("pages/bot_orchestration/app.py", "Instances", "🦅"),
Page("pages/file_manager/app.py", "File Explorer", "🗂"),
Section("Backtest Manager", "⚙️"),
Page("pages/candles_downloader/app.py", "Get Data", "💾"),
Page("pages/backtest_manager/create.py", "Create", "⚔️"),
Page("pages/backtest_manager/optimize.py", "Optimize", "🧪"),
Page("pages/backtest_manager/analyze.py", "Analyze", "🔬"),
# Page("pages/backtest_manager/simulate.py", "Simulate", "📈"),
Page("pages/backtest_get_data/app.py", "Get Data", "💾"),
Page("pages/backtest_create/create.py", "Create", "⚔️"),
Page("pages/backtest_optimize/optimize.py", "Optimize", "🧪"),
Page("pages/backtest_analyze/analyze.py", "Analyze", "🔬"),
Page("pages/launch_bot/app.py", "Deploy", "🙌"),
Section("Community Pages", "👨‍👩‍👧‍👦"),
Page("pages/strategy_performance/app.py", "Strategy Performance", "🚀"),
Expand All @@ -49,15 +33,16 @@
with readme_container:
st.markdown("# 📊 Hummingbot Dashboard")
st.markdown("""
Hummingbot Dashboard is an open source application that helps you create, backtest, and optimize various
types of algo trading strategies. Afterwards, you can deploy them as [Hummingbot](http://hummingbot.org)
instances in either paper or live trading mode.""")
Hummingbot Dashboard is an open source application that helps you create, backtest, and optimize various
types of algo trading strategies. Afterwards, you can deploy them as [Hummingbot](http://hummingbot.org)
instances in either paper or live trading mode.""")

st.write("---")

st.header("Getting Started")

st.write("Watch the [Hummingbot Dashboard Tutorial playlist](https://www.youtube.com/watch?v=a-kenMqRB00) to get started!")
st.write(
"Watch the [Hummingbot Dashboard Tutorial playlist](https://www.youtube.com/watch?v=a-kenMqRB00) to get started!")

# Container for the videos
container = st.container()
Expand Down Expand Up @@ -106,6 +91,27 @@
st.write(
"If you encounter any bugs or have suggestions for improvement, please create an issue in the [Hummingbot Dashboard Github](https://github.com/hummingbot/dashboard).")


config = read_yaml_file("credentials.yml")

if "authenticator" not in st.session_state:
st.session_state.authenticator = Authenticate(
config['credentials'],
config['cookie']['name'],
config['cookie']['key'],
config['cookie']['expiry_days'],
config['preauthorized']
)

if not AUTH_SYSTEM_ENABLED:
main_page()
elif st.session_state["authentication_status"]:
config["credentials"] = st.session_state.authenticator.credentials
dump_dict_to_yaml(config, "credentials.yml")
with st.sidebar:
st.write(f'Welcome {st.session_state["name"]}!')
st.session_state.authenticator.logout('Logout', 'sidebar')
main_page()
else:
show_pages([
Page("main.py", "Hummingbot Dashboard", "📊"),
Expand All @@ -118,4 +124,3 @@
st.write("---")
st.write("If you are pre-authorized, you can login with your pre-authorized mail!")
st.session_state.authenticator.register_user('Register', 'main')

File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions pages/backtest_create/README.md
@@ -0,0 +1 @@
Deploy and manage backtests of directional strategies
File renamed without changes.
File renamed without changes.
Expand Up @@ -52,15 +52,15 @@
active_containers = docker_manager.get_active_containers()
c1, c2 = st.columns([0.9, 0.1])
with c1:
if "candles_downloader" in active_containers:
if "backtest_get_data" in active_containers:
st.success("Hummingbot Candles Downloader is running")
st.write("Exited Containers:")
st.warning(docker_manager.get_exited_containers())
with c2:
if "candles_downloader" in active_containers:
if "backtest_get_data" in active_containers:
stop_containers_button = st.button("Stop Candles Downloader")
if stop_containers_button:
docker_manager.stop_container("candles_downloader")
docker_manager.stop_container("backtest_get_data")
clean_exited_containers_button = st.button("Clean Containers")
if clean_exited_containers_button:
docker_manager.clean_exited_containers()
Expand Down
151 changes: 0 additions & 151 deletions pages/backtest_manager/simulate.py

This file was deleted.

1 change: 1 addition & 0 deletions pages/backtest_optimize/README.md
@@ -0,0 +1 @@
Deploy and manage backtests of directional strategies
File renamed without changes.

0 comments on commit 9fa4774

Please sign in to comment.