diff options
| author | Tyler <tyler@tylerhoang.xyz> | 2026-03-28 23:01:14 -0700 |
|---|---|---|
| committer | Tyler <tyler@tylerhoang.xyz> | 2026-03-28 23:01:14 -0700 |
| commit | 23675b39b8055a8568cdcf71f66482b9d0cf90a9 (patch) | |
| tree | 14e42cf710b47072e904b1c21d7322352ae1823c /components/market_bar.py | |
Initial commit — Prism financial analysis dashboard
Streamlit app with market bar, price chart, financial statements,
DCF valuation engine, comparable companies, and news feed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'components/market_bar.py')
| -rw-r--r-- | components/market_bar.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/components/market_bar.py b/components/market_bar.py new file mode 100644 index 0000000..cb813e5 --- /dev/null +++ b/components/market_bar.py @@ -0,0 +1,25 @@ +"""Market bar — displays major indices at the top of the app.""" +import streamlit as st +from services.data_service import get_market_indices +from utils.formatters import fmt_number + + +def render_market_bar(): + indices = get_market_indices() + + cols = st.columns(len(indices)) + for col, (name, data) in zip(cols, indices.items()): + price = data.get("price") + change_pct = data.get("change_pct") + + if price is None: + col.metric(label=name, value="—") + continue + + price_str = f"{price:,.2f}" + delta_str = f"{change_pct * 100:+.2f}%" if change_pct is not None else None + col.metric( + label=name, + value=price_str, + delta=delta_str, + ) |
