From 44d94eeb00ab7114ee857d4407221b0d3c5ce911 Mon Sep 17 00:00:00 2001 From: Pascal Date: Sat, 24 May 2025 15:24:15 +0000 Subject: [PATCH] refactor: remove duplicate cache management and API testing sections --- pages/ETF_Portfolio_Builder.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/pages/ETF_Portfolio_Builder.py b/pages/ETF_Portfolio_Builder.py index 629b34c..d1fd587 100644 --- a/pages/ETF_Portfolio_Builder.py +++ b/pages/ETF_Portfolio_Builder.py @@ -1,5 +1,20 @@ -# --- Imports & Settings --- import streamlit as st +st.set_page_config( + page_title="ETF Dividend Portfolio Builder", + page_icon="💼", + layout="wide", + initial_sidebar_state="expanded" +) + +# Add navigation in sidebar +with st.sidebar: + st.markdown("### Navigation") + if st.button("🏠 ETF Suite Launcher", key="launcher_portfolio"): + st.switch_page("ETF_Suite_Launcher.py") + if st.button("📈 ETF Analyzer", key="analyzer_portfolio"): + st.switch_page("ETF_Analyzer.py") + +# --- Imports & Settings --- import pandas as pd import plotly.express as px import plotly.graph_objects as go @@ -2031,7 +2046,6 @@ def analyze_etf_erosion_risk(tickers: List[str], debug: bool = False) -> pd.Data return pd.DataFrame(risk_data) # --- Streamlit Setup --- -st.set_page_config(page_title="ETF Dividend Portfolio Builder", layout="wide") st.title("💸 ETF Dividend Portfolio Builder") # Initialize session state for real-time updates @@ -2362,7 +2376,7 @@ with st.sidebar.expander("Advanced Options"): # Cache clearing options col1, col2 = st.columns(2) with col1: - if st.button("Clear All Cache"): + if st.button("Clear All Cache", key="clear_all_cache"): clear_cache() st.success("All cache files cleared!") st.session_state.api_calls = 0 @@ -2440,10 +2454,6 @@ if st.session_state.get("run_fmp_test", False): # Run the API test function test_fmp_api() - # Add button to return to main app - if st.button("Return to Main App"): - st.rerun() - # Stop execution to prevent the main app from rendering st.stop() @@ -3328,4 +3338,6 @@ if st.session_state.simulation_run and st.session_state.df_data is not None: "ETF_Portfolio_Plan.pdf", mime="application/pdf", use_container_width=True - ) \ No newline at end of file + ) + +# End of file \ No newline at end of file