aboutsummaryrefslogtreecommitdiff
path: root/app.py
diff options
context:
space:
mode:
authorOpenclaw <openclaw@mail.tylerhoang.xyz>2026-03-29 01:33:07 -0700
committerOpenclaw <openclaw@mail.tylerhoang.xyz>2026-03-29 01:33:07 -0700
commitb1e129bff08076fcd7dfe3ef9c3a98c8f1712a26 (patch)
treeb669a1fcaa126fc7f8f81bbae698e37d4e4e2c94 /app.py
parent547997cbd069e9b958b12a8da38b3a4a257e29e5 (diff)
Improve UX and disable DCF for financials
Diffstat (limited to 'app.py')
-rw-r--r--app.py44
1 files changed, 27 insertions, 17 deletions
diff --git a/app.py b/app.py
index 78b503f..6db7f0a 100644
--- a/app.py
+++ b/app.py
@@ -63,6 +63,10 @@ from components.news import render_news
from services.data_service import get_company_info, search_tickers
+if "ticker" not in st.session_state:
+ st.session_state["ticker"] = "AAPL"
+
+
# ── Sidebar ──────────────────────────────────────────────────────────────────
with st.sidebar:
@@ -70,34 +74,40 @@ with st.sidebar:
st.caption("Financial Analysis Dashboard")
st.divider()
- # Search input
- query = st.text_input(
- "Search company or ticker",
- placeholder="e.g. Apple, AAPL, MSFT…",
- key="search_query",
- ).strip()
+ with st.form("ticker_search_form", clear_on_submit=False):
+ query = st.text_input(
+ "Search company or ticker",
+ placeholder="e.g. Apple, AAPL, MSFT…",
+ key="search_query",
+ ).strip()
+
+ results = search_tickers(query) if query else []
+ selected_symbol = None
- # Autocomplete: show results if query looks like a search term (not a bare ticker)
- selected_symbol = None
- if query:
- results = search_tickers(query)
if results:
options = {f"{r['symbol']} — {r['name']} ({r['exchange']})": r["symbol"] for r in results}
choice = st.selectbox(
- "Select",
+ "Matches",
options=list(options.keys()),
label_visibility="collapsed",
)
selected_symbol = options[choice]
- else:
- # Treat the raw input as a direct ticker
+ elif query:
selected_symbol = query.upper()
- if st.button("Analyze", use_container_width=True, type="primary"):
- if selected_symbol:
- st.session_state["ticker"] = selected_symbol
+ submitted = st.form_submit_button("Open", use_container_width=True, type="primary")
+
+ if submitted and selected_symbol:
+ st.session_state["ticker"] = selected_symbol
+
+ st.caption(f"Currently viewing: **{st.session_state['ticker']}**")
+
+ quick_cols = st.columns(4)
+ for col, symbol in zip(quick_cols, ["AAPL", "MSFT", "NVDA", "JPM"]):
+ if col.button(symbol, use_container_width=True):
+ st.session_state["ticker"] = symbol
- ticker = st.session_state.get("ticker", "AAPL")
+ ticker = st.session_state["ticker"]
# Quick company info in sidebar
st.divider()