# ECB reference rates and 90-day cross rates (`kvnloo/ecb-reference-rates`) Actor

Export ECB daily reference exchange rates as dated rows. Convert supported base currencies and filter the last 90 days. No API key or personal data.

- **URL**: https://apify.com/kvnloo/ecb-reference-rates.md
- **Developed by:** [Kevin Rajan](https://apify.com/kvnloo) (community)
- **Categories:** Developer tools, Open source
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

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

## ECB reference rates and 90-day cross rates

Export dated exchange-rate rows for reporting, spreadsheets, and scheduled workflows. Select a base currency and target currencies. Use the latest publication or the ECB's rolling 90-day feed.

The underlying information is available **free of charge from the [European Central Bank](https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml)**. This service formats the data and calculates cross rates. It is not affiliated with or endorsed by the ECB. Rates are for reference, not executable trading quotes.

### Input

```json
{
  "base": "EUR",
  "currencies": ["USD", "GBP"],
  "mode": "latest",
  "fromDate": "",
  "toDate": "",
  "maxResults": 2
}
```

- `base` defaults to `EUR`. Use a supported three-letter currency code.
- `currencies` defaults to `USD` and `GBP` when absent. Supply 1 to 32 codes. Codes are case-insensitive. Duplicates produce one row per date.
- `mode` is `latest` or `last90days`. The default is `latest`.
- `fromDate` and `toDate` are inclusive `YYYY-MM-DD` bounds. Empty strings mean no bound. Dates outside the rolling feed do not trigger a full-history download.
- `maxResults` defaults to 1000. The allowed range is 1 to 3000. Results use newest dates first, then your currency order.

Supported codes are `EUR USD JPY BGN CZK DKK GBP HUF PLN RON SEK CHF ISK NOK TRY AUD BRL CAD CNY HKD IDR ILS INR KRW MXN MYR NZD PHP SGD THB ZAR`. Availability depends on the publication date. A currency absent from that publication causes an error, not a fabricated rate. BGN is a legacy code and may be absent from current publications.

### Output

Each dataset row contains:

| Field | Value |
|---|---|
| `date` | ECB observation date in `YYYY-MM-DD` form |
| `base` | Base currency code |
| `currency` | Target currency code |
| `rate` | Target units per one base unit, rounded to 12 decimal places |
| `source` | `European Central Bank` |
| `sourceUrl` | ECB XML feed used for the row |
| `sourceNotice` | Notice that the underlying ECB data is available free |
| `calculation` | Explicit description of the cross-rate calculation and rounding |

The calculation is `ECB target/EUR ÷ ECB base/EUR`. A target equal to the base has a rate of one. The service derives and rounds the result rather than presenting it as an unmodified ECB quote. See `example-output.json` for a captured public-source example.

The default key-value store contains `SUMMARY` with `resultCount`, `errorCount`, and `aborted`. An abort also stores these counters in `STATE` before exit. `STATE` is diagnostic, not a resume guarantee.

### Empty output, errors, and pricing

No dataset row is written for an error or an empty date range. Invalid input or malformed upstream data fails the run. Network failures, HTTP 429, and server errors receive at most three attempts. A `Retry-After` delay above 30 seconds stops the request instead of continuing to consume compute.

When pay-per-event pricing is enabled, only successful dataset rows use the `apify-default-dataset-item` event. There is no startup event and no manual charge that duplicates the dataset charge. Platform usage can still apply under the active Store pricing model. Consult the Actor's Pricing tab before running it. No paid pricing is active in this unpublished development package.

The ECB normally updates reference rates on business days. Weekends and holidays return the most recent publication, not a new quote. This Actor does not guarantee publication times, coverage of discontinued currencies, or uninterrupted source availability.

### Local verification

After approving and installing the official template dependency in `requirements.txt`, use:

```bash
apify validate-schema
apify run --no-purge --input-file example-input.json
```

From the repository root, `python3 -m unittest discover -s lanes/AP-apify -v` runs offline fixture tests without the SDK. The lane's `verify_live.py` checks real public-source data and dataset schemas, but does not replace an SDK or platform run.

Maintainers can set `HTTP_TIMEOUT_SECONDS`, default 20. The Dockerfile is unchanged from the official `python-empty` template.

Source use follows the [ECB copyright conditions](https://www.ecb.europa.eu/services/using-our-site/disclaimer/html/index.en.html). No personal data, login, proxy, paid API, or browser is used.

# Actor input Schema

## `base` (type: `string`):

Supported three-letter ECB currency code.

## `currencies` (type: `array`):

One to 32 supported ECB currency codes. Duplicates are removed.

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

latest uses the last published business day. last90days uses the rolling ECB feed.

## `fromDate` (type: `string`):

Inclusive YYYY-MM-DD lower bound. Empty means no lower bound.

## `toDate` (type: `string`):

Inclusive YYYY-MM-DD upper bound. Empty means no upper bound.

## `maxResults` (type: `integer`):

Stop after this many successful date and currency rows. Newest dates first.

## Actor input object example

```json
{
  "base": "EUR",
  "currencies": [
    "USD",
    "GBP"
  ],
  "mode": "latest",
  "fromDate": "",
  "toDate": "",
  "maxResults": 1000
}
```

# Actor output Schema

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

No description

## `summary` (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 = {
    "currencies": [
        "USD",
        "GBP"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kvnloo/ecb-reference-rates").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 = { "currencies": [
        "USD",
        "GBP",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("kvnloo/ecb-reference-rates").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 '{
  "currencies": [
    "USD",
    "GBP"
  ]
}' |
apify call kvnloo/ecb-reference-rates --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kvnloo/ecb-reference-rates"
        }
    }
}
```

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/3VWt4SkNKXEOY6tsl/builds/cs0av5MQkZsQOQ9RE/openapi.json
