# Macro & Fed Calendar from Official Sources (`dusty_tumbler/macro-fed-calendar`) Actor

Economic release dates, FOMC meetings/minutes, Fed speeches and Treasury auctions from official US sources (Fed, BLS, BEA, Treasury, Census, FHFA, FRED). Times in ET. No scraping of commercial sites.

- **URL**: https://apify.com/dusty_tumbler/macro-fed-calendar.md
- **Developed by:** [Anuar Elias](https://apify.com/dusty_tumbler) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Macro & Fed Calendar from Official Sources API (v0.2.0)

Economic release dates, FOMC meetings/minutes, Fed speeches and testimony, and Treasury auctions, normalized from **official US sources only**: Federal Reserve Board, BLS, BEA, Treasury Fiscal Data, U.S. Census Bureau (economic-indicator calendar), FHFA (house price index release dates), plus optional FRED/ALFRED. All times are **America/New_York (ET)**.

> This product uses the FRED® API but is not endorsed or certified by the Federal Reserve Bank of St. Louis. By using the FRED features you agree to the [FRED API Terms of Use](https://fred.stlouisfed.org/docs/api/terms_of_use.html). Not affiliated with or endorsed by the Federal Reserve, BLS, BEA, U.S. Treasury, U.S. Census Bureau or FHFA. Importance levels are our own classification. Not investment advice. See TERMS.md.

### Event schema

| field | type | notes |
|---|---|---|
| id | str | stable sha1(source,date,time,event)\[:16] |
| sources | list\[str] | every source reporting this event, e.g. `["bls","fred"]` after a merge; the `source` filter matches any entry |
| date | YYYY-MM-DD | ET |
| time_et | HH:MM or null | null when the source gives only a date (Treasury, FRED) |
| datetime_et | ISO 8601 with offset, or null | |
| source | fed, bls, bea, treasury, census, fhfa, fred | |
| event, category | str | category: economic_release, monetary_policy, fed_speech, fed_testimony, fed_statistical_release, treasury_auction |
| importance | high, medium, low | editorial rules in `macro_calendar/importance.py` |
| previous, actual, unit | float/str or null | FRED safe series only (CPI, NFP, real GDP, PCE price, PPI) |
| details | object | source-specific (cusip, offering_amt, description, release_id...) |
| source_url, attribution | str | always populated |

### Run locally

```bash
python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements-dev.txt   # required before pytest: test deps (pytest) are not in requirements.txt
cp .env.example .env   # set MACRO_USER_AGENT (contact email); FRED_API_KEY optional
set -a; . ./.env; set +a
pytest -q                                   # offline, fixtures only (network is blocked in tests)
uvicorn macro_calendar.api:app --port 8000  # HTTP API, docs at /docs
python main.py                              # one-shot JSON (reads ./input.json if present)
```

### HTTP API

- FRED source: curated US releases by default (set `FRED_ALL_RELEASES=1` for all). On Apify the key comes **only** from the buyer's own `fredApiKey` input (secret field; no env or file fallback); without it FRED is skipped with a warning. Local CLI/API dev may use `FRED_API_KEY` or `.fred_key`. The key is redacted (`api_key=REDACTED`) from all errors and logs and never appears in dataset rows. Value enrichment checks each series' FRED notes and skips any series marked third-party copyrighted.
- `GET /events?from=YYYY-MM-DD&to=YYYY-MM-DD&source=bls,bea&importance=medium&q=CPI&limit=500`. `importance` is a minimum: `medium` returns high and medium.
- `GET /next?n=5&importance=high&source=fed`: the next upcoming events after now (ET).
- `GET /sources`: endpoints and attribution. `GET /health`: status, cache size, per-source errors.
- If one source fails, the other sources still return results. The failure is reported in `errors`/`source_errors`. Stale cache is served when a fetch fails.

### Caching and politeness

On-disk cache in `MACRO_CACHE_DIR` (TTL 1h for Fed/Treasury, 6h for BLS/BEA/FRED). The in-process API refreshes every 15 min, with ≥1s between requests to the same host.

### Apify actor

`main.py`, `.actor/actor.json`, `.actor/input_schema.json`, `Dockerfile`. Input: **contactEmail** (needed for BLS: it goes in the HTTP User-Agent `macro-calendar/0.1 (contact: <email>)`, is never written to output, and without it BLS returns 403), sources, daysBack/daysAhead or from/to, minImportance, query, fredApiKey (secret, the user's own key). Default memory is 256 MB. Output: one dataset item per event, and a `SOURCE_ERRORS` key-value record.

### Layout

`macro_calendar/sources/{fed,bls,bea,treasury,census,fhfa,fred}.py` hold the fetchers and parsers. `ics.py` is the iCal parser, `http.py` handles cache and rate limiting, `aggregator.py` does filtering and sorting, `api.py` is the FastAPI app. `tests/` holds offline tests and fixtures. The FRED fixtures are synthetic. The others are trimmed real responses captured 2026-10-11 (Census/FHFA pages captured 2026-10-12).

### Known gaps / roadmap

Census and FHFA give dates only (no values; the Census Data API is not used, so no Census key is needed). FHFA gives no release time. NAR existing-home sales: not built, pending a terms-of-use review. **S\&P CoreLogic Case-Shiller: deliberately excluded** (proprietary, licensed S\&P data); the actor does not fetch it from any source, including FRED. No consensus forecasts. Treasury and FRED have no release times. FRED values attach to the release *event*: `actual` is the latest published observation, so for a future release date it is really the latest known value. A value-history endpoint (ALFRED first prints) is planned for later.

### Cross-source de-duplication

When FRED and an official agency (BLS, BEA, Census, Fed) list the same release on the same date, one row is kept (`macro_calendar/dedupe.py`). Matching is an explicit table `FRED_TO_AGENCY` (normalized FRED release name -> agency + normalized agency-name prefix), never fuzzy. The agency row wins for date, time, name, id and `source_url`; FRED's previous/actual/unit are copied in when the agency row has none; FRED release/series ids and URL go into `details`; `sources` lists both; both attributions are kept. FRED rows with no mapped match (e.g. weekly jobless claims, or a different date) stay as `source=fred`. The number merged is logged on every run.

### Sources

| source id | Publisher | What | Endpoint | Times | Key |
|---|---|---|---|---|---|
| fed | Federal Reserve Board | FOMC, minutes, speeches, testimony | federalreserve.gov/json/calendar.json | yes | none |
| bls | BLS | CPI, jobs, PPI, JOLTS, ... | bls.gov/schedule/news_release/bls.ics | yes | none (contactEmail) |
| bea | BEA | GDP, PCE/income, trade | bea.gov iCal | yes | none |
| treasury | U.S. Treasury Fiscal Data | auctions | api.fiscaldata.treasury.gov | no | none |
| census | U.S. Census Bureau | housing starts & permits, new home sales, retail sales, durable goods, construction spending, advance economic indicators (goods trade) | https://www.census.gov/economic-indicators/calendar-listview.html + calendar-listview-{year}.html (HTML) | yes | none |
| fhfa | Federal Housing Finance Agency | FHFA house price index release dates (monthly/quarterly) | https://www.fhfa.gov/data/hpi#ReleaseDates (HTML) | no | none |
| fred | St. Louis Fed (FRED) | release dates + values for public-domain series | api.stlouisfed.org | no | buyer's own `fredApiKey` |

"FHFA HPI" is FHFA's mark; we use it only to describe the data, not as product branding.

### FRED attribution

This product uses the FRED® API but is not endorsed or certified by the Federal Reserve Bank of St. Louis. [FRED® API Terms of Use](https://fred.stlouisfed.org/docs/api/terms_of_use.html).

Curated value series (all U.S.-government public-domain; FRED notes carry no copyright text, verified 2026-10-12):

| Series | Release | Original source |
|---|---|---|
| CPIAUCSL | Consumer Price Index | BLS — https://www.bls.gov/cpi/ |
| PAYEMS | Employment Situation | BLS — https://www.bls.gov/ces/ |
| PPIFIS | Producer Price Index | BLS — https://www.bls.gov/ppi/ |
| GDPC1 | Gross Domestic Product | BEA — https://www.bea.gov/data/gdp |
| PCEPI | Personal Income and Outlays | BEA — https://www.bea.gov/data/personal-consumption-expenditures-price-index |

Copyrighted series (e.g. S\&P/Case-Shiller `CSUSHPINSA`, `SP500`) are never fetched for values.

# Actor input Schema

## `contactEmail` (type: `string`):

Your email, sent only in the HTTP User-Agent to official sources. BLS blocks automated requests without a contact; without it the BLS source will likely fail (403). Not stored in the dataset.

## `sources` (type: `array`):

Which official sources to include.

## `daysBack` (type: `integer`):

Ignored if 'from' is set.

## `daysAhead` (type: `integer`):

Ignored if 'to' is set.

## `from` (type: `string`):

Optional explicit start date.

## `to` (type: `string`):

Optional explicit end date.

## `minImportance` (type: `string`):

high = only high; medium = high+medium; low/empty = all.

## `query` (type: `string`):

Case-insensitive substring filter, e.g. 'CPI'.

## `fredApiKey` (type: `string`):

Your own free key from fred.stlouisfed.org; enables FRED release dates + previous/actual values.

## Actor input object example

```json
{
  "sources": [
    "fed",
    "bls",
    "bea",
    "treasury",
    "census",
    "fhfa",
    "fred"
  ],
  "daysBack": 0,
  "daysAhead": 30
}
```

# Actor output Schema

## `events` (type: `string`):

Dataset containing normalized economic calendar events in America/New_York (ET).

## `sourceErrors` (type: `string`):

Key-value store record (SOURCE_ERRORS) mapping any source that failed during the run to its error message.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("dusty_tumbler/macro-fed-calendar").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("dusty_tumbler/macro-fed-calendar").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call dusty_tumbler/macro-fed-calendar --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dusty_tumbler/macro-fed-calendar"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/OmnGem15ZYzpvS2Hc/builds/OqmSDvdj1h7bqR3S5/openapi.json
