Skip to content

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 every domain or only Economy:

Terminal window
pip install mostlyrightmd
pip install mostlyrightmd-economy
pnpm add mostlyright
pnpm add @mostlyrightmd/economy
from mostlyright import economy

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.

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.

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 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= 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.

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.