diff options
Diffstat (limited to 'services/data_service.py')
| -rw-r--r-- | services/data_service.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/services/data_service.py b/services/data_service.py index 0399c58..5ac8573 100644 --- a/services/data_service.py +++ b/services/data_service.py @@ -146,6 +146,32 @@ def get_next_earnings_date(ticker: str) -> str | None: @st.cache_data(ttl=3600) +def get_insider_transactions(ticker: str) -> pd.DataFrame: + """Return insider transactions from yfinance. + Columns: Shares, URL, Text, Insider, Position, Transaction, Start Date, Ownership, Value + """ + try: + t = yf.Ticker(ticker.upper()) + df = t.insider_transactions + return df if df is not None and not df.empty else pd.DataFrame() + except Exception: + return pd.DataFrame() + + +@st.cache_data(ttl=3600) +def get_sec_filings(ticker: str) -> list[dict]: + """Return SEC filings from yfinance. + Each dict has: date, type, title, edgarUrl, exhibits. + """ + try: + t = yf.Ticker(ticker.upper()) + filings = t.sec_filings + return filings if filings else [] + except Exception: + return [] + + +@st.cache_data(ttl=3600) def get_free_cash_flow_series(ticker: str) -> pd.Series: """Return annual Free Cash Flow series (most recent first).""" t = yf.Ticker(ticker.upper()) |
