austrian-cpi
Version:
Query and merge Austrian CPI time series data for economic modeling
114 lines (85 loc) β’ 4.83 kB
Markdown
# austrian-cpi v1.0.9
## Lightweight utilities for querying, merging & **using** Austrian Consumer-Price-Index (CPI) time-series in JavaScript / Node.js
**Last Update: 19.7.2025 (Next Update: 21.08.2025)**
A lightweight, zero-dependency helper for working with Austrian CPI tables from Statistik Austriaβperfect for dashboards, data-science notebooks, web applications, Node.js backend services, or quick forward- and backward-inflation adjustments and pricing algorithms based on the main/primary Austrian CPI Basket.
---
## π¦ Installation
```bash
npm install austrian-cpi
```
### NPM Link
View on NPM: https://www.npmjs.com/package/austrian-cpi
### As Standalone
Clone or download this repo and include `austrian-cpi/src/*.js`.
## Features
- **Query CPI** by month (`YYYY-MM`) or year (`YYYY`)
- **Filter** one or many CPI series (e.g. `vpi_2020`, `khpi`)
- Supports **monthly and yearly** frequencies
- **Export** any result to CSV
- **Merge** CPI rows into external datasets on the shared `date` key
- Retrieve the **latest (Month-over-Month, Year-over-Year) CPI value** for any series
- Compute **rate-of-change (RoC)**
- between the latest two observations
- between arbitrary two `start β end` dates
- **EXPERIMENTAL: Functions to convert nominal prices to real buying power euros based on series and reference date point**
- `convertPrice()` β single value
- `convertPrices()` β vectorised version for full arrays
*Note: All helpers support seamless **monthly β yearly fallback**, so you still get results when a monthly observation is missing but a yearly value for the CPI time series exists.
## π Quick start
```js
import {
/* ββ Queries API, merging & export ββββββββββββββββββββββββ-----βββββ---------ββββ */
queryCPI, mergeWith, exportToCSV,
/* ββ Latest Value and RoC & rateβofβchange over window computations ββββββββββ---- */
getLatestValue, getLatestRateOfChange, getRateOfChange,
/* ββ EXPERIMENTAL: Constantβprice conversion βββββββββββββββββββββββββββββββββββββ */
convertPrice, convertPrices, deflateSeries,
/* ββ EXPERIMENTAL: Inflation metrics βββββββββββββββββββββββββββββββββββββββββββββ */
inflationRate, inflationSeries, annualiseRate,
/* ββ EXPERIMENTAL: Real growth βββββββββββββββββββββββββββββββββββββββββββββββββββ */
realCAGR,
} from "austrian-cpi";
/* 1 β query CPI rows for different CPI series, iff existing */
const cpi = queryCPI("2010-01", "2015-12", {
frequency: "monthly",
series: ["vpi_2020", "khpi"],
});
console.table(cpi);
/* 2 β merge with your data & export as CSV */
const sales = [
{ date: "2012-05", sales: 100 },
{ date: "2013-09", sales: 105 },
];
console.log(exportToCSV(mergeWith(cpi, sales)));
/* 3 β latest value & latest Month-over-Month (MoM), Year-over-Year (YoY) change */
console.log(getLatestValue("vpi_66", "monthly"));
console.log(getLatestRateOfChange("vpi_66", "monthly"));
/* 4 β EXPERIMENTAL: Custom rateβofβchange window */
console.log(
getRateOfChange("vpi_66", { start: "2022-01", end: "2023-12" }),
);
/* 5 β EXPERIMENTAL: deflate prices to constant euros */
const basket = [
{ date: "2022-11", price: 14.9 },
{ date: "2023-08", price: 16.0 },
];
const real = convertPrices(basket, {
baseDate: "2021-01",
seriesKey: "vpi_2010",
});
console.table(real);
/* 6 β EXPERIMENTAL: monthly inflation series & annualised rate */
const months2023 = Array.from({ length: 12 }, (_, i) => `${2023}-${String(i + 1).padStart(2, "0")}`);
console.table(inflationSeries(months2023, { seriesKey: "vpi_2020" }));
console.log("Annualised +1Β % monthly:", (annualiseRate(0.01, 12) * 100).toFixed(2), "%");
/* 7 β EXPERIMENTAL: real CAGR */
console.log(
"Real CAGR 2020β11 β 2024β12:",
(realCAGR(14.99, "2020-11", 19.99, "2024-12", { seriesKey: "vpi_66" }) * 100).toFixed(2), "%Β p.a.");
```
## Data and Legal Disclaimer
This package includes historical Austrian CPI data derived from publicly available statistics by Statistik Austria.
It is not an official source. Use for informational or modeling purposes only. For legally binding or financial decisions, verify against the official data.
(π https://www.statistik.at/statistiken/volkswirtschaft-und-oeffentliche-finanzen/preise-und-preisindizes/verbraucherpreisindex-vpi/hvpi, Last Update: 19.7.2025, Additional formats (.ods, .pdf) and details available under "Detailergebnisse" on Statistik Austria's page.)
## License
MIT