aboutsummaryrefslogtreecommitdiff
path: root/CLAUDE.md
blob: a9a6607ce83a24cdc35589509f15e61cf2bf4e81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Running the app

```bash
source .venv/bin/activate
streamlit run app.py
```

Opens at `http://localhost:8501`. The `.venv/` virtual environment has all dependencies pre-installed.

## Architecture

Prism is a single-page Streamlit dashboard. `app.py` is the entry point — it owns the sidebar, injects global CSS, renders the market bar, and mounts the four tab components.

**Data flow:** `app.py` → `components/` → `services/` → external APIs

- `services/data_service.py` — all yfinance calls (price history, financials, market indices, ticker search). No API key required.
- `services/fmp_service.py` — Financial Modeling Prep REST calls (ratios, peers, news). Requires `FMP_API_KEY` in `.env`.
- `services/news_service.py` — Finnhub REST calls (company news, sentiment). Requires `FINNHUB_API_KEY` in `.env`.
- `services/valuation_service.py` — pure Python DCF engine (Gordon Growth Model). Takes a FCF `pd.Series` + assumptions, returns a dict with per-year breakdown. No external calls.

Every service function that hits a network is wrapped with `@st.cache_data(ttl=...)`. TTLs: financials 1h, news 10min, indices 5min, search 60s.

**Components** (`components/`) are stateless render functions called `render_*(ticker)`. Each catches its own exceptions so one failing panel doesn't break the page.

## Environment

Copy `.env.example` → `.env` and fill in keys. Without keys, yfinance-backed features (price, financials, indices, search) still work; FMP and Finnhub features return empty gracefully.

## Theme / styling

`.streamlit/config.toml` sets the dark theme and `sans serif` font. Global metric/heading sizing is overridden via injected CSS at the top of `app.py` — adjust there if layout feels too large or small.