Economy
Read CPI, payrolls, unemployment, GDP, jobless claims, producer prices, and Fed decisions without replacing earlier publications. Each row identifies the period it describes and when that value became available.
from mostlyright import economy
cpi = economy.series( "cpi", "2024-01-01", "2025-06-01",)Install and import
Section titled “Install and import”Install every domain or only Economy:
pip install mostlyrightmdpip install mostlyrightmd-economypnpm add mostlyrightpnpm add @mostlyrightmd/economyfrom mostlyright import economyRead a series
Section titled “Read a series”series() returns the first publication selected by the SDK’s settlement policy unless you request every revision:
first_prints = economy.series( "cpi", "2024-01-01", "2025-06-01",)
all_revisions = economy.series( "cpi", "2024-01-01", "2025-06-01", vintages="all",)The returned rows include the indicator, observation period, value, unit, source, publication vintage, and knowledge time. A later revision is another row. It does not replace the value that was available earlier.
Read what was available at a cutoff
Section titled “Read what was available at a cutoff”snapshot() returns settlement-grade values with a publication vintage at or before the cutoff:
from datetime import datetime, timezone
then = economy.snapshot( "cpi", as_of=datetime(2025, 4, 1, tzinfo=timezone.utc),)If no qualifying first-print vintage existed by the cutoff, the call raises IndicatorNotYetReleasedError; it does not return a guessed value.
Check the release calendar
Section titled “Check the release calendar”releases() returns typed events, not formatted strings:
for event in economy.releases("nfp"): print(event.period, event.release_datetime, event.agency)Each event includes indicator, period, a timezone-aware UTC release_datetime, and agency.
TypeScript
Section titled “TypeScript”TypeScript returns the same row schema in a { rows, provenance } result:
import { releases, series, snapshot } from "@mostlyrightmd/economy";
const history = await series( "cpi", new Date("2024-01-01T00:00:00Z"), new Date("2025-06-01T00:00:00Z"), { vintages: "all" },);
const then = await snapshot({ indicator: "cpi", asOf: new Date("2025-04-01T00:00:00Z"),});
const upcoming = releases("nfp");Source and delivery
Section titled “Source and delivery”source= names provenance: fred, bls, bea, dol, or fed, depending on the indicator. The default selects the relevant authority.
delivery="live" calls public agency APIs from your runtime. Hosted economy delivery is not implemented; delivery="hosted" raises SourceUnavailableError.
First prints and credentials
Section titled “First prints and credentials”BLS reads without a BLS_API_KEY can return latest-revised values. Settlement-grade first publications for CPI, payrolls, unemployment, producer prices, GDP, and jobless claims generally require a free FRED_API_KEY because those vintages come from ALFRED. Fed decisions remain available without that key.
The SDK does not persist FRED-derived rows by default. The current FRED terms prohibit storing, caching, or archiving FRED content and using it to train machine-learning systems. Do not enable MOSTLYRIGHT_PERSIST_FRED=1 or use FRED-derived rows for model training unless you have separate rights that permit it.
See also
Section titled “See also”- Temporal safety:
KnowledgeView, cutoffs, and leakage checks - Credentials: source-specific keys
- Cache behavior: local persistence and invalidation
- Python Economy API
- TypeScript Economy API