Faham commited on
Commit
d1ac8aa
Β·
1 Parent(s): a88ab54

UPDATE: sidebar ui updated

Browse files
Files changed (1) hide show
  1. Home.py +19 -43
Home.py CHANGED
@@ -13,7 +13,6 @@ from bs4 import BeautifulSoup
13
  import importlib.util
14
  import requests
15
  import holidays
16
- from datetime import datetime, timedelta
17
 
18
  try:
19
  from prophet import Prophet
@@ -1048,67 +1047,44 @@ def main():
1048
  # Sidebar for ticker selection
1049
  st.sidebar.header("πŸ“Š Stock Selection")
1050
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1051
  # Add search functionality
1052
  st.sidebar.subheader("πŸ” Search Custom Ticker")
1053
  custom_ticker = st.sidebar.text_input(
1054
- "Enter ticker symbol (e.g., AAPL, TSLA):",
1055
  placeholder="Enter ticker symbol...",
1056
  key="custom_ticker_input",
1057
  )
1058
 
1059
  # Add info button with helpful information
1060
- with st.sidebar.expander("ℹ️ Can't find your ticker in the list?", expanded=False):
1061
- st.markdown(
1062
- """
1063
- **Can't find your ticker in the list?**
1064
-
1065
- Use this search box to check if a ticker is available:
1066
-
1067
- βœ… **How it works:**
1068
- - Enter any ticker symbol (e.g., AAPL, TSLA, GOOGL)
1069
- - If found, it will be automatically added to the dropdown
1070
- - You can then select it from the "Popular Stocks" list below
1071
-
1072
- βœ… **Examples:**
1073
- - `AAPL` β†’ Apple Inc.
1074
- - `TSLA` β†’ Tesla Inc.
1075
- - `MSFT` β†’ Microsoft Corporation
1076
- - `GOOGL` β†’ Alphabet Inc.
1077
-
1078
- βœ… **Tips:**
1079
- - Use uppercase letters for best results
1080
- - Most major US and international stocks are supported
1081
- - If not found, the ticker might not be available on Yahoo Finance
1082
- """
1083
- )
1084
-
1085
  if custom_ticker:
1086
  custom_ticker = custom_ticker.upper().strip()
1087
  if custom_ticker:
1088
  # Search for the custom ticker
1089
  company_name = search_ticker(custom_ticker)
1090
  if company_name:
1091
- st.sidebar.success(f"βœ… Found: {custom_ticker} - {company_name}")
 
 
1092
  # Add to available tickers temporarily
1093
  available_tickers[custom_ticker] = company_name
1094
  else:
1095
  st.sidebar.error(f"❌ Could not find ticker: {custom_ticker}")
1096
 
1097
- st.sidebar.subheader("πŸ“‹ Popular Stocks")
1098
-
1099
- # Only show selectbox if tickers are loaded
1100
- if available_tickers and len(available_tickers) > 0:
1101
- selected_ticker = st.sidebar.selectbox(
1102
- "Choose a stock ticker:",
1103
- options=list(available_tickers.keys()),
1104
- format_func=lambda x: f"{x} - {available_tickers[x]}",
1105
- index=None,
1106
- placeholder="Select a ticker...",
1107
- )
1108
- else:
1109
- st.sidebar.error("❌ Failed to load tickers. Please refresh the page.")
1110
- selected_ticker = None
1111
-
1112
  # Clear cache when ticker changes
1113
  if (
1114
  "current_ticker" in st.session_state
 
13
  import importlib.util
14
  import requests
15
  import holidays
 
16
 
17
  try:
18
  from prophet import Prophet
 
1047
  # Sidebar for ticker selection
1048
  st.sidebar.header("πŸ“Š Stock Selection")
1049
 
1050
+ st.sidebar.subheader("πŸ“‹ Popular Stocks")
1051
+
1052
+ # Only show selectbox if tickers are loaded
1053
+ if available_tickers and len(available_tickers) > 0:
1054
+ selected_ticker = st.sidebar.selectbox(
1055
+ "Choose a stock ticker:",
1056
+ options=list(available_tickers.keys()),
1057
+ format_func=lambda x: f"{x} - {available_tickers[x]}",
1058
+ index=None,
1059
+ placeholder="Select a ticker...",
1060
+ )
1061
+ else:
1062
+ st.sidebar.error("❌ Failed to load tickers. Please refresh the page.")
1063
+ selected_ticker = None
1064
+
1065
  # Add search functionality
1066
  st.sidebar.subheader("πŸ” Search Custom Ticker")
1067
  custom_ticker = st.sidebar.text_input(
1068
+ "Enter ticker symbol, if not found in above dropdown (e.g., AAPL, TSLA):",
1069
  placeholder="Enter ticker symbol...",
1070
  key="custom_ticker_input",
1071
  )
1072
 
1073
  # Add info button with helpful information
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1074
  if custom_ticker:
1075
  custom_ticker = custom_ticker.upper().strip()
1076
  if custom_ticker:
1077
  # Search for the custom ticker
1078
  company_name = search_ticker(custom_ticker)
1079
  if company_name:
1080
+ st.sidebar.success(
1081
+ f"βœ… Found: {custom_ticker} - {company_name} -> Added to dropdown list above."
1082
+ )
1083
  # Add to available tickers temporarily
1084
  available_tickers[custom_ticker] = company_name
1085
  else:
1086
  st.sidebar.error(f"❌ Could not find ticker: {custom_ticker}")
1087
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1088
  # Clear cache when ticker changes
1089
  if (
1090
  "current_ticker" in st.session_state