mirror of
https://github.com/aljazceru/hummingbot-dashboard.git
synced 2025-12-21 15:34:19 +01:00
(feat) update controllers configs components
This commit is contained in:
@@ -23,9 +23,8 @@ def get_default_config_loader(controller_name: str):
|
||||
configs = [config for config in all_configs if config["controller_name"] == controller_name]
|
||||
if len(configs) > 0:
|
||||
default_config = st.selectbox("Select a config", [config["id"] for config in configs])
|
||||
st.session_state["default_config"] = next((config for config in all_configs if config["id"] == default_config), None)
|
||||
st.session_state["default_config"] = next(
|
||||
(config for config in all_configs if config["id"] == default_config), None)
|
||||
st.session_state["default_config"]["id"] = st.session_state["default_config"]["id"].split("_")[0]
|
||||
else:
|
||||
st.warning("No existing configs found for this controller.")
|
||||
|
||||
|
||||
|
||||
@@ -11,11 +11,13 @@ class ControllersFileExplorer(FileExplorerBase):
|
||||
onNodeSelect=lambda event, node_id: self.set_selected_file(event, node_id),
|
||||
defaultExpanded=["directional_strategies"]):
|
||||
available_controllers = load_controllers(constants.CONTROLLERS_PATH)
|
||||
with mui.lab.TreeItem(nodeId="directional_strategies", label=f"⚔️Directional Strategies"):
|
||||
with mui.lab.TreeItem(nodeId="directional_strategies", label="⚔️Directional Strategies"):
|
||||
for controller in available_controllers:
|
||||
if available_controllers[controller]["type"] == "directional_trading":
|
||||
mui.lab.TreeItem(nodeId=constants.CONTROLLERS_PATH + "/" + controller + ".py", label=f"🐍{controller}")
|
||||
with mui.lab.TreeItem(nodeId="market_making_strategies", label=f"🪙Market Making Strategies"):
|
||||
mui.lab.TreeItem(nodeId=constants.CONTROLLERS_PATH + "/" + controller + ".py",
|
||||
label=f"🐍{controller}")
|
||||
with mui.lab.TreeItem(nodeId="market_making_strategies", label="🪙Market Making Strategies"):
|
||||
for controller in available_controllers:
|
||||
if available_controllers[controller]["type"] == "market_making":
|
||||
mui.lab.TreeItem(nodeId=constants.CONTROLLERS_PATH + "/" + controller + ".py", label=f"🐍{controller}")
|
||||
mui.lab.TreeItem(nodeId=constants.CONTROLLERS_PATH + "/" + controller + ".py",
|
||||
label=f"🐍{controller}")
|
||||
|
||||
@@ -22,7 +22,8 @@ def get_directional_trading_general_inputs():
|
||||
connector_name = st.text_input("Connector", value=connector_name,
|
||||
help="Enter the name of the exchange to trade on (e.g., binance_perpetual).")
|
||||
candles_connector_name = st.text_input("Candles Connector", value=candles_connector_name,
|
||||
help="Enter the name of the exchange to get candles from (e.g., binance_perpetual).")
|
||||
help="Enter the name of the exchange to get candles from"
|
||||
" (e.g., binance_perpetual).")
|
||||
with c2:
|
||||
trading_pair = st.text_input("Trading Pair", value=trading_pair,
|
||||
help="Enter the trading pair to trade on (e.g., WLD-USDT).")
|
||||
@@ -30,8 +31,10 @@ def get_directional_trading_general_inputs():
|
||||
help="Enter the trading pair to get candles for (e.g., WLD-USDT).")
|
||||
with c3:
|
||||
leverage = st.number_input("Leverage", value=leverage,
|
||||
help="Set the leverage to use for trading (e.g., 20 for 20x leverage). Set it to 1 for spot trading.")
|
||||
interval = st.selectbox("Candles Interval", ("1m", "3m", "5m", "15m", "1h", "4h", "1d"), index=interval_index,
|
||||
help="Set the leverage to use for trading (e.g., 20 for 20x leverage)."
|
||||
"Set it to 1 for spot trading.")
|
||||
interval = st.selectbox("Candles Interval", ("1m", "3m", "5m", "15m", "1h", "4h", "1d"),
|
||||
index=interval_index,
|
||||
help="Enter the interval for candles (e.g., 1m).")
|
||||
with c4:
|
||||
total_amount_quote = st.number_input("Total amount of quote", value=total_amount_quote,
|
||||
@@ -45,4 +48,5 @@ def get_directional_trading_general_inputs():
|
||||
with c7:
|
||||
position_mode = st.selectbox("Position Mode", ("HEDGE", "ONEWAY"), index=position_mode,
|
||||
help="Enter the position mode (HEDGE/ONEWAY).")
|
||||
return connector_name, trading_pair, leverage, total_amount_quote, max_executors_per_side, cooldown_time, position_mode, candles_connector_name, candles_trading_pair, interval
|
||||
return connector_name, trading_pair, leverage, total_amount_quote, max_executors_per_side, cooldown_time, \
|
||||
position_mode, candles_connector_name, candles_trading_pair, interval
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import streamlit as st
|
||||
from streamlit_elements import mui
|
||||
|
||||
from backend.utils.os_utils import remove_file, load_file
|
||||
from backend.utils.os_utils import load_file, remove_file
|
||||
|
||||
from .dashboard import Dashboard
|
||||
|
||||
|
||||
@@ -61,4 +62,3 @@ class FileExplorerBase(Dashboard.Item):
|
||||
mui.IconButton(mui.icon.Close, onClick=self.remove_file_from_tab, sx={"mx": 1})
|
||||
with mui.Box(sx={"overflow": "auto"}):
|
||||
self.add_tree_view()
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import time
|
||||
|
||||
import streamlit as st
|
||||
from streamlit_elements import mui, lazy
|
||||
from streamlit_elements import lazy, mui
|
||||
|
||||
from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
|
||||
from backend.services.backend_api_client import BackendAPIClient
|
||||
from .dashboard import Dashboard
|
||||
from ..st_utils import get_backend_api_client
|
||||
from .dashboard import Dashboard
|
||||
|
||||
|
||||
class LaunchStrategyV2(Dashboard.Item):
|
||||
@@ -134,14 +132,14 @@ class LaunchStrategyV2(Dashboard.Item):
|
||||
else:
|
||||
config_base = config["id"]
|
||||
version = "NaN"
|
||||
ts_text = str(trailing_stop["activation_price"]) + " / " + str(trailing_stop["trailing_delta"])
|
||||
data.append({
|
||||
"id": config["id"], "config_base": config_base, "version": version,
|
||||
"controller_name": config["controller_name"], "controller_type": config["controller_type"],
|
||||
"connector_name": connector_name, "trading_pair": trading_pair,
|
||||
"total_amount_quote": total_amount_quote, "max_loss_quote": total_amount_quote * stop_loss / 2,
|
||||
"stop_loss": stop_loss, "take_profit": take_profit,
|
||||
"trailing_stop": str(trailing_stop["activation_price"]) + " / " +
|
||||
str(trailing_stop["trailing_delta"]),
|
||||
"trailing_stop": ts_text,
|
||||
"time_limit": time_limit})
|
||||
|
||||
with mui.Grid(item=True, xs=12):
|
||||
|
||||
@@ -23,16 +23,19 @@ def get_market_making_general_inputs(custom_candles=False):
|
||||
help="Enter the trading pair to trade on (e.g., WLD-USDT).")
|
||||
with c3:
|
||||
leverage = st.number_input("Leverage", value=leverage,
|
||||
help="Set the leverage to use for trading (e.g., 20 for 20x leverage). Set it to 1 for spot trading.")
|
||||
help="Set the leverage to use for trading (e.g., 20 for 20x leverage). "
|
||||
"Set it to 1 for spot trading.")
|
||||
with c4:
|
||||
total_amount_quote = st.number_input("Total amount of quote", value=total_amount_quote,
|
||||
help="Enter the total amount in quote asset to use for trading (e.g., 1000).")
|
||||
help="Enter the total amount in quote asset to use for "
|
||||
"trading (e.g., 1000).")
|
||||
with c5:
|
||||
position_mode = st.selectbox("Position Mode", ("HEDGE", "ONEWAY"), index=position_mode,
|
||||
help="Enter the position mode (HEDGE/ONEWAY).")
|
||||
with c6:
|
||||
cooldown_time = st.number_input("Stop Loss Cooldown Time (minutes)", value=cooldown_time,
|
||||
help="Specify the cooldown time in minutes after having a stop loss (e.g., 60).") * 60
|
||||
help="Specify the cooldown time in minutes after having a"
|
||||
"stop loss (e.g., 60).") * 60
|
||||
with c7:
|
||||
executor_refresh_time = st.number_input("Executor Refresh Time (minutes)", value=executor_refresh_time,
|
||||
help="Enter the refresh time in minutes for executors (e.g., 60).") * 60
|
||||
@@ -44,11 +47,13 @@ def get_market_making_general_inputs(custom_candles=False):
|
||||
interval_index = intervals.index(interval)
|
||||
with c1:
|
||||
candles_connector = st.text_input("Candles Connector", value=candles_connector,
|
||||
help="Enter the name of the exchange to get candles from (e.g., binance_perpetual).")
|
||||
help="Enter the name of the exchange to get candles from"
|
||||
"(e.g., binance_perpetual).")
|
||||
with c2:
|
||||
candles_trading_pair = st.text_input("Candles Trading Pair", value=candles_trading_pair,
|
||||
help="Enter the trading pair to get candles for (e.g., WLD-USDT).")
|
||||
with c3:
|
||||
interval = st.selectbox("Candles Interval", intervals, index=interval_index,
|
||||
help="Enter the interval for candles (e.g., 1m).")
|
||||
return connector_name, trading_pair, leverage, total_amount_quote, position_mode, cooldown_time, executor_refresh_time, candles_connector, candles_trading_pair, interval
|
||||
return connector_name, trading_pair, leverage, total_amount_quote, position_mode, cooldown_time, \
|
||||
executor_refresh_time, candles_connector, candles_trading_pair, interval
|
||||
|
||||
Reference in New Issue
Block a user