UNPKG

austrian-cpi

Version:

Query and merge Austrian CPI time series data for economic modeling

69 lines (51 loc) • 4.5 kB
## 📖 API short reference (incomplete) & available series ### 1. `queryCPI(start, end, { frequency, series })` | Parameter | Type / Allowed values | Default | Description | |-------------|-------------------------------------------|-----------|---------------------------------------------------------------| | `start` | `string` (`YYYY` **or** `YYYY-MM`) | — | First observation (inclusive) | | `end` | `string` (`YYYY` **or** `YYYY-MM`) | — | Last observation (inclusive) | | `frequency` | `'monthly'` \| `'yearly'` | `'monthly'` | Return monthly or yearly rows | | `series` | `string[]` | `[]` | Which CPI columns to include & parse as `number` in the result | > Returns `Array<{ date: string, [seriesKey]: number|null }>` > Cells without an official observation are returned as `null`. --- ### 2. `convertPrice(price, priceDate, { seriesKey, frequency, baseDate })` | Option | Default | Meaning | |--------------|--------------|------------------------------------------------------------------------------------------| | `seriesKey` | `'index'` | Column to use for deflation (any key listed below) | | `frequency` | `'monthly'` | CPI granularity that matches `priceDate` | | `baseDate` | *latest obs* | Reference date whose CPI becomes **100 %** in the output value | --- ### 3. `convertPrices(priceRows, { seriesKey, frequency, baseDate })` Vectorised version of `convertPrice`. Each object in `priceRows` must contain `{ date: string, price: number }`. The function appends two fields: | Field | Meaning | |-------|-----------------------------------------| | `cpi` | CPI value used for that row | | `real`| Price expressed in “`baseDate` euros” | --- ### 4. CPI **series keys** Below is the complete column set shipped with **v1.0.4** – pass any of them to `series` (array) or `seriesKey` (single-value) options. Numbers shown are *example* values from a single recent monthly row; `"None"` means the column exists but did **not** yet have an observation for that date. | Key | Example value | Description (Statistik-Austria shorthand) | |-----------|--------------:|------------------------------------------------------------------| | `vpi_2020`| `"None"` | **VPI** (base year 2020 = 100) | | `vpi_2015`| `"None"` | VPI (base 2015) | | `vpi_2010`| `"None"` | VPI (base 2010) | | `vpi_2005`| `"None"` | VPI (base 2005) | | `vpi_2000`| `"None"` | VPI (base 2000) | | `vpi_96` | `"None"` | VPI (base 1996) | | `vpi_86` | **113.1** | VPI (base 1986) | | `vpi_76` | **175.9** | VPI (base 1976) | | `vpi_66` | **308.6** | VPI (base 1966) | | `vpi_i` | **393.2** | VPI index I (“Inländerkonzept”) | | `vpi_ii` | **394.5** | VPI index II (“Gebietskonzept”) | | `khpi` | **2977.9** | **KHPI** (harmonised index of consumer prices, EU methodology) | | `lhki_45` | **3455.3** | **LHKI** weighting pattern 45 % (large households, housing cost) | | `lhki_38` | **2934.8** | LHKI weighting pattern 38 % | | `index` | — | Alias to the current headline VPI base (usually `vpi_2020`) | > **Tip:** call `queryCPI("2020-01","2020-01")` without a `series` array to inspect *all* columns and confirm the current base alias. --- *The series list is updated whenever **Statistik Austria** revises or rebases the CPI. Use `getLatestValue("vpi_2020")` to programmatically discover new keys at runtime.*