(feat) update default configs in pages

This commit is contained in:
cardosofede
2024-06-06 02:29:41 +02:00
parent e9085437e9
commit aa9e137281
4 changed files with 9 additions and 7 deletions

View File

@@ -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)
render_save_config(st.session_state["default_config"]["id"], st.session_state["default_config"])

View File

@@ -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"])

View File

@@ -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"])

View File

@@ -35,5 +35,4 @@ def user_inputs():
"trailing_delta": ts_delta
}
}
st.session_state["default_config"] = config
return config