diff --git a/frontend/pages/config/dman_maker_v2/app.py b/frontend/pages/config/dman_maker_v2/app.py index 7fbd2b0..1505c38 100644 --- a/frontend/pages/config/dman_maker_v2/app.py +++ b/frontend/pages/config/dman_maker_v2/app.py @@ -52,7 +52,7 @@ st.plotly_chart(fig, use_container_width=True) # Combine inputs and dca_inputs into final config config = {**inputs, **dca_inputs} -st.session_state["default_config"] = config +st.session_state["default_config"].update(config) bt_results = backtesting_section(config, backend_api_client) if bt_results: fig = create_backtesting_figure( @@ -68,4 +68,4 @@ if bt_results: st.write("---") render_close_types(bt_results["results"]) st.write("---") -render_save_config("dman_maker_v2", config) \ No newline at end of file +render_save_config(st.session_state["default_config"]["id"], st.session_state["default_config"]) diff --git a/frontend/pages/config/pmm_dynamic/app.py b/frontend/pages/config/pmm_dynamic/app.py index 418512d..e43a8a2 100644 --- a/frontend/pages/config/pmm_dynamic/app.py +++ b/frontend/pages/config/pmm_dynamic/app.py @@ -55,12 +55,12 @@ with st.expander("Visualizing PMM Dynamic Indicators", expanded=True): st.write("### Executors Distribution") st.write("The order distributions are affected by the average NATR. This means that if the first order has a spread of " "1 and the NATR is 0.005, the first order will have a spread of 0.5% of the mid price.") -buy_spread_distributions, sell_spread_distributions, buy_order_amounts_pct, sell_order_amounts_pct = get_executors_distribution_inputs() +buy_spread_distributions, sell_spread_distributions, buy_order_amounts_pct, sell_order_amounts_pct = get_executors_distribution_inputs(use_custom_spread_units=True) inputs["buy_spreads"] = [spread * 100 for spread in buy_spread_distributions] inputs["sell_spreads"] = [spread * 100 for spread in sell_spread_distributions] inputs["buy_amounts_pct"] = buy_order_amounts_pct inputs["sell_amounts_pct"] = sell_order_amounts_pct -st.session_state["default_config"] = inputs +st.session_state["default_config"].update(inputs) with st.expander("Executor Distribution:", expanded=True): natr_avarage = spreads_multiplier.mean() buy_spreads = [spread * natr_avarage for spread in inputs["buy_spreads"]] @@ -84,4 +84,4 @@ if bt_results: st.write("---") render_close_types(bt_results["results"]) st.write("---") -render_save_config("pmm_dynamic", inputs) +render_save_config(st.session_state["default_config"]["id"], st.session_state["default_config"]) diff --git a/frontend/pages/config/pmm_simple/app.py b/frontend/pages/config/pmm_simple/app.py index 28b9c75..69d60b5 100644 --- a/frontend/pages/config/pmm_simple/app.py +++ b/frontend/pages/config/pmm_simple/app.py @@ -17,11 +17,14 @@ from frontend.visualization.backtesting_metrics import render_backtesting_metric initialize_st_page(title="PMM Simple", icon="👨‍🏫") backend_api_client = BackendAPIClient.get_instance(host=BACKEND_API_HOST, port=BACKEND_API_PORT) + # Page content st.text("This tool will let you create a config for PMM Simple, backtest and upload it to the Backend API.") get_default_config_loader("pmm_simple") + inputs = user_inputs() +st.session_state["default_config"].update(inputs) with st.expander("Executor Distribution:", expanded=True): fig = create_executors_distribution_traces(inputs["buy_spreads"], inputs["sell_spreads"], inputs["buy_amounts_pct"], inputs["sell_amounts_pct"], inputs["total_amount_quote"]) st.plotly_chart(fig, use_container_width=True) @@ -41,4 +44,4 @@ if bt_results: st.write("---") render_close_types(bt_results["results"]) st.write("---") -render_save_config("pmm_simple", inputs) +render_save_config(st.session_state["default_config"]["id"], st.session_state["default_config"]) diff --git a/frontend/pages/config/pmm_simple/user_inputs.py b/frontend/pages/config/pmm_simple/user_inputs.py index 69ff319..b160481 100644 --- a/frontend/pages/config/pmm_simple/user_inputs.py +++ b/frontend/pages/config/pmm_simple/user_inputs.py @@ -35,5 +35,4 @@ def user_inputs(): "trailing_delta": ts_delta } } - st.session_state["default_config"] = config return config