Skip to content

Commit 86c440d

Browse files
authored
Merge pull request #153 from hummingbot/feat/minor_bugs
Feat/minor bugs
2 parents 68cf26c + ce337ca commit 86c440d

File tree

9 files changed

+29
-31
lines changed

9 files changed

+29
-31
lines changed

backend/services/backend_api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def add_account(self, account_name: str):
253253

254254
def delete_account(self, account_name: str):
255255
"""Delete an account."""
256-
endpoint = "delete-account/"
256+
endpoint = "delete-account"
257257
return self.post(endpoint, params={"account_name": account_name})
258258

259259
def delete_credential(self, account_name: str, connector_name: str):

frontend/components/config_loader.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ def get_default_config_loader(controller_name: str):
1010
all_configs = backend_api_client.get_all_controllers_config()
1111
existing_configs = [config["id"].split("_")[0] for config in all_configs]
1212
default_dict = {"id": generate_random_name(existing_configs)}
13-
default_config = st.session_state.get("default_config")
14-
config_controller_name = st.session_state.get("controller_name", controller_name)
15-
st.write(f"controller_name: {controller_name} | config_controller_name: {config_controller_name}")
13+
default_config = st.session_state.get("default_config", default_dict)
14+
config_controller_name = default_config.get("controller_name")
1615
if default_config is None or controller_name != config_controller_name:
1716
st.session_state["default_config"] = default_dict
1817
with st.expander("Configurations", expanded=True):

frontend/components/save_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ def render_save_config(config_base_default: str, config_data: dict):
2727
if upload_config_to_backend:
2828
config_data["id"] = f"{config_base}_{config_tag}"
2929
backend_api_client.add_controller_config(config_data)
30-
st.session_state["default_config"] = None
30+
st.session_state.pop("default_config")
3131
st.success("Config uploaded successfully!")

frontend/pages/config/bollinger_v1/app.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
from datetime import datetime
2-
31
import streamlit as st
4-
import pandas as pd
5-
import yaml
62
import pandas_ta as ta # noqa: F401
73

8-
from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
9-
from backend.services.backend_api_client import BackendAPIClient
104
from frontend.components.backtesting import backtesting_section
115
from frontend.components.config_loader import get_default_config_loader
126
from frontend.components.save_config import render_save_config
13-
from frontend.pages.config.utils import get_max_records, get_candles
7+
from frontend.pages.config.utils import get_candles
148
from frontend.st_utils import initialize_st_page, get_backend_api_client
159
from frontend.pages.config.bollinger_v1.user_inputs import user_inputs
1610
from plotly.subplots import make_subplots
@@ -36,7 +30,7 @@
3630
st.session_state["default_config"].update(inputs)
3731

3832
st.write("### Visualizing Bollinger Bands and Trading Signals")
39-
days_to_visualize = st.number_input("Days to Visualize", min_value=1, max_value=365, value=3)
33+
days_to_visualize = st.number_input("Days to Visualize", min_value=1, max_value=365, value=7)
4034
# Load candle data
4135
candles = get_candles(connector_name=inputs["candles_connector"], trading_pair=inputs["candles_trading_pair"], interval=inputs["interval"], days=days_to_visualize)
4236

frontend/pages/config/macd_bb_v1/app.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
import streamlit as st
2-
import pandas as pd
3-
import plotly.graph_objects as go
4-
import yaml
52
from plotly.subplots import make_subplots
63

7-
from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
8-
from backend.services.backend_api_client import BackendAPIClient
94
from frontend.components.backtesting import backtesting_section
105
from frontend.components.config_loader import get_default_config_loader
116
from frontend.components.save_config import render_save_config
127
from frontend.pages.config.macd_bb_v1.user_inputs import user_inputs
13-
from frontend.pages.config.utils import get_candles, get_max_records
8+
from frontend.pages.config.utils import get_candles
149
from frontend.st_utils import initialize_st_page, get_backend_api_client
1510
from frontend.visualization import theme
1611
from frontend.visualization.backtesting import create_backtesting_figure
1712
from frontend.visualization.backtesting_metrics import render_backtesting_metrics, render_accuracy_metrics, \
1813
render_close_types
1914
from frontend.visualization.candles import get_candlestick_trace
20-
from frontend.visualization.indicators import get_bbands_traces, get_volume_trace, get_macd_traces
15+
from frontend.visualization.indicators import get_bbands_traces, get_macd_traces
2116
from frontend.visualization.signals import get_macdbb_v1_signal_traces
2217
from frontend.visualization.utils import add_traces_to_fig
2318

@@ -32,7 +27,7 @@
3227

3328

3429
st.write("### Visualizing MACD Bollinger Trading Signals")
35-
days_to_visualize = st.number_input("Days to Visualize", min_value=1, max_value=365, value=3)
30+
days_to_visualize = st.number_input("Days to Visualize", min_value=1, max_value=365, value=7)
3631
# Load candle data
3732
candles = get_candles(connector_name=inputs["candles_connector"], trading_pair=inputs["candles_trading_pair"], interval=inputs["interval"], days=days_to_visualize)
3833

frontend/pages/config/pmm_dynamic/app.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
import plotly.graph_objects as go
33
from plotly.subplots import make_subplots
44

5-
from backend.services.backend_api_client import BackendAPIClient
6-
from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
75
from frontend.components.config_loader import get_default_config_loader
86
from frontend.components.executors_distribution import get_executors_distribution_inputs
97
from frontend.components.save_config import render_save_config
@@ -12,7 +10,7 @@
1210
from frontend.components.backtesting import backtesting_section
1311
from frontend.pages.config.pmm_dynamic.spread_and_price_multipliers import get_pmm_dynamic_multipliers
1412
from frontend.pages.config.pmm_dynamic.user_inputs import user_inputs
15-
from frontend.pages.config.utils import get_max_records, get_candles
13+
from frontend.pages.config.utils import get_candles
1614
from frontend.st_utils import initialize_st_page, get_backend_api_client
1715
from frontend.visualization import theme
1816
from frontend.visualization.backtesting import create_backtesting_figure
@@ -35,7 +33,7 @@
3533
st.write("### Visualizing MACD and NATR indicators for PMM Dynamic")
3634
st.text("The MACD is used to shift the mid price and the NATR to make the spreads dynamic. "
3735
"In the order distributions graph, we are going to see the values of the orders affected by the average NATR")
38-
days_to_visualize = st.number_input("Days to Visualize", min_value=1, max_value=365, value=3)
36+
days_to_visualize = st.number_input("Days to Visualize", min_value=1, max_value=365, value=7)
3937
# Load candle data
4038
candles = get_candles(connector_name=inputs["candles_connector"], trading_pair=inputs["candles_trading_pair"], interval=inputs["interval"], days=days_to_visualize)
4139
with st.expander("Visualizing PMM Dynamic Indicators", expanded=True):

frontend/pages/config/supertrend_v1/app.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import streamlit as st
22
from plotly.subplots import make_subplots
33

4-
from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
5-
from backend.services.backend_api_client import BackendAPIClient
64
from frontend.components.backtesting import backtesting_section
75
from frontend.components.config_loader import get_default_config_loader
86
from frontend.components.save_config import render_save_config
97
from frontend.pages.config.supertrend_v1.user_inputs import user_inputs
10-
from frontend.pages.config.utils import get_candles, get_max_records
8+
from frontend.pages.config.utils import get_candles
119
from frontend.st_utils import initialize_st_page, get_backend_api_client
1210
from frontend.visualization import theme
1311
from frontend.visualization.backtesting import create_backtesting_figure
@@ -28,7 +26,7 @@
2826
st.session_state["default_config"].update(inputs)
2927

3028
st.write("### Visualizing Supertrend Trading Signals")
31-
days_to_visualize = st.number_input("Days to Visualize", min_value=1, max_value=365, value=3)
29+
days_to_visualize = st.number_input("Days to Visualize", min_value=1, max_value=365, value=7)
3230
# Load candle data
3331
candles = get_candles(connector_name=inputs["candles_connector"], trading_pair=inputs["candles_trading_pair"], interval=inputs["interval"], days=days_to_visualize)
3432

frontend/pages/orchestration/credentials/app.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ def get_all_connectors_config_map():
4242
st.header("Create a New Account")
4343
new_account_name = st.text_input("New Account Name")
4444
if st.button("Create Account"):
45+
new_account_name = new_account_name.replace(" ", "_")
4546
if new_account_name:
47+
if new_account_name in accounts:
48+
st.warning(f"Account {new_account_name} already exists.")
49+
st.stop()
50+
elif new_account_name == "" or all(char == "_" for char in new_account_name):
51+
st.warning("Please enter a valid account name.")
52+
st.stop()
4653
response = client.add_account(new_account_name)
4754
st.write(response)
4855
else:
@@ -95,4 +102,5 @@ def get_all_connectors_config_map():
95102
with cols[-1]:
96103
if st.button("Submit Credentials"):
97104
response = client.add_connector_keys(account_name, connector_name, config_inputs)
98-
105+
if response:
106+
st.success(response)

frontend/pages/orchestration/portfolio/app.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ def account_history_to_df(history):
5353
# Fetch account state from the backend
5454
account_state = client.get_accounts_state()
5555
account_history = client.get_account_state_history()
56-
56+
if len(account_state) == 0:
57+
st.warning("No accounts found.")
58+
st.stop()
5759

5860
# Display the accounts available
5961
accounts = st.multiselect("Select Accounts", list(account_state.keys()), list(account_state.keys()))
@@ -65,6 +67,10 @@ def account_history_to_df(history):
6567
exchanges_available = []
6668
for account in accounts:
6769
exchanges_available += account_state[account].keys()
70+
71+
if len(exchanges_available) == 0:
72+
st.warning("No exchanges found.")
73+
st.stop()
6874
exchanges = st.multiselect("Select Exchanges", exchanges_available, exchanges_available)
6975

7076
# Display the tokens available

0 commit comments

Comments
 (0)