164 lines
3.8 KiB
Python
164 lines
3.8 KiB
Python
#!/usr/bin/env python
|
|
"""
|
|
ETF Portal Launcher
|
|
|
|
This script serves as the main entry point for the ETF Portal.
|
|
"""
|
|
|
|
import streamlit as st
|
|
import os
|
|
|
|
# Basic page config
|
|
st.set_page_config(
|
|
page_title="ETF Portal",
|
|
page_icon="📊",
|
|
layout="wide",
|
|
menu_items={
|
|
'Get Help': None,
|
|
'Report a bug': None,
|
|
'About': None
|
|
}
|
|
)
|
|
|
|
# Initialize session state for API keys if not already present
|
|
if 'fmp_api_key' not in st.session_state:
|
|
st.session_state.fmp_api_key = os.getenv('FMP_API_KEY', '')
|
|
if 'openai_api_key' not in st.session_state:
|
|
st.session_state.openai_api_key = os.getenv('OPENAI_API_KEY', '')
|
|
|
|
# Custom CSS for improved UI
|
|
st.markdown("""
|
|
<style>
|
|
/* Global text color */
|
|
.stMarkdown, .stTitle, h1, h2, h3, p, li {
|
|
color: white !important;
|
|
}
|
|
|
|
.main-content {
|
|
margin-left: 250px;
|
|
padding: 20px;
|
|
}
|
|
|
|
.welcome-section {
|
|
text-align: left;
|
|
margin: 2rem 0;
|
|
}
|
|
|
|
.welcome-section h2 {
|
|
color: white;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.welcome-section p {
|
|
color: white;
|
|
margin: 0.5rem 0;
|
|
}
|
|
|
|
.footer {
|
|
text-align: center;
|
|
margin-top: 40px;
|
|
padding: 20px;
|
|
color: white;
|
|
font-size: 0.9rem;
|
|
}
|
|
|
|
/* Style for the sidebar */
|
|
[data-testid="stSidebar"] {
|
|
background-color: transparent;
|
|
}
|
|
|
|
[data-testid="stSidebar"] .stTextInput {
|
|
margin-top: 40px;
|
|
}
|
|
|
|
[data-testid="stSidebar"] .stTextInput label {
|
|
color: white;
|
|
font-size: 0.8rem;
|
|
}
|
|
|
|
[data-testid="stSidebar"] .stTextInput input {
|
|
font-size: 0.8rem;
|
|
padding: 4px 8px;
|
|
background-color: #2d2d2d;
|
|
border: 1px solid #28a745;
|
|
color: white;
|
|
}
|
|
|
|
/* Button styles */
|
|
.stButton button {
|
|
width: 100%;
|
|
padding: 1rem;
|
|
margin: 1rem 0;
|
|
font-size: 1.2rem;
|
|
background-color: #28a745;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 5px;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
.stButton button:hover {
|
|
background-color: #218838;
|
|
}
|
|
|
|
.button-container {
|
|
display: flex;
|
|
gap: 2rem;
|
|
margin: 2rem 0;
|
|
}
|
|
|
|
.button-column {
|
|
flex: 1;
|
|
}
|
|
</style>
|
|
""", unsafe_allow_html=True)
|
|
|
|
# Create sidebar for API keys
|
|
with st.sidebar:
|
|
st.markdown("### API Configuration")
|
|
openai_key = st.text_input(
|
|
"OpenAI API Key",
|
|
value=st.session_state.openai_api_key,
|
|
type="password",
|
|
key="openai_api_key_field"
|
|
)
|
|
if openai_key != st.session_state.openai_api_key:
|
|
st.session_state.openai_api_key = openai_key
|
|
|
|
# Main content
|
|
st.markdown('<div class="main-content">', unsafe_allow_html=True)
|
|
|
|
# Title with emoji
|
|
st.title("📊 ETF Portal")
|
|
|
|
# Introduction
|
|
st.markdown("""
|
|
<div class='welcome-section'>
|
|
<h2>Welcome to the ETF Portal</h2>
|
|
<p style='font-size: 1.2rem;'>Your gateway to ETF analysis and portfolio management.</p>
|
|
<p style='font-size: 1.1rem;'>The portal is currently under maintenance. Please check back later for updates.</p>
|
|
</div>
|
|
""", unsafe_allow_html=True)
|
|
|
|
# Create two columns for the buttons
|
|
col1, col2 = st.columns(2)
|
|
|
|
# ETF Analyzer Button
|
|
with col1:
|
|
if st.button("📈 Launch ETF Analyzer", key="analyzer"):
|
|
st.switch_page("pages/ETF_Analyzer.py")
|
|
|
|
# Portfolio Builder Button
|
|
with col2:
|
|
if st.button("💼 Launch Portfolio Builder", key="portfolio"):
|
|
st.switch_page("pages/ETF_Portfolio_Builder.py")
|
|
|
|
st.markdown('</div>', unsafe_allow_html=True)
|
|
|
|
# Footer with more information
|
|
st.markdown("""
|
|
<div class="footer">
|
|
<p style='margin: 0;'>ETF Portal - v1.0 | © 2024 ETF Portal</p>
|
|
<p style='margin: 0;'>For support or questions, please contact the development team.</p>
|
|
</div>
|
|
""", unsafe_allow_html=True) |