diff --git a/frontend/pages/config/grid_strike/user_inputs.py b/frontend/pages/config/grid_strike/user_inputs.py index f007b509..a649f59b 100644 --- a/frontend/pages/config/grid_strike/user_inputs.py +++ b/frontend/pages/config/grid_strike/user_inputs.py @@ -183,6 +183,13 @@ def user_inputs(): format="%.4f", help="Price movement percentage for stop loss (0 for none)" ) + + # Keep position parameter + keep_position = st.checkbox( + "Keep Position", + value=False, + help="Keep the position open after grid execution" + ) # Chart configuration with st.expander("Chart Configuration", expanded=True): c1, c2, c3 = st.columns(3) @@ -244,5 +251,6 @@ def user_inputs(): "order_frequency": order_frequency, "activation_bounds": activation_bounds, "triple_barrier_config": triple_barrier_config, + "keep_position": keep_position, "candles_config": [] } \ No newline at end of file diff --git a/frontend/pages/config/pmm_dynamic/user_inputs.py b/frontend/pages/config/pmm_dynamic/user_inputs.py index e3152880..5f2e9e64 100644 --- a/frontend/pages/config/pmm_dynamic/user_inputs.py +++ b/frontend/pages/config/pmm_dynamic/user_inputs.py @@ -10,6 +10,9 @@ def user_inputs(): macd_slow = default_config.get("macd_slow", 42) macd_signal = default_config.get("macd_signal", 9) natr_length = default_config.get("natr_length", 14) + position_rebalance_threshold_pct = default_config.get("position_rebalance_threshold_pct", 0.05) + skip_rebalance = default_config.get("skip_rebalance", False) + connector_name, trading_pair, leverage, total_amount_quote, position_mode, cooldown_time, executor_refresh_time, \ candles_connector, candles_trading_pair, interval = get_market_making_general_inputs(custom_candles=True) sl, tp, time_limit, ts_ap, ts_delta, take_profit_order_type = get_risk_management_inputs() @@ -23,6 +26,24 @@ def user_inputs(): macd_signal = st.number_input("MACD Signal Period", min_value=1, max_value=200, value=macd_signal) with c4: natr_length = st.number_input("NATR Length", min_value=1, max_value=200, value=natr_length) + + with st.expander("Position Rebalancing", expanded=True): + c1, c2 = st.columns(2) + with c1: + position_rebalance_threshold_pct = st.number_input( + "Position Rebalance Threshold (%)", + min_value=0.0, + max_value=100.0, + value=position_rebalance_threshold_pct * 100, + step=0.1, + help="Threshold percentage for position rebalancing" + ) / 100 + with c2: + skip_rebalance = st.checkbox( + "Skip Rebalance", + value=skip_rebalance, + help="Skip position rebalancing" + ) # Create the config config = { @@ -51,7 +72,9 @@ def user_inputs(): "trailing_stop": { "activation_price": ts_ap, "trailing_delta": ts_delta - } + }, + "position_rebalance_threshold_pct": position_rebalance_threshold_pct, + "skip_rebalance": skip_rebalance } return config diff --git a/frontend/pages/config/pmm_simple/user_inputs.py b/frontend/pages/config/pmm_simple/user_inputs.py index 1002a10e..53031a80 100644 --- a/frontend/pages/config/pmm_simple/user_inputs.py +++ b/frontend/pages/config/pmm_simple/user_inputs.py @@ -1,14 +1,38 @@ +import streamlit as st + from frontend.components.executors_distribution import get_executors_distribution_inputs from frontend.components.market_making_general_inputs import get_market_making_general_inputs from frontend.components.risk_management import get_risk_management_inputs def user_inputs(): + default_config = st.session_state.get("default_config", {}) + position_rebalance_threshold_pct = default_config.get("position_rebalance_threshold_pct", 0.05) + skip_rebalance = default_config.get("skip_rebalance", False) + connector_name, trading_pair, leverage, total_amount_quote, position_mode, cooldown_time, \ executor_refresh_time, _, _, _ = get_market_making_general_inputs() buy_spread_distributions, sell_spread_distributions, buy_order_amounts_pct, \ sell_order_amounts_pct = get_executors_distribution_inputs() sl, tp, time_limit, ts_ap, ts_delta, take_profit_order_type = get_risk_management_inputs() + + with st.expander("Position Rebalancing", expanded=True): + c1, c2 = st.columns(2) + with c1: + position_rebalance_threshold_pct = st.number_input( + "Position Rebalance Threshold (%)", + min_value=0.0, + max_value=100.0, + value=position_rebalance_threshold_pct * 100, + step=0.1, + help="Threshold percentage for position rebalancing" + ) / 100 + with c2: + skip_rebalance = st.checkbox( + "Skip Rebalance", + value=skip_rebalance, + help="Skip position rebalancing" + ) # Create the config config = { "controller_name": "pmm_simple", @@ -33,6 +57,8 @@ def user_inputs(): "trailing_stop": { "activation_price": ts_ap, "trailing_delta": ts_delta - } + }, + "position_rebalance_threshold_pct": position_rebalance_threshold_pct, + "skip_rebalance": skip_rebalance } return config