Skip to content

Commit

Permalink
(feat) styling changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fengtality committed Aug 23, 2023
1 parent 5c336b4 commit 3169496
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 63 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,7 @@ dmypy.json

# Optimize studies and strategies
quants_lab/optimizations/*
quants_lab/strategy/experiments/*
quants_lab/strategy/experiments/*

# Master bot template user-added configs
hummingbot_files/templates/master_bot_conf/conf/*
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,15 @@ polkadex_taker_percent_fee:
polkadex_buy_percent_fee_deducted_from_returns:
polkadex_maker_fixed_fees:
polkadex_taker_fixed_fees:
vertex_percent_fee_token:
vertex_maker_percent_fee:
vertex_taker_percent_fee:
vertex_buy_percent_fee_deducted_from_returns:
vertex_maker_fixed_fees:
vertex_taker_fixed_fees:
vertex_testnet_percent_fee_token:
vertex_testnet_maker_percent_fee:
vertex_testnet_taker_percent_fee:
vertex_testnet_buy_percent_fee_deducted_from_returns:
vertex_testnet_maker_fixed_fees:
vertex_testnet_taker_fixed_fees:
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
[
Page("main.py", "Hummingbot Dashboard", "📊"),
Section("Bot Orchestration", "🐙"),
Page("pages/master_conf/app.py", "Master Conf", "🗝️"),
Page("pages/bot_orchestration/app.py", "Bots Manager", "🦅"),
Page("pages/file_manager/app.py", "File Manager", "🗂"),
Page("pages/master_conf/app.py", "Credentials", "🗝️"),
Page("pages/bot_orchestration/app.py", "Instances", "🦅"),
Page("pages/file_manager/app.py", "Strategy Configs", "🗂"),
Section("Backtest Manager", "⚙️"),
Page("pages/candles_downloader/app.py", "Get Data", "💾"),
Page("pages/backtest_manager/create.py", "Create", "⚔️"),
Expand Down
2 changes: 1 addition & 1 deletion pages/master_conf/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
board = Dashboard()
mc_board = SimpleNamespace(
dashboard=board,
launch_master_bot=LaunchMasterBotCard(board, 0, 0, 12, 1),
launch_master_bot=LaunchMasterBotCard(board, 0, 0, 12, 2),
file_explorer=MasterConfFileExplorer(board, 0, 4, 3, 7),
editor=Editor(board, 4, 4, 9, 7),
)
Expand Down
4 changes: 2 additions & 2 deletions ui_components/bot_performance_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __call__(self, bot_config: dict):
mui.icon.DeleteForever()
mui.Typography("Stop Instance")
with mui.Grid(item=True, xs=6):
mui.TextField(disabled=True,
label="Attach to bot instance",
mui.TextField(InputProps={"readOnly": True},
label="Attach to instance",
value="docker attach " + bot_name,
sx={"width": "100%"})
2 changes: 1 addition & 1 deletion ui_components/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __call__(self):
with mui.Grid(container=True, spacing=4, sx={"display": "flex", "alignItems": "center"}):
with mui.Grid(item=True, xs=10, sx={"display": "flex", "alignItems": "center"}):
mui.icon.Terminal()
mui.Typography("Editor")
mui.Typography("Editor", variant="h6", sx={"marginLeft": 1})
with mui.Tabs(value=self._index, onChange=self._change_tab, scrollButtons=True,
variant="scrollable", sx={"flex": 1}):
for label in self._tabs.keys():
Expand Down
2 changes: 1 addition & 1 deletion ui_components/file_explorer_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __call__(self):
with mui.Grid(container=True, spacing=4, sx={"display": "flex", "alignItems": "center"}):
with mui.Grid(item=True, xs=6, sx={"display": "flex", "alignItems": "center"}):
mui.icon.Folder()
mui.Typography("File Explorer")
mui.Typography("File Explorer", variant="h6", sx={"marginLeft": 1})
with mui.Grid(item=True, xs=6, sx={"display": "flex", "justifyContent": "flex-end"}):
mui.IconButton(mui.icon.Delete, onClick=self.delete_file, sx={"mx": 1})
mui.IconButton(mui.icon.Edit, onClick=self.add_file_to_tab, sx={"mx": 1})
Expand Down
69 changes: 36 additions & 33 deletions ui_components/launch_bot_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def launch_new_bot(self):
base_conf_folder=f"{constants.HUMMINGBOT_TEMPLATES}/{self._base_bot_config}/.",
target_conf_folder=f"{constants.BOTS_FOLDER}/{bot_name}/.",
image=self._image_name)
with st.spinner('Starting Master Bot Conf... This process may take a few seconds'):
with st.spinner('Starting Master Configs instance... This process may take a few seconds'):
time.sleep(3)
else:
st.warning("You need to define the bot name and image in order to create one.")
Expand All @@ -49,44 +49,47 @@ def __call__(self):
sx={"display": "flex", "flexDirection": "column", "borderRadius": 3, "overflow": "hidden"},
elevation=1):
with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
mui.Typography("🚀 Create Instance", variant="h4")
mui.Typography("🚀 Create Instance", variant="h5")

with mui.Grid(container=True, spacing=2, sx={"padding": "10px 15px 10px 15px"}):
if not is_master_password_set:
with mui.Grid(item=True, xs=8):
base_warning = "You need to set a master password in order to use the dashboard."
if self.is_master_bot_running:
mui.Alert(f"{base_warning} Master Bot Conf is running, run in a terminal docker attach "
f"hummingbot-master_bot_conf and set the master password.", severity="success")
else:
mui.Alert(f"{base_warning} Master Bot Conf is not running, press start, attach the instance"
f" in your terminal and introduce the password to continue.", severity="error")
else:
with mui.Grid(item=True, xs=5):
mui.TextField(label="Bot Name", variant="outlined", onChange=lazy(self._set_bot_name),
sx={"width": "100%"})
with mui.Grid(item=True, xs=5):
mui.TextField(label="Docker Image", defaultValue="hummingbot/hummingbot:latest",
variant="outlined", onChange=lazy(self._set_image_name),
sx={"width": "100%"})
with mui.Grid(item=True, xs=8):
if not is_master_password_set:
base_warning = "You need to set a master password in order to use the dashboard."
if self.is_master_bot_running:
mui.Alert(f"{base_warning} The Master Configs instance is running."
f" Attach to it in Terminal to set the master password.", severity="success")
else:
mui.Alert(f"{base_warning} Master Configs instance isn't running. Start it and"
f" set the master password to continue.", severity="error")
else:
mui.Alert("The new instance will contain the credentials configured in the following base instance:",
severity="info")
with mui.Grid(item=True, xs=4):
master_configs = [conf.split("/")[-2] for conf in
get_directories_from_directory(constants.HUMMINGBOT_TEMPLATES) if
"bot_conf" in conf]
with mui.FormControl(variant="standard", sx={"width": "100%"}):
mui.FormHelperText("Base Configs")
with mui.Select(label="Base Configs", defaultValue=master_configs[0],
variant="standard", onChange=lazy(self._set_base_bot_config)):
for master_config in master_configs:
mui.MenuItem(master_config, value=master_config)
with mui.Grid(item=True, xs=4):
mui.TextField(label="Instance Name", variant="outlined", onChange=lazy(self._set_bot_name),
sx={"width": "100%"})
with mui.Grid(item=True, xs=4):
mui.TextField(label="Hummingbot Image",
defaultValue="hummingbot/hummingbot:latest",
variant="outlined",
placeholder="hummingbot-[name]",
onChange=lazy(self._set_image_name),
sx={"width": "100%"})

with mui.Grid(item=True, xs=2):
with mui.Grid(item=True, xs=4):
with mui.Button(onClick=self.launch_new_bot,
variant="outlined",
color="success",
sx={"width": "100%", "height": "100%"}):
mui.icon.AddCircleOutline()
mui.Typography("Create")
with mui.Grid(item=True, xs=8):
mui.Alert("The bot will contain the credentials configured in the following Base Bot Configuration.",
severity="info")

with mui.Grid(item=True, xs=4):
master_configs = [conf.split("/")[-2] for conf in
get_directories_from_directory(constants.HUMMINGBOT_TEMPLATES) if
"bot_conf" in conf]
with mui.FormControl(variant="standard", sx={"width": "100%"}):
mui.FormHelperText("Base Bot Config")
with mui.Select(label="Base Bot Config", defaultValue=master_configs[0],
variant="standard", onChange=lazy(self._set_base_bot_config)):
for master_config in master_configs:
mui.MenuItem(master_config, value=master_config)
10 changes: 5 additions & 5 deletions ui_components/launch_broker_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ def __init__(self, *args, **kwargs):
def manage_broker_container(self):
if self.is_broker_running:
DockerManager().stop_container("hummingbot-broker")
with st.spinner('Stopping Hummingbot Broker... you will not going to be able to manage bots anymore.'):
with st.spinner('Stopping Hummingbot Broker... This process may take a few seconds...'):
time.sleep(5)
else:
DockerManager().create_broker()
with st.spinner('Starting Hummingbot Broker... This process may take a few seconds'):
with st.spinner('Starting Hummingbot Broker... This process may take a few seconds...'):
time.sleep(20)

def __call__(self):
Expand All @@ -31,13 +31,13 @@ def __call__(self):
sx={"display": "flex", "flexDirection": "column", "borderRadius": 3, "overflow": "hidden"},
elevation=1):
with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
mui.Typography("🐙 Manage Broker", variant="h4")
mui.Typography("🐙 Manage Broker", variant="h5")
with mui.Grid(container=True, spacing=2, sx={"padding": "10px 15px 10px 15px"}):
with mui.Grid(item=True, xs=8):
if self.is_broker_running:
mui.Alert("Hummingbot Broker is running, you can control your bots now!", severity="success")
mui.Alert("Hummingbot Broker is running - control your bots now!", severity="success")
else:
mui.Alert("Humminngbot Broker is not running, start it to start controlling your bots.",
mui.Alert("Hummingbot Broker is not running - start it to control your bots.",
severity="error")

with mui.Grid(item=True, xs=4):
Expand Down
39 changes: 23 additions & 16 deletions ui_components/launch_master_bot_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ def __init__(self, *args, **kwargs):
def manage_master_bot_container(self):
if self.is_master_bot_running:
DockerManager().stop_container("hummingbot-master_bot_conf")
with st.spinner('Stopping Master Bot Conf... you will not going to be able to add more credentials.'):
with st.spinner('Stopping Master Configs instance... This process may take a few seconds.'):
time.sleep(5)
else:
DockerManager().create_hummingbot_instance(instance_name="hummingbot-master_bot_conf",
base_conf_folder="hummingbot_files/templates/master_bot_conf/.",
target_conf_folder="hummingbot_files/templates/master_bot_conf/."
)
with st.spinner('Starting Master Bot Conf... This process may take a few seconds'):
with st.spinner('Starting Master Configs instance... This process may take a few seconds.'):
time.sleep(3)

def __call__(self):
Expand All @@ -37,26 +37,35 @@ def __call__(self):
sx={"display": "flex", "flexDirection": "column", "borderRadius": 3, "overflow": "hidden"},
elevation=1):
with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
mui.icon.OndemandVideo()
mui.Typography("🔑 Master Bot Config")
mui.icon.Key()
mui.Typography("Master Configs", variant="h6", sx={"marginLeft": 1})

with mui.Grid(container=True, spacing=2, sx={"padding": "10px 15px 10px 15px"}):
with mui.Grid(item=True, xs=8):
with mui.Grid(item=True, xs=12):
if not is_master_password_set:
base_warning = "You need to set a master password in order to use the dashboard."
if self.is_master_bot_running:
mui.Alert(f"{base_warning} Master Bot Conf is running, run in a terminal docker attach "
f"hummingbot-master_bot_conf and set the master password.", severity="success")
mui.Alert(f"{base_warning} The Master Configs instance is running."
f" Attach to it in Terminal to set the master password.", severity="success")
else:
mui.Alert(f"{base_warning} Master Bot Conf is not running, press start, attach the instance"
f" in your terminal and introduce the password to continue.", severity="error")
mui.Alert(f"{base_warning} Master Configs instance isn't running. Start it and"
f" set the master password to continue.", severity="error")
else:
if self.is_master_bot_running:
mui.Alert("Master Bot Conf is running, you can add more credentials. Run in a terminal "
"docker attach hummingbot-master_bot_conf", severity="success")
mui.Alert("The Master Configs instance is running."
" Attach to it in Terminal to add credentials.",
severity="success",
sx={"margin": 2})
else:
mui.Alert("Master Bot Conf is not running, press start to add more credentials.",
severity="error")
mui.Alert("Master Configs instance isn't running. Start it to add credentials.",
severity="error")

with mui.Grid(item=True, xs=8):
if self.is_master_bot_running:
mui.TextField(InputProps={"readOnly": True},
label="Attach to Master Configs instance",
value="docker attach hummingbot-master_bot_conf",
sx={"width": "100%"})
with mui.Grid(item=True, xs=4):
button_text = "Stop" if self.is_master_bot_running else "Start"
color = "error" if self.is_master_bot_running else "success"
Expand All @@ -66,6 +75,4 @@ def __call__(self):
variant="outlined",
sx={"width": "100%", "height": "100%"}):
icon()
mui.Typography(button_text)


mui.Typography(button_text)

0 comments on commit 3169496

Please sign in to comment.