--- 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_.csv` — 1,000 synthetic candidates.