Liking cljdoc? Tell your friends :D

commensura.cpi.fred

Fetch CPI (BLS series CPIAUCNS) from the FRED API and build the cpi data map — shared by the dev refresh task (commensura.cpi.fetch) and the runtime live source (commensura.cpi). HTTP+JSON via commensura.http. Values are kept exact rationals (CPIAUCNS is not seasonally adjusted, so it is never revised). Fetch/parse failures throw an ex-info tagged :cpi/source-error so callers can fall back to the shipped data.

Fetch CPI (BLS series CPIAUCNS) from the FRED API and build the cpi data map — shared by the dev
refresh task (`commensura.cpi.fetch`) and the runtime live source (`commensura.cpi`). HTTP+JSON via
`commensura.http`. Values are kept **exact rationals** (CPIAUCNS is not seasonally adjusted, so it is
never revised). Fetch/parse failures throw an ex-info tagged `:cpi/source-error` so callers can fall
back to the shipped data.
raw docstring

build-cpiclj

(build-cpi observations)

Observations ([[y m] rational]) -> the cpi data map: exact monthly series, annual averages (mean of a year's available months), and :current (the latest period = the 'current dollar').

Observations (`[[y m] rational]`) -> the cpi data map: exact monthly series, annual averages (mean
of a year's available months), and `:current` (the latest period = the 'current dollar').
sourceraw docstring

date->periodclj

(date->period s)

A "YYYY-MM-DD" date -> [year month], or nil.

A "YYYY-MM-DD" date -> [year month], or nil.
sourceraw docstring

fetch-cpiclj

(fetch-cpi api-key)

Fetch the full CPIAUCNS series from FRED and build the cpi data map. Throws an ex-info tagged :cpi/source-error on any network/parse failure.

Fetch the full CPIAUCNS series from FRED and build the cpi data map. Throws an ex-info tagged
`:cpi/source-error` on any network/parse failure.
sourceraw docstring

sourceclj

(source api-key)
(source api-key ttl-ms)

A cached live-FRED CPI source: a 0-arg fn returning the cpi data map, re-fetching at most once per ttl-ms (default 6h). A fetch failure is negative-cached for the same window and re-thrown (tagged :cpi/source-error) so the caller can fall back to shipped data — without hammering FRED.

A cached live-FRED CPI source: a 0-arg fn returning the cpi data map, re-fetching at most once per
`ttl-ms` (default 6h). A fetch failure is negative-cached for the same window and re-thrown (tagged
`:cpi/source-error`) so the caller can fall back to shipped data — without hammering FRED.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close