refactor: remove erosion radio buttons and FMP API testing section from navbar

This commit is contained in:
Pascal BIBEHE 2025-05-30 21:09:35 +02:00
parent 7db493893e
commit 5775d25e72

View File

@ -1427,7 +1427,6 @@ def test_fmp_connection() -> bool:
logger.info(f"FMP API call count: {st.session_state.api_calls}")
if response.status_code == 200:
st.success("Successfully connected to FMP API")
return True
else:
st.error(f"Failed to connect to FMP API: {response.status_code}")
@ -1866,23 +1865,15 @@ with st.sidebar:
index=1
)
# Erosion options
enable_erosion = st.radio(
"Enable NAV & Yield Erosion",
["Yes", "No"],
index=1
)
# Run simulation button
if st.button("Run Portfolio Simulation", type="primary", use_container_width=True):
if not st.session_state.etf_allocations:
st.error("Please add at least one ETF to your portfolio.")
else:
try:
# Store parameters in session state
# Store simulation parameters in session state
st.session_state.mode = simulation_mode
st.session_state.enable_drip = enable_drip == "Yes"
st.session_state.enable_erosion = enable_erosion == "Yes"
st.session_state.enable_erosion = True
if simulation_mode == "Income Target":
st.session_state.target = monthly_target
@ -1919,11 +1910,6 @@ with st.sidebar:
else:
st.error("Failed to fetch ETF data. Please check your tickers and try again.")
except Exception as e:
st.error(f"Error running simulation: {str(e)}")
logger.error(f"Error in simulation: {str(e)}")
logger.error(traceback.format_exc())
# Add reset simulation button at the bottom of sidebar
if st.button("🔄 Reset Simulation", use_container_width=True, type="secondary"):
reset_simulation()
@ -1983,12 +1969,6 @@ with st.sidebar:
parallel_processing = st.checkbox("Enable Parallel Processing", value=True,
help="Fetch data for multiple ETFs simultaneously")
# Add FMP API test button
st.sidebar.subheader("FMP API Testing")
if st.sidebar.button("Test FMP API", key="test_fmp_api_button"):
test_fmp_data_fetching()
st.sidebar.success("Test completed. Check logs for details.")
# Display results and interactive allocation adjustment UI after simulation is run
if st.session_state.simulation_run and st.session_state.df_data is not None:
df = st.session_state.df_data