From 2b229cff5f99a00b6cc984f4c1c3c41de7f1e04c Mon Sep 17 00:00:00 2001 From: Tyler Date: Sun, 17 May 2026 00:06:36 -0700 Subject: Add 1D and 5D intraday periods to overview chart Adds get_intraday_history() to data_service.py (5m/30m bars, ttl=60s) and wires it into the overview chart with HH:MM x-axis formatting, market-hours filtering, intraday-only primary fetch, hidden comparison buttons, and 1D as the default period on load. Co-Authored-By: Claude Sonnet 4.6 --- services/data_service.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'services/data_service.py') diff --git a/services/data_service.py b/services/data_service.py index 9c82e14..c481014 100644 --- a/services/data_service.py +++ b/services/data_service.py @@ -102,6 +102,20 @@ def get_price_history(ticker: str, period: str = "1y") -> pd.DataFrame: return pd.DataFrame() +@st.cache_data(ttl=60) +def get_intraday_history(ticker: str, period: str, interval: str) -> pd.DataFrame | None: + """Return intraday OHLCV history. Use period='1d'/interval='5m' or period='5d'/interval='30m'.""" + try: + t = yf.Ticker(ticker.upper()) + df = t.history(period=period, interval=interval) + if df is None or df.empty: + return None + df.index = pd.to_datetime(df.index) + return df + except Exception: + return None + + @st.cache_data(ttl=3600) def get_income_statement(ticker: str, quarterly: bool = False) -> pd.DataFrame: try: -- cgit v1.3-2-g0d8e