File size: 3,380 Bytes
be0ffe1
 
 
 
 
c640d64
 
be0ffe1
4e15a8a
 
 
 
d4f513a
2f9f231
4e15a8a
660df29
4e15a8a
d4f513a
 
 
 
4e15a8a
d4f513a
4e15a8a
d4f513a
4e15a8a
d4f513a
 
 
 
 
660df29
4e15a8a
d4f513a
4e15a8a
d4f513a
4e15a8a
d4f513a
4e15a8a
660df29
4e15a8a
ab0239b
d4f513a
 
 
ab0239b
d4f513a
ab0239b
d4f513a
 
 
 
ab0239b
d4f513a
ab0239b
d4f513a
ab0239b
d4f513a
 
 
 
 
 
 
 
 
 
 
 
ab0239b
d4f513a
ab0239b
d4f513a
 
 
 
 
 
 
 
ab0239b
d4f513a
 
 
 
 
 
 
ab0239b
 
d4f513a
ab0239b
d4f513a
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
---
title: LensIQ
emoji: 🏢
colorFrom: gray
colorTo: pink
sdk: docker
app_port: 7860
pinned: false
short_description: CAPM + CML portfolio advisor w/ embeddings
models:
  - FinLang/finance-embeddings-investopedia
datasets:
  - Tulitula/LensIQ-Synthetic-Portfolio-1000
---

# LensIQ

- **Plot:** x = historical σ (annualized, from monthly covariances), y = CAPM E[r] = rf + β·ERP.  
- **Efficient mixes:** market/bills with (i) same σ, (ii) same E[r] as your portfolio (weights shown).  
- **Suggestions:** one Low/Medium/High, from 1,000 long-only mixes built **from your tickers** (+ VOO), ranked with CAPM + embeddings (MMR).  
- **Export:** every run writes a CSV of all 1,000 candidates in `data/`.

> Include **VOO** in your portfolio before computing.

## Run Locally

```bash
docker build -t lensiq .
docker run -p 7860:7860 -e GRADIO_SERVER_NAME=0.0.0.0 lensiq
# open http://localhost:7860
Create & Upload the Dataset
In the app, add tickers, set amounts, horizon, lookback → Compute.

Download the generated CSV from the UI (saved under data/).

Create a dataset repo on Hugging Face named Tulitula/LensIQ-Synthetic-Portfolio-1000 and upload:

the CSV you downloaded

the dataset README from below 


**B) Dataset README (for `Tulitula/LensIQ-Synthetic-Portfolio-1000`)**
```markdown
# LensIQ Synthetic Portfolio 1000

Synthetic portfolio dataset generated by the LensIQ app for CAPM/CML-based analysis and ranking.

- **Size:** 1,000 rows (per export)
- **Modality:** Tabular (text fields for lists)
- **License:** CC BY 4.0
- **Intended use:** Research/teaching on portfolio construction, risk/return modeling, ranking/retrieval. *Not financial advice.*

## Generation Process

Given a user universe **U** (their tickers + `VOO` as market):

1. Sample `k ~ U{2…min(8, |U|)}` tickers from **U** (no replacement).  
2. Draw long-only weights `w ~ Dirichlet(1,…,1)`.  
3. Compute:
   - Prices: Yahoo Finance monthly (auto-adjusted), last *N* years (lookback).
   - Risk-free `rf`: FRED tenor chosen by horizon (e.g., DGS10).
   - Market `m`: `VOO`.
   - Market ERP `= E[m] − rf` (from monthly returns, annualized).
   - Asset betas vs. market (excess returns).
   - **mu_capm** `= rf + β_p·ERP`, where `β_p = Σ_i w_i β_i`.
   - **sigma_hist**: annualized portfolio σ from monthly covariance.
   - **sigma_capm**: `|β_p| · σ_market` (for reference to CML).
4. Rank candidates with CAPM metrics + finance embeddings (MMR) to surface Low/Medium/High picks in the app.

## Columns

| column       | type   | description                                            |
|--------------|--------|--------------------------------------------------------|
| `tickers`    | string | comma-separated tickers in the candidate mix          |
| `weights`    | string | comma-separated floats summing to 1 (long-only)       |
| `beta`       | float  | portfolio beta (weighted by `weights`)                |
| `mu_capm`    | float  | CAPM expected annual return                           |
| `sigma_hist` | float  | annualized historical σ from covariance               |
| `sigma_capm` | float  | CAPM σ on the CML for equivalent return               |

**Example row**
tickers: "VOO,QQQ,IBIT"
weights: "0.53,0.41,0.06"
beta: 1.18
mu_capm: 0.153
sigma_hist: 0.209
sigma_capm: 0.191


## Files

- `investor_profiles_<timestamp>.csv` — 1,000 synthetic candidates.