aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: c98a3635c62008fa253e6fcde540c12ad3ff4148 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# 🔷 Prism

A local financial analysis dashboard. Enter any stock ticker to get a formatted view of financial statements, valuation metrics, a DCF model, and a news feed — all in your browser.

---

## Features

- **Market Bar** — Live S&P 500, NASDAQ, DOW, and VIX at the top of every page
- **Overview** — Price chart (1M / 3M / 6M / 1Y / 5Y), key stats (market cap, P/E, 52W range, beta)
- **Financials** — Annual and quarterly Income Statement, Balance Sheet, and Cash Flow Statement with year-over-year % change columns
- **Valuation** — Key ratios grid (P/E, EV/EBITDA, margins, ROE, etc.), interactive DCF model with adjustable WACC and growth rate, comparable companies table
- **News** — Recent articles with Bullish / Bearish / Neutral sentiment badges and a 7-day sentiment summary

---

## Setup

### 1. Clone / navigate to the project

```bash
cd ~/Work/prism
```

### 2. Activate the virtual environment

```bash
source .venv/bin/activate
```

### 3. Add API keys

```bash
cp .env.example .env
```

Open `.env` and fill in your keys:

```
FMP_API_KEY=your_key_here
FINNHUB_API_KEY=your_key_here
```

Both are **free**:
- **FMP** (Financial Modeling Prep) — [financialmodelingprep.com](https://financialmodelingprep.com/developer/docs) — 250 requests/day
- **Finnhub** — [finnhub.io](https://finnhub.io) — 60 requests/minute

> **No keys?** The app still works. Price data, financials, and market indices are sourced from `yfinance` (no key required). Ratios, comps, and news won't load until keys are added.

### 4. Run the app

```bash
streamlit run app.py
```

Opens at `http://localhost:8501`

---

## Daily Usage

```bash
cd ~/Work/prism
source .venv/bin/activate
streamlit run app.py
```

---

## Project Structure

```
prism/
├── app.py                    # Entry point
├── requirements.txt
├── .env                      # Your API keys (not committed)
├── .env.example              # Key template
├── .streamlit/
│   └── config.toml           # Dark theme + layout settings
├── services/
│   ├── data_service.py       # yfinance — price, financials, indices
│   ├── fmp_service.py        # FMP API — ratios, peers
│   ├── news_service.py       # Finnhub — news + sentiment
│   └── valuation_service.py  # DCF engine (Gordon Growth Model)
├── components/
│   ├── market_bar.py         # Index metrics row
│   ├── overview.py           # Company header + price chart
│   ├── financials.py         # Statement tables
│   ├── valuation.py          # Ratios, DCF, comps
│   └── news.py               # News feed
└── utils/
    └── formatters.py         # Number formatting helpers
```

---

## DCF Model Notes

The DCF model uses **5 years of historical Free Cash Flow** from yfinance to compute an average growth rate, then projects forward using your chosen assumptions:

| Input | Default | Range |
|---|---|---|
| WACC | 10% | 5–20% |
| Terminal Growth Rate | 2.5% | 0.5–5% |
| Projection Years | 5 | 3–10 |

The model uses the **Gordon Growth Model** for terminal value. Intrinsic value per share is compared against the current market price to show upside/downside.

---

## API Rate Limits

| Source | Limit | Used For |
|---|---|---|
| yfinance | None | Price, financials, indices |
| FMP (free) | 250 req/day | Ratios, comps, news |
| Finnhub (free) | 60 req/min | News, sentiment |

Data is cached in-memory per session to minimize API calls (financials: 1h, news: 10min, indices: 5min).