Backtests
Use /backtests to obtain forecast inputs for evaluating a model or strategy. Choose a product from the customer catalog and authenticate with your customer API key. The endpoint provides forecast values, not strategy results or performance metrics.
Backtests are the recommended way to evaluate forecast accuracy over a longer period:
- They often cover a longer period than the published forecast history.
- Replay values come from the current model, so they represent the forecasts you receive today.
Nowcasting products offer no backtests. Their catalog variants have nowcast: true and list no backtests; the backtest endpoints return 404 BACKTESTS_NOT_OFFERED.
Replay values are calculated retrospectively and do not necessarily reflect forecasts available on the platform at the historical decision time, as models evolve over time. Depending on the requested range, the response may also include originally published forecasts.
Learn how to distinguish replay and published forecasts →
Select a range
Pass deliveryFrom and deliveryTo as inclusive YYYY-MM-DD dates in the product's time zone. Use the product slug for its default variant, or variants[].offeringKey for a specific variant. Dates below are illustrative.
curl --fail-with-body 'https://telescope.energy/api/v2/customer/forecasts/day-ahead-price-de-lu/backtests?deliveryFrom=2026-10-01&deliveryTo=2026-10-31' \
-H "Authorization: Bearer $TELESCOPE_API_KEY"
import json
import os
from urllib.request import Request, urlopen
request = Request(
"https://telescope.energy/api/v2/customer/forecasts/day-ahead-price-de-lu/backtests?deliveryFrom=2026-10-01&deliveryTo=2026-10-31",
headers={"Authorization": "Bearer " + os.environ["TELESCOPE_API_KEY"]},
)
with urlopen(request, timeout=30) as response:
print(json.dumps(json.load(response), indent=2))
const response = await fetch(
'https://telescope.energy/api/v2/customer/forecasts/day-ahead-price-de-lu/backtests?deliveryFrom=2026-10-01&deliveryTo=2026-10-31',
{ headers: { Authorization: `Bearer ${process.env.TELESCOPE_API_KEY}` } },
)
if (!response.ok) throw new Error(await response.text())
console.log(await response.json())
The catalog's variants[].backtests lists the available decision times with replay range, generation time and horizons; replay is null without a replay. historySince describes published history separately. Neither guarantees complete coverage. The older variants[].backtest field describes only the five-minute replay.
In the dashboard API Playground, select Backtest, a product, a decision time, a horizon and a date range. Presets cover the last 7, 30 or 90 days, or the replay range. Run request displays one page as a chart, table or JSON; CSV saves that page. Download full range retrieves every page as CSV or JSON. JSON keeps values, metadata and gaps together. CSV has one row per interval (and series) with valid_time in UTC, valid_time_local in the product time zone, one column per output, the actual, its status, the source (replay or published), the reason for a missing value and the decision cutoff. Missing intervals stay in the file with empty forecast cells. Downloads can be cancelled; exports above 100 MiB require a shorter range.
Choose a decision time
Each backtest belongs to one decision time: how many minutes before gate closure (gate-closure products) or before each delivery interval (continuous products) the forecast is used. Pass it as leadMinutes. Without it, five minutes is used.
Five minutes is available for every product that offers backtests. Selected products also offer longer decision times. Each is a separate replay. List the available values with variants[].backtests in the catalog or for one product:
curl --fail-with-body 'https://telescope.energy/api/v2/customer/forecasts/day-ahead-price-de-lu/backtests/options' \
-H "Authorization: Bearer $TELESCOPE_API_KEY"
{
"offering": "day-ahead-price-de-lu",
"backtests": [
{ "leadMinutes": 5, "relativeTo": "gateClosure", "replay": { "deliveryFrom": "2025-10-01", "deliveryTo": "2026-10-31", "generatedAt": "2026-11-02T09:30:00.000Z" }, "maxHorizonDays": 7 },
{ "leadMinutes": 120, "relativeTo": "gateClosure", "replay": { "deliveryFrom": "2026-01-01", "deliveryTo": "2026-10-31", "generatedAt": "2026-11-05T14:12:00.000Z" }, "maxHorizonDays": 7 }
]
}
Then add the value to your request, for example &leadMinutes=120. A value that is not listed returns 404 BACKTEST_LEAD_NOT_AVAILABLE.
Compare decision times using separate downloads. The longer the lead, the fewer published forecasts after the replay range may be available, because an interval needs a forecast published before its decision time.
Choose a horizon
For gate-closure products, every decision time also offers forecasts further ahead, as far as the product forecasts. The horizon names the delivery day the forecast was made for, counted like the market: at the same daily decision time, horizonDays=1 is the delivery day of the next gate closure (D+1 on day-ahead markets) and horizonDays=7 the delivery day six gate closures later (D+7). For example, with leadMinutes=120 and horizonDays=7 on Day-Ahead DE-LU, delivery on 8 October uses the forecast available at 10:00 on 1 October.
A replay covers every horizon from 1 to backtests[].maxHorizonDays, just as the forecasts are delivered: each decision time forecasts all of these delivery days. Add the value to your request, for example &leadMinutes=120&horizonDays=7. Without it, horizonDays=1 is used. A larger value returns 422 INVALID_HORIZON_DAYS. Continuous products have maxHorizonDays=1.
Compare horizons using separate downloads. Later horizons may have fewer published forecasts after the replay range, because a forecast must have been published that many days before delivery.
Understand the sources
- Replay: model values calculated retrospectively. These values do not necessarily reflect forecasts available on the platform at the historical decision time. The response includes
generatedAtandreplayRange. - Published forecasts: original releases supplement the series after the replay range. Without a replay, the entire request uses published forecasts.
- Replay + Published: both sources occur in the returned page. Each available
intervalsentry identifies itssource; join it tovaluesusingvalidTime.
Published values use the latest release at or before gate closure minus leadMinutes for gate-closure products, or delivery minus leadMinutes for continuous products. For later horizons, the gate closure is the one horizonDays − 1 days earlier. The response returns this rule in predictionPolicy. A cutoff must have passed by evaluatedAt.
For the history actually published at a custom decision time, use Published forecast history. Replay metadata is null for published-only responses.
Compare forecasts with actuals
actuals contains available observed values for the requested days, including intervals without forecast values. Join each observation to values using validTime and seriesKey. There is one observation per timestamp and series, shared by all forecast outputs such as p10, p50 and p90.
Illustrative excerpt:
{
"actuals": [
{ "validTime": "2026-09-30T22:00:00.000Z", "seriesKey": "value", "value": 70.2, "status": "final" }
]
}
Actuals use the product's time grid and unit. status is provisional or final; provisional observations may be revised. Missing observations have no entry, and actuals: [] means none are available for this page. A returned value of 0 is an actual observation, not a placeholder.
Actuals are outcomes for evaluating your forecast, and may have become available after its five-minute decision cutoff. Every page uses the observations available at evaluatedAt, the start of the download. A later download can include new or corrected observations. Full-range downloads include actuals automatically.
Preserve missing data
Requests can return partial coverage or no values at all. deliveryDays reports expected and available intervals and coverageRatio. An available day can still be incomplete. intervals records every expected interval with availability and a reason when missing:
| Reason | Meaning |
|---|---|
REPLAY_GAP | No replay values within its declared range. |
BEFORE_REPLAY_RANGE | Date precedes the available replay range. |
NO_VERSION_AT_AS_OF | No eligible published forecast. |
NO_VALUE_AT_AS_OF / INCOMPLETE_INTERVAL | Selected publication lacks a complete interval. |
CUTOFF_NOT_REACHED | Decision time has not passed. |
Replay gaps and dates before the replay are not filled from publications. Missing intervals have no values rows. Keep these gaps in your analysis; do not interpret them as zero or interpolate. The Playground shows coverage and gap reasons.
Download every page
A range may span up to 3,660 days. Each response contains complete local days: limit is 1–8, default 7, with at most 7,500 forecast and actual values combined. Follow pagination.nextCursor until null, even if a page has no values. Keep the product, date range, leadMinutes and horizonDays unchanged. On 422 FORECAST_RANGE_TOO_COMPLEX, reduce limit and retry the same cursor; contact support if one day still fails.
Set TELESCOPE_API_KEY and TELESCOPE_OFFERING, then adapt the dates. These examples save backtest.json only after all pages succeed. Python 3 uses the standard library; TypeScript runs in Node.js with fetch support.
import json
import os
import time
from pathlib import Path
from urllib.error import HTTPError
from urllib.parse import quote, urlencode
from urllib.request import Request, urlopen
offering = quote(os.environ["TELESCOPE_OFFERING"], safe="")
url = f"https://telescope.energy/api/v2/customer/forecasts/{offering}/backtests"
params = {"deliveryFrom": "2026-10-01", "deliveryTo": "2026-10-31", "leadMinutes": 5, "limit": 7}
pages = []
retries = 0
while True:
request = Request(url + "?" + urlencode(params), headers={
"Authorization": "Bearer " + os.environ["TELESCOPE_API_KEY"],
})
try:
with urlopen(request, timeout=30) as response:
page = json.load(response)
except HTTPError as error:
failure = json.load(error)
code = failure.get("error", {}).get("code")
if error.code == 422 and code == "FORECAST_RANGE_TOO_COMPLEX" and params["limit"] > 1:
params["limit"] = max(1, params["limit"] // 2)
continue
if error.code == 429 and retries < 3:
retries += 1
time.sleep(max(1, int(error.headers.get("Retry-After", "1"))))
continue
raise RuntimeError(failure) from error
retries = 0
pages.append(page)
cursor = page["pagination"]["nextCursor"]
if cursor is None:
break
params["cursor"] = cursor
# Save only a complete download, including provenance and gaps.
Path("backtest.json").write_text(json.dumps({"pages": pages}), encoding="utf-8")
import { writeFile } from 'node:fs/promises'
import { setTimeout as wait } from 'node:timers/promises'
const offering = encodeURIComponent(process.env.TELESCOPE_OFFERING!)
const url = `https://telescope.energy/api/v2/customer/forecasts/${offering}/backtests`
const params = new URLSearchParams({ deliveryFrom: '2026-10-01', deliveryTo: '2026-10-31', leadMinutes: '5', limit: '7' })
const pages = []
let retries = 0
while (true) {
const response = await fetch(`${url}?${params}`, {
headers: { Authorization: `Bearer ${process.env.TELESCOPE_API_KEY}` },
signal: AbortSignal.timeout(30_000),
})
const page = await response.json()
if (!response.ok) {
const limit = Number(params.get('limit'))
if (response.status === 422 && page.error?.code === 'FORECAST_RANGE_TOO_COMPLEX' && limit > 1) {
params.set('limit', String(Math.max(1, Math.floor(limit / 2))))
continue
}
if (response.status === 429 && retries++ < 3) {
await wait(Math.max(1, Number(response.headers.get('Retry-After') ?? 1)) * 1000)
continue
}
throw new Error(JSON.stringify(page))
}
retries = 0
pages.push(page)
const cursor = page.pagination.nextCursor
if (cursor === null) break
params.set('cursor', cursor)
}
// Save only a complete download, including provenance and gaps.
await writeFile('backtest.json', JSON.stringify({ pages }), 'utf8')
Keep a completed snapshot
Save the complete download, including its metadata, to repeat your analysis with the same inputs. Backtest data can be updated, so a later download may contain different values.
If a download cannot be continued, discard the partial result and start again without a cursor. Do not combine pages from separate downloads. See Troubleshooting if the problem persists.
See the Customer API reference for response schemas and Troubleshooting for authentication and rate limits.