mirror of
https://github.com/aljazceru/hummingbot-dashboard.git
synced 2025-12-19 06:24:21 +01:00
(feat) add broker host and port as env configuirable variables
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
MINER_COINS = ["Algorand", "Avalanche", "DAO Maker", "Faith Tribe", "Fear", "Frontier",
|
MINER_COINS = ["Algorand", "Avalanche", "DAO Maker", "Faith Tribe", "Fear", "Frontier",
|
||||||
"Harmony", "Hot Cross", "HUMAN Protocol", "Oddz", "Shera", "Firo",
|
"Harmony", "Hot Cross", "HUMAN Protocol", "Oddz", "Shera", "Firo",
|
||||||
"Vesper Finance", "Youclout", "Nimiq"]
|
"Vesper Finance", "Youclout", "Nimiq"]
|
||||||
@@ -12,3 +16,7 @@ CERTIFIED_EXCHANGES = ["ascendex", "binance", "bybit", "gate.io", "hitbtc", "huo
|
|||||||
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
|
AUTH_SYSTEM_ENABLED = False
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
BACKEND_API_HOST = os.getenv("BACKEND_API_HOST", "localhost")
|
||||||
|
BACKEND_API_PORT = os.getenv("BACKEND_API_PORT", 8000)
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import streamlit as st
|
import streamlit as st
|
||||||
from streamlit_elements import elements, mui
|
from streamlit_elements import elements, mui
|
||||||
|
|
||||||
|
from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
|
||||||
from ui_components.bot_performance_card_v2 import BotPerformanceCardV2
|
from ui_components.bot_performance_card_v2 import BotPerformanceCardV2
|
||||||
from ui_components.dashboard import Dashboard
|
from ui_components.dashboard import Dashboard
|
||||||
from utils.backend_api_client import BackendAPIClient
|
from utils.backend_api_client import BackendAPIClient
|
||||||
@@ -19,7 +20,7 @@ def get_grid_positions(n_cards: int, cols: int = NUM_CARD_COLS, card_width: int
|
|||||||
|
|
||||||
|
|
||||||
initialize_st_page(title="Instances", icon="🦅", initial_sidebar_state="collapsed")
|
initialize_st_page(title="Instances", icon="🦅", initial_sidebar_state="collapsed")
|
||||||
api_client = BackendAPIClient.get_instance(host="localhost", port=8000)
|
api_client = BackendAPIClient.get_instance(host=BACKEND_API_HOST, port=BACKEND_API_PORT)
|
||||||
|
|
||||||
|
|
||||||
if not api_client.is_docker_running():
|
if not api_client.is_docker_running():
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import plotly.graph_objects as go
|
|||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
|
||||||
from utils.backend_api_client import BackendAPIClient
|
from utils.backend_api_client import BackendAPIClient
|
||||||
from utils.st_utils import initialize_st_page
|
from utils.st_utils import initialize_st_page
|
||||||
from hummingbot.smart_components.utils.distributions import Distributions
|
from hummingbot.smart_components.utils.distributions import Distributions
|
||||||
@@ -430,8 +431,8 @@ config = {
|
|||||||
"connector_name": connector,
|
"connector_name": connector,
|
||||||
"trading_pair": trading_pair,
|
"trading_pair": trading_pair,
|
||||||
"total_amount_quote": total_amount_quote,
|
"total_amount_quote": total_amount_quote,
|
||||||
"buy_spreads": buy_spread_distributions,
|
"buy_spreads": [spread / 100 for spread in buy_spread_distributions],
|
||||||
"sell_spreads": sell_spread_distributions,
|
"sell_spreads": [spread / 100 for spread in sell_spread_distributions],
|
||||||
"buy_amounts_pct": buy_order_amounts_quote,
|
"buy_amounts_pct": buy_order_amounts_quote,
|
||||||
"sell_amounts_pct": sell_order_amounts_quote,
|
"sell_amounts_pct": sell_order_amounts_quote,
|
||||||
"executor_refresh_time": executor_refresh_time * 60,
|
"executor_refresh_time": executor_refresh_time * 60,
|
||||||
@@ -463,6 +464,6 @@ with c3:
|
|||||||
|
|
||||||
|
|
||||||
if upload_config_to_backend:
|
if upload_config_to_backend:
|
||||||
backend_api_client = BackendAPIClient.get_instance()
|
backend_api_client = BackendAPIClient.get_instance(host=BACKEND_API_HOST, port=BACKEND_API_PORT)
|
||||||
backend_api_client.add_controller_config(config)
|
backend_api_client.add_controller_config(config)
|
||||||
st.success("Config uploaded successfully!")
|
st.success("Config uploaded successfully!")
|
||||||
@@ -1,16 +1,17 @@
|
|||||||
from streamlit_elements import mui, lazy
|
from streamlit_elements import mui, lazy
|
||||||
|
|
||||||
|
from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
|
||||||
from ui_components.dashboard import Dashboard
|
from ui_components.dashboard import Dashboard
|
||||||
import streamlit as st
|
import streamlit as st
|
||||||
import time
|
import time
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import datetime
|
|
||||||
|
|
||||||
from utils.backend_api_client import BackendAPIClient
|
from utils.backend_api_client import BackendAPIClient
|
||||||
|
|
||||||
TRADES_TO_SHOW = 5
|
TRADES_TO_SHOW = 5
|
||||||
WIDE_COL_WIDTH = 150
|
WIDE_COL_WIDTH = 180
|
||||||
MEDIUM_COL_WIDTH = 140
|
MEDIUM_COL_WIDTH = 140
|
||||||
backend_api_client = BackendAPIClient.get_instance()
|
backend_api_client = BackendAPIClient.get_instance(host=BACKEND_API_HOST, port=BACKEND_API_PORT)
|
||||||
|
|
||||||
|
|
||||||
def stop_bot(bot_name):
|
def stop_bot(bot_name):
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import json
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import streamlit as st
|
import streamlit as st
|
||||||
from hummingbot.core.data_type.common import PositionMode, OrderType, TradeType
|
|
||||||
from hummingbot.smart_components.utils.config_encoder_decoder import ConfigEncoderDecoder
|
|
||||||
from streamlit_elements import mui, lazy
|
from streamlit_elements import mui, lazy
|
||||||
|
|
||||||
|
from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
|
||||||
from utils.backend_api_client import BackendAPIClient
|
from utils.backend_api_client import BackendAPIClient
|
||||||
from .dashboard import Dashboard
|
from .dashboard import Dashboard
|
||||||
|
|
||||||
@@ -28,21 +26,21 @@ class LaunchStrategyV2(Dashboard.Item):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self._backend_api_client = BackendAPIClient.get_instance()
|
self._backend_api_client = BackendAPIClient.get_instance(host=BACKEND_API_HOST, port=BACKEND_API_PORT)
|
||||||
self._controller_configs_available = self._backend_api_client.get_all_controllers_config()
|
self._controller_configs_available = self._backend_api_client.get_all_controllers_config()
|
||||||
self._controller_config_selected = None
|
self._controller_config_selected = None
|
||||||
self._bot_name = None
|
self._bot_name = None
|
||||||
self._image_name = "hummingbot/hummingbot:latest"
|
self._image_name = "dardonacci/hummingbot:latest"
|
||||||
self._credentials = "master_account"
|
self._credentials = "master_account"
|
||||||
|
|
||||||
def _set_bot_name(self, event):
|
def _set_bot_name(self, event):
|
||||||
self._bot_name = event.target.value
|
self._bot_name = event.target.value
|
||||||
|
|
||||||
def _set_image_name(self, event):
|
def _set_image_name(self, _, childs):
|
||||||
self._image_name = event.target.value
|
self._image_name = childs.props.value
|
||||||
|
|
||||||
def _set_credentials(self, event):
|
def _set_credentials(self, _, childs):
|
||||||
self._credentials = event.target.value
|
self._credentials = childs.props.value
|
||||||
|
|
||||||
def _set_controller(self, event):
|
def _set_controller(self, event):
|
||||||
self._controller_selected = event.target.value
|
self._controller_selected = event.target.value
|
||||||
|
|||||||
Reference in New Issue
Block a user