Files
hummingbot-dashboard/frontend/components/controllers_file_explorer.py
2024-07-16 18:31:34 +03:00

24 lines
1.4 KiB
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from streamlit_elements import mui
import constants
from backend.utils.os_utils import load_controllers
from frontend.components.file_explorer_base import FileExplorerBase
class ControllersFileExplorer(FileExplorerBase):
def add_tree_view(self):
with mui.lab.TreeView(defaultExpandIcon=mui.icon.ChevronRight, defaultCollapseIcon=mui.icon.ExpandMore,
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="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="🪙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}")