# EA Backtest Data Normalizer (`conceivable_extension/ea-backtest-data-normalizer`) Actor

Pulls historical forex price data from Dukascopy's public archive and normalizes it into clean, consistent OHLCV format ready for Expert Advisor backtesting. Flat $5/job pricing, $6 if data gaps are detected.

- **URL**: https://apify.com/conceivable\_extension/ea-backtest-data-normalizer.md
- **Developed by:** [joseph fadero](https://apify.com/conceivable_extension) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5,000.00 / 1,000 symbol×timeframe job completeds

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

## EA Backtest Data Normalizer

Pulls historical forex price data from Dukascopy's public archive and normalizes it into clean, consistent OHLCV format ready for Expert Advisor backtesting.

### What it does

1. Fetches historical candles for a forex symbol/timeframe/date-range from Dukascopy's public tick archive (no API key needed — this is free, public market data).
2. Normalizes the raw data into a consistent per-candle shape: `{symbol, timeframe, timestamp (ISO 8601 UTC), open, high, low, close, volume}`.
3. Sorts chronologically and removes exact-timestamp duplicates.
4. Walks the sequence and detects gaps — timestamp jumps wider than the timeframe's expected interval — while correctly ignoring expected weekend market closures (Friday ~21:00 UTC through Sunday ~21:00 UTC). It **never interpolates or fills missing candles**, it only flags them, so you always know exactly what's real market data vs. a hole in the feed.
5. Pushes one `dataQualityReport` summary record per job with everything you need to sanity-check the dataset before feeding it to a backtest.

### Data source: Dukascopy (via `dukascopy-node`)

This Actor uses the community npm package [`dukascopy-node`](https://www.npmjs.com/package/dukascopy-node) to pull data from Dukascopy's public bi5-compressed historical tick archive. It worked cleanly out of the box — no need to hand-roll the binary archive format. Verified live while building this Actor:

- Real OHLCV data comes back correctly for any historical range.
- **Dukascopy's public archive has a publication lag of roughly 1-2 weeks.** Requesting a date range that is too recent (e.g. the last few days) will return **zero rows**, not an error. If your job returns an empty dataset, widen the range further into the past.
- Instrument codes are lowercase internally (`eurusd`) — this Actor accepts the symbol however you type it (e.g. `EURUSD`) and lowercases it automatically before calling Dukascopy.

### Input

| Field | Type | Default | Notes |
|---|---|---|---|
| `symbol` | string | `EURUSD` | Any Dukascopy-supported forex instrument code, e.g. `EURUSD`, `GBPUSD`, `USDJPY`. |
| `timeframe` | select | `H1` | One of `M1`, `M5`, `M15`, `H1`, `H4`, `D1`. |
| `dateFrom` | date | `2026-08-25` | Start of the range (UTC), `YYYY-MM-DD`. |
| `dateTo` | date | `2026-08-26` | End of the range (UTC), `YYYY-MM-DD`. |
| `source` | select | `dukascopy` | Only `dukascopy` is currently supported. |

**Important — the default date range is intentionally narrow (1 day).** It exists so the Actor runs in a few seconds for automated testing/QA. For real backtesting, widen `dateFrom`/`dateTo` to whatever range your EA needs — months or years of data work fine, just expect the run to take longer and produce a much larger dataset (a full year of M1 data is roughly 370K candles). Also remember the 1-2 week publication lag noted above: don't set `dateTo` too close to today.

### Output

**Per candle** (one dataset record each):

```json
{
  "symbol": "EURUSD",
  "timeframe": "H1",
  "timestamp": "2026-08-25T00:00:00.000Z",
  "open": 1.16679,
  "high": 1.16708,
  "low": 1.16671,
  "close": 1.16686,
  "volume": 4889.53
}
```

**One summary record per job**, at the end of the dataset:

```json
{
  "type": "dataQualityReport",
  "symbol": "EURUSD",
  "timeframe": "H1",
  "dateFrom": "2026-08-25",
  "dateTo": "2026-08-26",
  "source": "dukascopy",
  "candleCount": 24,
  "gapsDetected": [
    { "from": "2026-08-25T09:00:00.000Z", "to": "2026-08-25T12:00:00.000Z", "reason": "2 missing H1 candles (non-weekend gap, likely holiday or feed outage)" }
  ],
  "duplicatesRemoved": 0,
  "sourceCoverage": {
    "requestedFrom": "2026-08-25",
    "requestedTo": "2026-08-26",
    "actualFirstCandle": "2026-08-25T00:00:00.000Z",
    "actualLastCandle": "2026-08-25T23:00:00.000Z"
  },
  "generatedAt": "2026-09-15T17:29:57.944Z"
}
```

Filter the dataset on `type === "dataQualityReport"` to separate the summary from the candle rows, or just take the last record.

### Pricing (Pay Per Event)

Flat per-job pricing — you're charged once per completed job, not per candle, no matter how large the date range:

| Event | Price | When |
|---|---|---|
| Actor Start | $0.05 | Built-in, charged once per run at startup. |
| Symbol×Timeframe Job Completed | $5.00 | Job completed successfully with **no** data-quality gaps detected. |
| Symbol×Timeframe Job Completed With Gap Report | $6.00 | Job completed successfully and **gaps were detected** and flagged in the report. |

Exactly one of the two "Job Completed" events is charged per run — never both, and never per candle row.

### Notes on gap detection

Forex markets close every week from roughly Friday 21:00 UTC to Sunday 21:00 UTC. That closure is expected and is never flagged as a gap. Anything else — a missed weekday candle, an exchange holiday, a feed outage — is flagged with the number of missing candles and a from/to timestamp range, so you can decide for yourself whether it matters for your strategy. The normalizer never fabricates or interpolates data to fill a gap.

# Actor input Schema

## `symbol` (type: `string`):

Forex instrument to fetch, e.g. 'EURUSD', 'GBPUSD', 'USDJPY'. Uses Dukascopy's instrument codes internally (lowercased automatically).

## `timeframe` (type: `string`):

Candle interval to normalize the data into.

## `dateFrom` (type: `string`):

Start date (UTC) of the range to fetch, format YYYY-MM-DD. NOTE: the default range here is intentionally narrow (1 day) so the Actor runs fast for testing. Widen it for real backtesting use — see the README for guidance on realistic ranges per timeframe.

## `dateTo` (type: `string`):

End date (UTC) of the range to fetch, format YYYY-MM-DD. Dukascopy's public archive typically has a ~1-2 week publication lag, so very recent dates may return no data.

## `source` (type: `string`):

Historical data provider. Currently only Dukascopy's public tick/candle archive is supported.

## Actor input object example

```json
{
  "symbol": "EURUSD",
  "timeframe": "H1",
  "dateFrom": "2026-08-25",
  "dateTo": "2026-08-26",
  "source": "dukascopy"
}
```

# Actor output Schema

## `resultsDatasetUrl` (type: `string`):

Dataset of normalized OHLCV candle records and the data-quality report produced by this run.

# 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 = {
    "symbol": "EURUSD",
    "dateFrom": "2026-08-25",
    "dateTo": "2026-08-26"
};

// Run the Actor and wait for it to finish
const run = await client.actor("conceivable_extension/ea-backtest-data-normalizer").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 = {
    "symbol": "EURUSD",
    "dateFrom": "2026-08-25",
    "dateTo": "2026-08-26",
}

# Run the Actor and wait for it to finish
run = client.actor("conceivable_extension/ea-backtest-data-normalizer").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 '{
  "symbol": "EURUSD",
  "dateFrom": "2026-08-25",
  "dateTo": "2026-08-26"
}' |
apify call conceivable_extension/ea-backtest-data-normalizer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,conceivable_extension/ea-backtest-data-normalizer"
        }
    }
}
```

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/NHHTiQ8micccf2knJ/builds/6ZVj7PhOJYrxrIa2k/openapi.json
