timeprice 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +55 -0
- data/DATA_LICENSES.md +2 -1
- data/README.md +20 -4
- data/data/cpi/eu.json +422 -397
- data/data/cpi/jp.json +91 -72
- data/data/cpi/uk.json +529 -504
- data/data/cpi/us.json +507 -476
- data/data/cpi/vn.json +368 -37
- data/data/fx/usd/1999.json +281 -524
- data/data/fx/usd/2000.json +277 -516
- data/data/fx/usd/2001.json +276 -511
- data/data/fx/usd/2002.json +277 -513
- data/data/fx/usd/2003.json +277 -513
- data/data/fx/usd/2004.json +281 -521
- data/data/fx/usd/2005.json +279 -520
- data/data/fx/usd/2006.json +277 -513
- data/data/fx/usd/2007.json +277 -513
- data/data/fx/usd/2008.json +278 -515
- data/data/fx/usd/2009.json +278 -515
- data/data/fx/usd/2010.json +280 -522
- data/data/fx/usd/2011.json +279 -520
- data/data/fx/usd/2012.json +278 -515
- data/data/fx/usd/2013.json +277 -513
- data/data/fx/usd/2014.json +277 -513
- data/data/fx/usd/2015.json +278 -515
- data/data/fx/usd/2016.json +279 -520
- data/data/fx/usd/2017.json +277 -513
- data/data/fx/usd/2018.json +277 -513
- data/data/fx/usd/2019.json +277 -513
- data/data/fx/usd/2020.json +279 -517
- data/data/fx/usd/2021.json +280 -522
- data/data/fx/usd/2022.json +279 -520
- data/data/fx/usd/2023.json +277 -513
- data/data/fx/usd/2024.json +278 -515
- data/data/fx/usd/2025.json +22 -3
- data/data/fx/usd/2026.json +22 -3
- data/data/fx/usd/_annual.json +145 -0
- data/data/manifest.json +90 -0
- data/lib/timeprice/cli/presenters/compare.rb +3 -1
- data/lib/timeprice/cli/presenters/inflation.rb +2 -1
- data/lib/timeprice/compare.rb +3 -2
- data/lib/timeprice/cpi_lookup.rb +9 -7
- data/lib/timeprice/data_loader.rb +42 -7
- data/lib/timeprice/errors.rb +4 -4
- data/lib/timeprice/exchange.rb +34 -17
- data/lib/timeprice/granularity.rb +46 -0
- data/lib/timeprice/inflation.rb +6 -19
- data/lib/timeprice/sources/coverage.rb +27 -32
- data/lib/timeprice/sources.rb +5 -5
- data/lib/timeprice/supported.rb +39 -22
- data/lib/timeprice/version.rb +1 -1
- data/lib/timeprice.rb +2 -2
- metadata +4 -15
- data/data/fx/usd/1983.json +0 -12
- data/data/fx/usd/1986.json +0 -12
- data/data/fx/usd/1987.json +0 -12
- data/data/fx/usd/1988.json +0 -12
- data/data/fx/usd/1989.json +0 -12
- data/data/fx/usd/1990.json +0 -12
- data/data/fx/usd/1991.json +0 -12
- data/data/fx/usd/1992.json +0 -12
- data/data/fx/usd/1993.json +0 -12
- data/data/fx/usd/1994.json +0 -12
- data/data/fx/usd/1995.json +0 -12
- data/data/fx/usd/1996.json +0 -12
- data/data/fx/usd/1997.json +0 -12
- data/data/fx/usd/1998.json +0 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f5a76db32571e7ab2f09f9e22e1d90d420b5bdcf474baff6b523f2c8998c72b
|
|
4
|
+
data.tar.gz: 96e212aaa5aac2cfe4defc28364498ef49241de34161cb3e301f4886a19650d0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4148766e8c3dee2243ed933868d23cb2d79959db1581d07de654e1bab87325de98eacb2cd41200e1f765f3d94dde03472dc5d02a37e2e2f059fc8a651ac40666
|
|
7
|
+
data.tar.gz: a51e3132f616bc0e468b0f9afdff9ab71a2017abd25eed5ffd45cecc4c385d58f4670ffeeb5cc8bc5f4143f639a42d92f88a2d6e4f81957171d6c3207982d5ee
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,61 @@ Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.5.0] - 2026-05-11
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- **Schema v2 → v3.** Breaking change to the bundled data contract. v0.4.x
|
|
12
|
+
data files will not load on v0.5.0.
|
|
13
|
+
- New top-level `data/manifest.json` — single source of truth for which
|
|
14
|
+
countries and currencies the bundle supports. `Supported.countries` /
|
|
15
|
+
`Supported.currencies` derive from it at runtime; the hardcoded Ruby
|
|
16
|
+
constants `Supported::COUNTRIES` / `CURRENCIES` are gone. Custom callers
|
|
17
|
+
that referenced those constants must switch to the method form.
|
|
18
|
+
- CPI files use nested `series: { monthly, annual }` and a structured
|
|
19
|
+
`index: { base_period, rebased_at }` block in place of the freeform
|
|
20
|
+
`base_year` string. Top-level `source` and `updated_at` removed —
|
|
21
|
+
`providers[]` is the source of truth for provenance.
|
|
22
|
+
- FX year files now carry `provenance` + `providers` blocks, symmetric
|
|
23
|
+
with CPI.
|
|
24
|
+
- All annual FX (today only VND from World Bank) lives in
|
|
25
|
+
`data/fx/usd/_annual.json` — the single canonical source, every year.
|
|
26
|
+
Per-year files (`data/fx/usd/<year>.json`) hold daily rates only. Pre-1999
|
|
27
|
+
stub year files are gone. `Exchange.lookup_usd_base` collapses to a
|
|
28
|
+
two-tier chain (daily → annual fallback), one source per tier.
|
|
29
|
+
|
|
30
|
+
## [0.4.0] - 2026-05-11
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- **Schema v1 → v2.** Two structural data-layer changes, bundled under a
|
|
34
|
+
single bump:
|
|
35
|
+
- FX year files gain an optional top-level `annual` block. World Bank's
|
|
36
|
+
annual VND/USD average is stored there exactly once per year instead of
|
|
37
|
+
being broadcast across every daily date key. `Exchange.lookup_usd_base`
|
|
38
|
+
falls back from daily to annual when no daily entry exists within ±7
|
|
39
|
+
days and tags the result with `Granularity::ANNUAL`. `Compare` merges
|
|
40
|
+
FX granularity with CPI granularity (worst-precision wins).
|
|
41
|
+
- CPI provenance moves from a per-period map (`{"2025-01": "bls", ...}`)
|
|
42
|
+
to a compact range list (`[{series, from, to, provider}, ...]`). Single
|
|
43
|
+
-provider files (US/UK/EU/JP) collapse to 1–2 ranges; VN keeps the
|
|
44
|
+
WB→IMF transition explicit. ~42 kb saved across the 5 CPI files; one
|
|
45
|
+
real US data gap at 2025-10 is now visible instead of buried.
|
|
46
|
+
- `country_file.rb` rebase label now preserves the original base reference
|
|
47
|
+
alongside the rebase date (e.g. `"2010=100 (rebased 2026-05-11)"`).
|
|
48
|
+
|
|
49
|
+
### Added
|
|
50
|
+
- Multi-source CPI chain for Vietnam: IMF Data Portal CPI dataflow
|
|
51
|
+
(`api.imf.org`, SDMX 2.1) is the monthly primary; World Bank `FP.CPI.TOTL`
|
|
52
|
+
remains as the annual fallback. The on-disk `data/cpi/vn.json` gains two
|
|
53
|
+
additive fields — `provenance` (per-period source id) and `providers`
|
|
54
|
+
(per-source status array) — so consumers can see which upstream supplied
|
|
55
|
+
each datapoint. Schema version is unchanged; old readers ignore the new
|
|
56
|
+
fields. Other country files (US, UK, EU, JP) gain the same fields on the
|
|
57
|
+
next refresh.
|
|
58
|
+
- Internal: `Sources::Provider` / `Sources::CountryFile` / `Sources::MergePolicy`
|
|
59
|
+
seam for layering multiple providers into a single country file with
|
|
60
|
+
per-period provenance. Designed so future fresher sources (e.g. JP via
|
|
61
|
+
e-Stat) can be added as one more entry without further plumbing.
|
|
62
|
+
|
|
8
63
|
## [0.3.0] - 2026-05-11
|
|
9
64
|
|
|
10
65
|
### Added
|
data/DATA_LICENSES.md
CHANGED
|
@@ -12,7 +12,8 @@ string.
|
|
|
12
12
|
| UK Office for National Statistics | `D7BT` (UK CPI all-items) | Open Government Licence v3.0 | https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/ | Contains public sector information licensed under the Open Government Licence v3.0 |
|
|
13
13
|
| Eurostat | `prc_hicp_midx` (Euro area HICP) | Eurostat reuse policy — free reuse with source attribution | https://ec.europa.eu/eurostat/about-us/policies/copyright | Source: Eurostat |
|
|
14
14
|
| World Bank | `FP.CPI.TOTL` (JP CPI fallback) | Creative Commons Attribution 4.0 International (CC BY 4.0) | https://datacatalog.worldbank.org/public-licenses#cc-by | Source: World Bank, FP.CPI.TOTL |
|
|
15
|
-
| World Bank | `FP.CPI.TOTL` (VN CPI) | Creative Commons Attribution 4.0 International (CC BY 4.0) | https://datacatalog.worldbank.org/public-licenses#cc-by | Source: World Bank, FP.CPI.TOTL |
|
|
15
|
+
| World Bank | `FP.CPI.TOTL` (VN CPI, annual fallback) | Creative Commons Attribution 4.0 International (CC BY 4.0) | https://datacatalog.worldbank.org/public-licenses#cc-by | Source: World Bank, FP.CPI.TOTL |
|
|
16
|
+
| International Monetary Fund | CPI dataflow `VNM.CPI._T.IX.M` via IMF Data Portal (VN CPI, monthly primary) | Free reuse with attribution per IMF terms | https://www.imf.org/external/terms.htm | Source: IMF Data Portal CPI dataflow |
|
|
16
17
|
| European Central Bank (via Frankfurter) | Daily reference rates, USD base, EUR/GBP/JPY | ECB reference rates — free reuse; Frankfurter is a non-commercial republisher with no separate license | https://www.ecb.europa.eu/services/disclaimer/html/index.en.html | FX data: European Central Bank reference rates via Frankfurter |
|
|
17
18
|
| World Bank | `PA.NUS.FCRF` (VND annual average FX, broadcast daily) | Creative Commons Attribution 4.0 International (CC BY 4.0) | https://datacatalog.worldbank.org/public-licenses#cc-by | VND FX: World Bank, PA.NUS.FCRF |
|
|
18
19
|
|
data/README.md
CHANGED
|
@@ -98,11 +98,12 @@ Coverage is derived from the bundled `data/` files. Re-check with `timeprice sou
|
|
|
98
98
|
| United Kingdom | GBP | ONS CPI all-items (`D7BT`) | Monthly + annual | 1988-01 → present |
|
|
99
99
|
| Eurozone (EA) | EUR | Eurostat HICP (`prc_hicp_midx`) | Monthly + annual | 1996-01 → present |
|
|
100
100
|
| Japan | JPY | World Bank `FP.CPI.TOTL` (fallback) | Annual | 1960 → 2024 |
|
|
101
|
-
| Vietnam | VND | World Bank `FP.CPI.TOTL` |
|
|
101
|
+
| Vietnam | VND | IMF Data Portal CPI dataflow (monthly primary) + World Bank `FP.CPI.TOTL` (annual fallback) | Monthly + annual | 1995 → present |
|
|
102
102
|
|
|
103
103
|
**FX (USD base):** ECB reference rates via Frankfurter for **EUR / GBP / JPY**, daily
|
|
104
|
-
1999 → present. **VND** uses the World Bank annual average (`PA.NUS.FCRF`)
|
|
105
|
-
|
|
104
|
+
1999 → present. **VND** uses the World Bank annual average (`PA.NUS.FCRF`), one value
|
|
105
|
+
per year, from 1983 → present. VND results are tagged `granularity: :annual` so callers
|
|
106
|
+
know they got the annual fallback rather than a daily rate.
|
|
106
107
|
|
|
107
108
|
Triangulated cross-rates (e.g. GBP → JPY) go through USD on the same effective date.
|
|
108
109
|
Weekend/holiday dates fall back up to 7 days to the nearest prior trading day.
|
|
@@ -258,13 +259,28 @@ license — see `DATA_LICENSES.md` and `NOTICE` for the full table and license U
|
|
|
258
259
|
- **UK CPI:** Contains public sector information licensed under the Open Government Licence v3.0.
|
|
259
260
|
- **Eurozone HICP:** Source: Eurostat (reuse permitted with attribution).
|
|
260
261
|
- **Japan CPI (fallback):** Source: World Bank, FP.CPI.TOTL (CC BY 4.0).
|
|
261
|
-
- **Vietnam CPI:**
|
|
262
|
+
- **Vietnam CPI:** Sources: IMF Data Portal CPI dataflow (monthly primary); World Bank, FP.CPI.TOTL (annual fallback, CC BY 4.0).
|
|
262
263
|
- **FX rates:** European Central Bank reference rates via Frankfurter.
|
|
263
264
|
- **VND FX (annual broadcast):** World Bank, PA.NUS.FCRF (CC BY 4.0).
|
|
264
265
|
|
|
265
266
|
If you redistribute results derived from this gem, reproduce the relevant attribution
|
|
266
267
|
strings. `timeprice sources` prints them in plain text and as JSON.
|
|
267
268
|
|
|
269
|
+
## Data format
|
|
270
|
+
|
|
271
|
+
Bundled data lives under `data/` in schema v3 and is self-describing:
|
|
272
|
+
|
|
273
|
+
- `data/manifest.json` — the supported set (countries, currencies, FX years).
|
|
274
|
+
- `data/cpi/<country>.json` — CPI for one country: `series.{monthly,annual}`,
|
|
275
|
+
structured `index` block, `provenance` ranges, `providers` attribution.
|
|
276
|
+
- `data/fx/usd/<year>.json` — daily USD-base FX rates for one year (one file
|
|
277
|
+
per year, EUR/GBP/JPY).
|
|
278
|
+
- `data/fx/usd/_annual.json` — annual USD-base FX rates across all years for
|
|
279
|
+
currencies sourced at annual resolution (today only VND). Used as the
|
|
280
|
+
fallback tier when no daily rate covers the requested date.
|
|
281
|
+
|
|
282
|
+
`scripts/check_schema_stability.rb` enforces the shape in CI.
|
|
283
|
+
|
|
268
284
|
## Author
|
|
269
285
|
|
|
270
286
|
Built by [Patrick](https://github.com/patrick204nqh).
|