# ETF charts

External component: premium/discount history line (current and prior year) plus a premium-frequency table. Points and counts come live from the strategies feed; labels come from the `data` field.

## Fields & Schema

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `externalComponentType` | Symbol | Yes | Must be `"ETF charts"` |
| `heading` | Text | No | Section heading, used when `data.premiumHeading` is absent. |
| `data.premiumHeading` | string | No | Heading; overrides `heading`. |
| `data.asOfPrefix` | string | No | Prefix for the trade date shown beside the heading (for example `as of`). Without it the bare date shows. |
| `data.currentLabel`, `data.priorLabel` | string | No | Tab labels for the current-year and prior-year line. Tabs show only when **both** are set; otherwise only the current-year line draws. |
| `data.seriesName` | string | No | Name of the plotted series. |
| `data.premiumRows` | array | No | Frequency table rows: `{ "field", "label" }`. `field` must be `premiumCount`, `navCount` or `discountCount`; other rows are dropped. No valid rows means no table. |
| `data.quarterPattern` | string | No | Column label for each completed quarter, with `{quarter}` and `{year}` placeholders. Without it no quarter columns. |
| `data.priorYearPattern` | string | No | Prior-year column label, with `{year}`. |
| `data.sinceInception` | string | No | Label for the since-inception column. |
| `data.premiumNote` | string | No | Footnote shown in a disclosure box under the table. |

The component takes no other fields. Figures are never stored in the entry. If the feed fails, the page shows "Premium and discount history is temporarily unavailable." and no table. The table has a column only where the feed has data for it (incomplete quarters are skipped).

## Usage

```bash
# Add the component
cms-edit add "ETF charts" --content-type externalComponent --target content

# Set labels and table rows
cms-edit set @ref data --json '{"premiumHeading":"Premium / Discount","asOfPrefix":"as of","currentLabel":"2026","priorLabel":"2025","premiumRows":[{"field":"premiumCount","label":"Days at premium"},{"field":"navCount","label":"Days at NAV"},{"field":"discountCount","label":"Days at discount"}],"quarterPattern":"Q{quarter} {year}","priorYearPattern":"{year}","sinceInception":"Since inception","premiumNote":"Past performance does not guarantee future results."}'

cms-edit save
```

`set data --json` replaces the whole object. Read the current `data` first and change only the key you mean to.
