# Forex Economic Calendar Pro - Surprise, Price Reaction (`amethys/forex-calendar-pro`) Actor

\[$1.5/1000] Forex Factory calendar with surprise scores, event history, price reaction after release, OHLC rates and forex news.

- **URL**: https://apify.com/amethys/forex-calendar-pro.md
- **Developed by:** [Amethys](https://apify.com/amethys) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.15 / 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/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

## Forex Economic Calendar Pro - Surprise Scores, Event History & Price Reaction

Everything a macro trader needs in one Actor: the ForexFactory economic calendar enriched with **surprise scores**, **previous-release history with z-scores** and **how the market actually reacted after each release**, plus **OHLC forex rates** and **forex news with full article text**. \[$1.5/1000]

### Modes

| Mode | What you get |
|---|---|
| `calendar` | Events with actual / forecast / previous, revision, impact, currency, UTC timestamps, better/worse flag, leaked flag, surprise, optional history and price reaction |
| `rates` | OHLC candles (1m to 1mo) or the latest quote for any pair, gold and silver included |
| `news` | FXStreet news and analysis: full text, author, tags, images, currencies mentioned |

#### Calendar fields

| Field | Description |
|---|---|
| `calendar_range` | today, this/next/last week, this/next/last month, or custom |
| `calendar_startDate`, `calendar_endDate` | YYYY-MM-DD, used by the custom range |
| `calendar_currencies` | e.g. `["USD","EUR"]` |
| `calendar_minImpact` | low, medium, high |
| `calendar_includeHolidays` | include bank holidays |
| `calendar_includeEventHistory` | NEW: previous releases, average surprise, surprise z-score |
| `calendar_historyDepth`, `calendar_historyLookbackWeeks` | how many releases to attach and how far back to scan |
| `calendar_includePriceReaction` | NEW: main-pair move after the release |
| `calendar_reactionWindows` | minutes after release, e.g. `["5","15","60"]` |

#### Rates and news fields

`rates_pairs`, `rates_outputType` (candles or latestQuote), `rates_interval`, `rates_range`; `news_sources`, `news_currencies`, `news_includeFullArticle`, `news_maxItems`.

### Example

Input:

```json
{ "mode": "calendar", "calendar_range": "lastWeek", "calendar_currencies": ["USD"],
  "calendar_minImpact": "high", "calendar_includePriceReaction": true }
```

Output (shortened):

```json
{ "title": "CPI m/m", "currency": "USD", "impact": "high", "actual": "0.4%", "forecast": "0.3%",
  "resultVsForecast": "better", "surprise": 0.1, "surprisePct": 33.33,
  "priceReaction": { "pair": "EURUSD", "windows": { "15m": { "changePips": -22.6, "currencyStrengthMove": "up" } } } }
```

### Notes

- Price reaction uses 5 minute candles for events in the last 58 days and hourly candles up to about 2 years back. Hourly candles cannot resolve windows shorter than an hour, so those come back as `null`. Events less than an hour old are skipped.
- `currencyStrengthMove` is expressed for the event's own currency, so a USD move is read from EURUSD inverted.
- ForexFactory is protected by Cloudflare and only serves its calendar to a normal (non-headless) browser, so this Actor runs Chromium on a virtual display. Requests are spaced 3 seconds apart.
- No API keys or environment variables are needed. If you clone this Actor from scratch, recreate `src/config_local.py` from `src/config_schema.py`.

# Actor input Schema

## `mode` (type: `string`):

What to fetch: the economic calendar, forex OHLC rates, or forex news. Fields below are grouped per mode and only apply to the selected mode.

## `calendar_range` (type: `string`):

(mode: calendar) Period to fetch. Choose 'Custom' to use the start and end date fields.

## `calendar_startDate` (type: `string`):

(mode: calendar) First day for the Custom range, format YYYY-MM-DD.

## `calendar_endDate` (type: `string`):

(mode: calendar) Last day for the Custom range, format YYYY-MM-DD. Defaults to the start date.

## `calendar_currencies` (type: `array`):

(mode: calendar) Only keep events for these currency codes, e.g. USD, EUR, JPY. Leave empty for all.

## `calendar_minImpact` (type: `string`):

(mode: calendar) Skip events below this impact level.

## `calendar_includeHolidays` (type: `boolean`):

(mode: calendar) Also return bank holiday entries.

## `calendar_includeEventHistory` (type: `boolean`):

(mode: calendar) NEW. Attaches the previous releases of each indicator (actual, forecast, previous, surprise), the average and spread of past surprises, and a surprise z-score showing how unusual today's surprise is. History is read from earlier calendar weeks, about 3 seconds per week.

## `calendar_historyDepth` (type: `integer`):

(mode: calendar) Number of previous releases to attach per event when event history is enabled.

## `calendar_historyLookbackWeeks` (type: `integer`):

(mode: calendar) How many weeks before the start date to scan for earlier releases. 26 weeks covers roughly 6 monthly releases; raise it for quarterly indicators.

## `calendar_includePriceReaction` (type: `boolean`):

(mode: calendar) NEW. For released events, measures how the currency's main pair moved after the release (5 minute candles for the last 60 days, hourly candles up to 2 years).

## `calendar_reactionWindows` (type: `array`):

(mode: calendar) Minutes after release to measure, e.g. 5, 15, 60. Windows shorter than the candle size of old events are returned as null.

## `rates_pairs` (type: `array`):

(mode: rates) Pairs such as EURUSD, USD/JPY or GBP-USD. Gold (XAUUSD) and silver (XAGUSD) are also accepted.

## `rates_outputType` (type: `string`):

(mode: rates) Historical candles, or one latest-quote record per pair.

## `rates_interval` (type: `string`):

(mode: rates) Size of each candle. 1m is limited to the last 7 days, 5m to 15m to 30m to 60 days, 1h to 2 years.

## `rates_range` (type: `string`):

(mode: rates) How far back to go from now.

## `news_sources` (type: `array`):

(mode: news) Which FXStreet feeds to read.

## `news_currencies` (type: `array`):

(mode: news) Keep articles mentioning these currency codes or pairs, e.g. EUR, USD, XAU. Leave empty for all.

## `news_includeFullArticle` (type: `boolean`):

(mode: news) Open each article for the full text, author, tags, images and modification date.

## `news_maxItems` (type: `integer`):

(mode: news) Upper limit on returned articles.

## Actor input object example

```json
{
  "mode": "calendar",
  "calendar_range": "thisWeek",
  "calendar_currencies": [],
  "calendar_minImpact": "low",
  "calendar_includeHolidays": false,
  "calendar_includeEventHistory": false,
  "calendar_historyDepth": 8,
  "calendar_historyLookbackWeeks": 26,
  "calendar_includePriceReaction": false,
  "calendar_reactionWindows": [
    "5",
    "15",
    "60"
  ],
  "rates_pairs": [
    "EURUSD"
  ],
  "rates_outputType": "candles",
  "rates_interval": "1h",
  "rates_range": "1mo",
  "news_sources": [
    "news",
    "analysis"
  ],
  "news_currencies": [],
  "news_includeFullArticle": true,
  "news_maxItems": 30
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `runInfo` (type: `string`):

No description

# 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("amethys/forex-calendar-pro").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("amethys/forex-calendar-pro").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 amethys/forex-calendar-pro --silent --output-dataset

```

## MCP server setup

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

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/zMCh43BWdqaQehg5I/builds/ZRgfKUVuEKnVEK5TK/openapi.json
