mirror of
https://github.com/aljazceru/hummingbot-dashboard.git
synced 2025-12-21 15:34:19 +01:00
(feat) add upload config to backend api
This commit is contained in:
22
frontend/components/save_config.py
Normal file
22
frontend/components/save_config.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import streamlit as st
|
||||||
|
|
||||||
|
from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
|
||||||
|
from backend.services.backend_api_client import BackendAPIClient
|
||||||
|
|
||||||
|
|
||||||
|
def render_save_config(controller_name: str, config_data: dict):
|
||||||
|
st.write("### Upload Config to BackendAPI")
|
||||||
|
c1, c2, c3 = st.columns([1, 1, 0.5])
|
||||||
|
connector = config_data.get("connector_name", "")
|
||||||
|
trading_pair = config_data.get("trading_pair", "")
|
||||||
|
with c1:
|
||||||
|
config_base = st.text_input("Config Base", value=f"{controller_name}-{connector}-{trading_pair.split('-')[0]}")
|
||||||
|
with c2:
|
||||||
|
config_tag = st.text_input("Config Tag", value="1.1")
|
||||||
|
with c3:
|
||||||
|
upload_config_to_backend = st.button("Upload")
|
||||||
|
if upload_config_to_backend:
|
||||||
|
config_data["id"] = f"{config_base}-{config_tag}"
|
||||||
|
backend_api_client = BackendAPIClient.get_instance(host=BACKEND_API_HOST, port=BACKEND_API_PORT)
|
||||||
|
backend_api_client.add_controller_config(config_data)
|
||||||
|
st.success("Config uploaded successfully!")
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import streamlit as st
|
import streamlit as st
|
||||||
from backend.services.backend_api_client import BackendAPIClient
|
from backend.services.backend_api_client import BackendAPIClient
|
||||||
from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
|
from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
|
||||||
|
from frontend.components.save_config import render_save_config
|
||||||
|
|
||||||
# Import submodules
|
# Import submodules
|
||||||
from frontend.pages.config.pmm_simple.user_inputs import user_inputs
|
from frontend.pages.config.pmm_simple.user_inputs import user_inputs
|
||||||
@@ -24,7 +25,6 @@ st.plotly_chart(fig, use_container_width=True)
|
|||||||
|
|
||||||
bt_results = backtesting_section(inputs, backend_api_client)
|
bt_results = backtesting_section(inputs, backend_api_client)
|
||||||
if bt_results:
|
if bt_results:
|
||||||
st.write("---")
|
|
||||||
fig = create_backtesting_figure(
|
fig = create_backtesting_figure(
|
||||||
df=bt_results["processed_data"],
|
df=bt_results["processed_data"],
|
||||||
executors=bt_results["executors"],
|
executors=bt_results["executors"],
|
||||||
@@ -37,3 +37,5 @@ if bt_results:
|
|||||||
render_accuracy_metrics(bt_results["results"])
|
render_accuracy_metrics(bt_results["results"])
|
||||||
st.write("---")
|
st.write("---")
|
||||||
render_close_types(bt_results["results"])
|
render_close_types(bt_results["results"])
|
||||||
|
st.write("---")
|
||||||
|
render_save_config("pmm_simple", inputs)
|
||||||
|
|||||||
Reference in New Issue
Block a user