timeprice 0.4.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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/README.md +18 -2
  4. data/data/cpi/eu.json +406 -403
  5. data/data/cpi/jp.json +78 -75
  6. data/data/cpi/uk.json +513 -510
  7. data/data/cpi/us.json +488 -485
  8. data/data/cpi/vn.json +342 -339
  9. data/data/fx/usd/1999.json +23 -7
  10. data/data/fx/usd/2000.json +23 -7
  11. data/data/fx/usd/2001.json +23 -7
  12. data/data/fx/usd/2002.json +23 -7
  13. data/data/fx/usd/2003.json +23 -7
  14. data/data/fx/usd/2004.json +23 -7
  15. data/data/fx/usd/2005.json +23 -7
  16. data/data/fx/usd/2006.json +23 -7
  17. data/data/fx/usd/2007.json +23 -7
  18. data/data/fx/usd/2008.json +23 -7
  19. data/data/fx/usd/2009.json +23 -7
  20. data/data/fx/usd/2010.json +23 -7
  21. data/data/fx/usd/2011.json +23 -7
  22. data/data/fx/usd/2012.json +23 -7
  23. data/data/fx/usd/2013.json +23 -7
  24. data/data/fx/usd/2014.json +23 -7
  25. data/data/fx/usd/2015.json +23 -7
  26. data/data/fx/usd/2016.json +23 -7
  27. data/data/fx/usd/2017.json +23 -7
  28. data/data/fx/usd/2018.json +23 -7
  29. data/data/fx/usd/2019.json +23 -7
  30. data/data/fx/usd/2020.json +23 -7
  31. data/data/fx/usd/2021.json +23 -7
  32. data/data/fx/usd/2022.json +23 -7
  33. data/data/fx/usd/2023.json +23 -7
  34. data/data/fx/usd/2024.json +23 -7
  35. data/data/fx/usd/2025.json +24 -5
  36. data/data/fx/usd/2026.json +24 -5
  37. data/data/fx/usd/_annual.json +145 -0
  38. data/data/manifest.json +90 -0
  39. data/lib/timeprice/compare.rb +1 -1
  40. data/lib/timeprice/cpi_lookup.rb +2 -2
  41. data/lib/timeprice/data_loader.rb +42 -7
  42. data/lib/timeprice/errors.rb +4 -4
  43. data/lib/timeprice/exchange.rb +8 -8
  44. data/lib/timeprice/inflation.rb +2 -2
  45. data/lib/timeprice/sources/coverage.rb +27 -32
  46. data/lib/timeprice/supported.rb +39 -22
  47. data/lib/timeprice/version.rb +1 -1
  48. data/lib/timeprice.rb +2 -2
  49. metadata +3 -15
  50. data/data/fx/usd/1983.json +0 -11
  51. data/data/fx/usd/1986.json +0 -11
  52. data/data/fx/usd/1987.json +0 -11
  53. data/data/fx/usd/1988.json +0 -11
  54. data/data/fx/usd/1989.json +0 -11
  55. data/data/fx/usd/1990.json +0 -11
  56. data/data/fx/usd/1991.json +0 -11
  57. data/data/fx/usd/1992.json +0 -11
  58. data/data/fx/usd/1993.json +0 -11
  59. data/data/fx/usd/1994.json +0 -11
  60. data/data/fx/usd/1995.json +0 -11
  61. data/data/fx/usd/1996.json +0 -11
  62. data/data/fx/usd/1997.json +0 -11
  63. data/data/fx/usd/1998.json +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a91644504f73e6324d522d189233539a5515ca51cf0be58b1a34da90ff78220d
4
- data.tar.gz: f6120dc38bb433e1dc8ac56e523b3c547d9323b578f34a27bddee3e43b48c9a2
3
+ metadata.gz: 6f5a76db32571e7ab2f09f9e22e1d90d420b5bdcf474baff6b523f2c8998c72b
4
+ data.tar.gz: 96e212aaa5aac2cfe4defc28364498ef49241de34161cb3e301f4886a19650d0
5
5
  SHA512:
6
- metadata.gz: b8b0f99a9962bad944a02499761a586e860d50a3707e70de4d1549c6bf624ea5bf1a9d1d2beae488abdfc6646d825320259a196bfac177e64c25edab90e721e5
7
- data.tar.gz: 54bb2545e7c9f9bbdb202994f3d5f53bb020a36bde0a2d8627c734a1c0e4312fcbe0237ce2b23409af9253ddc809ae74129dec43b17b94c559bcefa8917142cf
6
+ metadata.gz: 4148766e8c3dee2243ed933868d23cb2d79959db1581d07de654e1bab87325de98eacb2cd41200e1f765f3d94dde03472dc5d02a37e2e2f059fc8a651ac40666
7
+ data.tar.gz: a51e3132f616bc0e468b0f9afdff9ab71a2017abd25eed5ffd45cecc4c385d58f4670ffeeb5cc8bc5f4143f639a42d92f88a2d6e4f81957171d6c3207982d5ee
data/CHANGELOG.md CHANGED
@@ -5,6 +5,28 @@ 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
+
8
30
  ## [0.4.0] - 2026-05-11
9
31
 
10
32
  ### Changed
data/README.md CHANGED
@@ -101,8 +101,9 @@ Coverage is derived from the bundled `data/` files. Re-check with `timeprice sou
101
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`) broadcast to
105
- every day in the year, from 1983 → present.
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.
@@ -265,6 +266,21 @@ license — see `DATA_LICENSES.md` and `NOTICE` for the full table and license U
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).