Skip to content

Commit 8dc3019

Browse files
authored
Merge pull request #253 from hummingbot/feat/improve_controllers_configuration
(feat) add extra configs
2 parents d8a8193 + 68cd2eb commit 8dc3019

File tree

3 files changed

+59
-2
lines changed

3 files changed

+59
-2
lines changed

frontend/pages/config/grid_strike/user_inputs.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ def user_inputs():
183183
format="%.4f",
184184
help="Price movement percentage for stop loss (0 for none)"
185185
)
186+
187+
# Keep position parameter
188+
keep_position = st.checkbox(
189+
"Keep Position",
190+
value=False,
191+
help="Keep the position open after grid execution"
192+
)
186193
# Chart configuration
187194
with st.expander("Chart Configuration", expanded=True):
188195
c1, c2, c3 = st.columns(3)
@@ -244,5 +251,6 @@ def user_inputs():
244251
"order_frequency": order_frequency,
245252
"activation_bounds": activation_bounds,
246253
"triple_barrier_config": triple_barrier_config,
254+
"keep_position": keep_position,
247255
"candles_config": []
248256
}

frontend/pages/config/pmm_dynamic/user_inputs.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ def user_inputs():
1010
macd_slow = default_config.get("macd_slow", 42)
1111
macd_signal = default_config.get("macd_signal", 9)
1212
natr_length = default_config.get("natr_length", 14)
13+
position_rebalance_threshold_pct = default_config.get("position_rebalance_threshold_pct", 0.05)
14+
skip_rebalance = default_config.get("skip_rebalance", False)
15+
1316
connector_name, trading_pair, leverage, total_amount_quote, position_mode, cooldown_time, executor_refresh_time, \
1417
candles_connector, candles_trading_pair, interval = get_market_making_general_inputs(custom_candles=True)
1518
sl, tp, time_limit, ts_ap, ts_delta, take_profit_order_type = get_risk_management_inputs()
@@ -23,6 +26,24 @@ def user_inputs():
2326
macd_signal = st.number_input("MACD Signal Period", min_value=1, max_value=200, value=macd_signal)
2427
with c4:
2528
natr_length = st.number_input("NATR Length", min_value=1, max_value=200, value=natr_length)
29+
30+
with st.expander("Position Rebalancing", expanded=True):
31+
c1, c2 = st.columns(2)
32+
with c1:
33+
position_rebalance_threshold_pct = st.number_input(
34+
"Position Rebalance Threshold (%)",
35+
min_value=0.0,
36+
max_value=100.0,
37+
value=position_rebalance_threshold_pct * 100,
38+
step=0.1,
39+
help="Threshold percentage for position rebalancing"
40+
) / 100
41+
with c2:
42+
skip_rebalance = st.checkbox(
43+
"Skip Rebalance",
44+
value=skip_rebalance,
45+
help="Skip position rebalancing"
46+
)
2647

2748
# Create the config
2849
config = {
@@ -51,7 +72,9 @@ def user_inputs():
5172
"trailing_stop": {
5273
"activation_price": ts_ap,
5374
"trailing_delta": ts_delta
54-
}
75+
},
76+
"position_rebalance_threshold_pct": position_rebalance_threshold_pct,
77+
"skip_rebalance": skip_rebalance
5578
}
5679

5780
return config

frontend/pages/config/pmm_simple/user_inputs.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,38 @@
1+
import streamlit as st
2+
13
from frontend.components.executors_distribution import get_executors_distribution_inputs
24
from frontend.components.market_making_general_inputs import get_market_making_general_inputs
35
from frontend.components.risk_management import get_risk_management_inputs
46

57

68
def user_inputs():
9+
default_config = st.session_state.get("default_config", {})
10+
position_rebalance_threshold_pct = default_config.get("position_rebalance_threshold_pct", 0.05)
11+
skip_rebalance = default_config.get("skip_rebalance", False)
12+
713
connector_name, trading_pair, leverage, total_amount_quote, position_mode, cooldown_time, \
814
executor_refresh_time, _, _, _ = get_market_making_general_inputs()
915
buy_spread_distributions, sell_spread_distributions, buy_order_amounts_pct, \
1016
sell_order_amounts_pct = get_executors_distribution_inputs()
1117
sl, tp, time_limit, ts_ap, ts_delta, take_profit_order_type = get_risk_management_inputs()
18+
19+
with st.expander("Position Rebalancing", expanded=True):
20+
c1, c2 = st.columns(2)
21+
with c1:
22+
position_rebalance_threshold_pct = st.number_input(
23+
"Position Rebalance Threshold (%)",
24+
min_value=0.0,
25+
max_value=100.0,
26+
value=position_rebalance_threshold_pct * 100,
27+
step=0.1,
28+
help="Threshold percentage for position rebalancing"
29+
) / 100
30+
with c2:
31+
skip_rebalance = st.checkbox(
32+
"Skip Rebalance",
33+
value=skip_rebalance,
34+
help="Skip position rebalancing"
35+
)
1236
# Create the config
1337
config = {
1438
"controller_name": "pmm_simple",
@@ -33,6 +57,8 @@ def user_inputs():
3357
"trailing_stop": {
3458
"activation_price": ts_ap,
3559
"trailing_delta": ts_delta
36-
}
60+
},
61+
"position_rebalance_threshold_pct": position_rebalance_threshold_pct,
62+
"skip_rebalance": skip_rebalance
3763
}
3864
return config

0 commit comments

Comments
 (0)