refactor: remove duplicate cache management and API testing sections

This commit is contained in:
Pascal BIBEHE 2025-05-24 15:24:15 +00:00
parent 1f8b5920d0
commit 44d94eeb00

View File

@ -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
)
)
# End of file