Spain OMIE Day-Ahead (OMIE_ES_DA) Price API
If you need to pull the latest Spain OMIE Day-Ahead power price into a finance stack for valuation, risk, settlement checks, or P&L explain, this guide shows exactly how to query, parse, and validate the OMIE_ES_DA symbol from the Energy API. By the end, you will be able to call the endpoint, read the latest EUR/MWh price, persist it safely, and handle edge cases like base currency checks and non-trading days.
What you will build and what you will use
You will implement a small, reliable integration that fetches the latest Spain OMIE Day-Ahead price (symbol: OMIE_ES_DA) using a single GET endpoint. You will learn how to:
- Authenticate with an api_key query parameter.
- Read the price, date, and currency fields you actually need for finance workflows.
- Confirm the unit (EUR/MWh) and base currency handling.
- Cache responses prudently and validate updates on non-trading days.
We will stay focused on one symbol: OMIE_ES_DA. All examples below are copy-pasteable. For production adoption, sign up at Register and review the Documentation.
Origin catalog facts (copyable reference)
- Symbol name: Spain OMIE Day-Ahead
- Symbol code: OMIE_ES_DA
- Unit: EUR/MWh
- Auth: api_key query parameter. Placeholder YOUR_API_KEY only.
- Do not pass base=USD when you also need TTF_GAS or EUA_CO2.
- No MCP host. Starter $19.99/mo, trial 7 days / 50 calls.
- curl: curl -G "https://energy-api.com/api/v1/latest" --data-urlencode "symbols=OMIE_ES_DA" --data-urlencode "api_key=YOUR_API_KEY"
- Read rates.OMIE_ES_DA, dates.OMIE_ES_DA, currencies.OMIE_ES_DA. base may be MIXED.
Endpoint, authentication, and symbol
The OMIE_ES_DA price comes from a single endpoint using HTTP GET:
- URL: https://energy-api.com/api/v1/latest
- HTTP method: GET
- Required query parameters:
- symbols=OMIE_ES_DA
- api_key=YOUR_API_KEY
Authentication is via a query parameter named api_key. For evaluation, the trial is 7 days with 50 calls. The Starter plan is $19.99/month. Keep your key out of logs where possible; if your infrastructure requires audit logging, consider a short-lived proxy that injects the key server-side.
Quickstart: cURL request and official JSON response
Use this exact cURL command to fetch the latest Spain OMIE Day-Ahead price:
curl -G "https://energy-api.com/api/v1/latest" --data-urlencode "symbols=OMIE_ES_DA" --data-urlencode "api_key=YOUR_API_KEY"
Official JSON response example (copy verbatim):
{
"success": true,
"date": "2026-10-13",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 168.8263
},
"dates": {
"OMIE_ES_DA": "2026-10-13"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null
}
What to read for finance use:
- rates.OMIE_ES_DA — the latest price value as a number.
- dates.OMIE_ES_DA — the market date for that price (ISO date string).
- currencies.OMIE_ES_DA — the currency for the quoted symbol, here EUR.
- base — the response base currency context; can be EUR or MIXED depending on symbols requested. For a single symbol like OMIE_ES_DA, expect base="EUR" and currencies.OMIE_ES_DA="EUR".
Additional real response examples for your parser tests
These are additional complete response bodies using the same official data. Use them to exercise your JSON parsing in tests or fixtures without altering field names and formatting. Do not change the values or keys when wiring automated tests.
Compact single-line JSON
{"success":true,"date":"2026-10-13","base":"EUR","rates":{"OMIE_ES_DA":168.8263},"dates":{"OMIE_ES_DA":"2026-10-13"},"currencies":{"OMIE_ES_DA":"EUR"},"base_filter_note":null}
Pretty-printed JSON (identical values, alternate spacing)
{
"success": true,
"date": "2026-10-13",
"base": "EUR",
"rates": { "OMIE_ES_DA": 168.8263 },
"dates": { "OMIE_ES_DA": "2026-10-13" },
"currencies": { "OMIE_ES_DA": "EUR" },
"base_filter_note": null
}
Strict-key-order JSON (useful for snapshot tests)
{
"success": true,
"date": "2026-10-13",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 168.8263
},
"dates": {
"OMIE_ES_DA": "2026-10-13"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null
}
Python example: fetch, validate, and normalize
This Python snippet calls the endpoint, validates the success flag, and extracts the fields your finance pipeline will actually persist. It also demonstrates a simple guard around the base field and unit annotation (EUR/MWh) in your storage schema.
import os
import json
import time
import urllib.parse
import urllib.request
API_URL = "https://energy-api.com/api/v1/latest"
API_KEY = os.getenv("ENERGY_API_KEY", "YOUR_API_KEY") # replace in production
SYMBOL = "OMIE_ES_DA"
def fetch_latest(symbol: str):
params = {
"symbols": symbol,
"api_key": API_KEY
}
url = f"{API_URL}?{urllib.parse.urlencode(params)}"
with urllib.request.urlopen(url, timeout=10) as resp:
payload = resp.read().decode("utf-8")
return json.loads(payload)
def parse_latest(doc: dict, symbol: str):
if not doc.get("success", False):
raise RuntimeError("API returned success=false")
# Required fields
base = doc.get("base")
rates = doc.get("rates", {})
dates = doc.get("dates", {})
currencies = doc.get("currencies", {})
if symbol not in rates:
raise KeyError(f"Missing rate for {symbol}")
price = float(rates[symbol])
market_date = dates.get(symbol)
currency = currencies.get(symbol)
# Finance-grade normalization: assert currency and unit
# According to catalog, OMIE_ES_DA unit = EUR/MWh
unit = "EUR/MWh"
# Basic base check: for single-symbol OMIE_ES_DA expect EUR base
# base may be MIXED in multi-symbol requests (do not force base=USD)
if base not in ("EUR", "MIXED"):
raise ValueError(f"Unexpected base: {base}")
return {
"symbol": symbol,
"price": price,
"market_date": market_date, # ISO date string
"currency": currency, # "EUR"
"unit": unit, # "EUR/MWh"
"response_base": base,
"fetched_at_unix": int(time.time())
}
if __name__ == "__main__":
doc = fetch_latest(SYMBOL)
record = parse_latest(doc, SYMBOL)
print(json.dumps(record, indent=2))
Field-by-field guide: what to store for finance
When persisting the latest OMIE_ES_DA quote into your pricing DB or downstream cache, store these fields directly from the response, and annotate unit explicitly:
- symbol: OMIE_ES_DA
- price: rates.OMIE_ES_DA
- market_date: dates.OMIE_ES_DA
- currency: currencies.OMIE_ES_DA
- unit: EUR/MWh (from the origin catalog facts)
- response_base: base (EUR or MIXED depending on request composition)
For financial reconciliation and auditability, keep the raw JSON payload for at least one retention cycle so teams can compare parsed fields to source if questions arise during close or settlement tasks.
Base currency and unit handling
Energy price symbols can have different quote currencies; OMIE_ES_DA is in EUR with a unit of EUR/MWh. The response's base field reflects the base currency context of the returned data. If you request a single symbol (OMIE_ES_DA), base is EUR in the official sample. If you request multiple symbols with mixed currencies, base may be MIXED. Your code should:
- Read currency from currencies.OMIE_ES_DA rather than assuming base applies to every symbol equally.
- Avoid forcing a conversion by passing a base parameter (not used here). Specifically, do not pass base=USD when you also need TTF_GAS or EUA_CO2.
- Store unit explicitly as EUR/MWh to prevent accidental cross-commodity arithmetic.
Caching, retries, and non-trading day behavior
For finance workflows, treat the “latest” endpoint as an atomic price source per market day. Consider these implementation notes:
- Caching: cache the latest payload keyed by dates.OMIE_ES_DA and symbol. If the latest date is unchanged from your stored record, skip downstream recalculations.
- Retries: transient HTTP errors are common on the public internet. Implement a short retry (e.g., 2–3 attempts with exponential backoff) while ensuring you do not exceed your trial call budget.
- Non-trading days or maintenance windows: if the market does not update, the API’s latest value may remain the same; your cache-then-compare strategy avoids double-counting.
- Idempotence: ensure your storage layer treats the same date+symbol as an upsert rather than an insert to avoid duplicate daily rows.
Validation and reconciliation for finance teams
Finance operations often require defensible price integrity. Minimal but effective controls include:
- Schema checks: assert presence and type of rates.OMIE_ES_DA (float), dates.OMIE_ES_DA (YYYY-MM-DD string), currencies.OMIE_ES_DA (string).
- Unit assertion: annotate “EUR/MWh” in your dataset schema so consumers cannot mix OMIE power with other energy commodities inadvertently.
- Staleness guard: if the latest date is older than expected for a close window, raise a soft alert and notify the pricing channel.
- Cross-field consistency: when base is MIXED (multi-symbol pulls), never assume currency; always read currencies.OMIE_ES_DA.
End-to-end example: from response to normalized record
Here is a concise mapping using the official payload. Treat it as a canonical example for both dev and QA. The three steps are: fetch, parse, and normalize with unit and currency annotations.
- Fetch via GET with symbols=OMIE_ES_DA and your api_key.
- Confirm success is true and base is either EUR or MIXED.
- Extract rates.OMIE_ES_DA, dates.OMIE_ES_DA, currencies.OMIE_ES_DA; persist with unit EUR/MWh.
Canonical response (unchanged values):
{
"success": true,
"date": "2026-10-13",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 168.8263
},
"dates": {
"OMIE_ES_DA": "2026-10-13"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null
}
Operational patterns to save time
These practical choices reduce toil and avoid edge bugs in close-critical windows:
- Single-symbol polling: for this integration, query OMIE_ES_DA alone to keep base simple (EUR) and parsing focused.
- Time-based polling: schedule a modest polling interval only around the expected publication time; outside that window, reduce frequency and rely on cache.
- Payload snapshots: store the unmodified JSON in a blob store keyed by symbol+market_date for audit and replay.
- Monitoring: alert on HTTP status changes, success=false, missing symbol fields, or unexpected base values.
Testing checklist with fixed sample data
Use the official response to build deterministic tests that do not rely on live calls:
- Parser accepts both compact and pretty-printed JSON.
- price parsed as 168.8263, market_date as 2026-10-13, currency as EUR.
- Unit hard-coded to EUR/MWh for OMIE_ES_DA.
- Base validated as EUR in single-symbol context.
Compact sample again for quick fixtures:
{"success":true,"date":"2026-10-13","base":"EUR","rates":{"OMIE_ES_DA":168.8263},"dates":{"OMIE_ES_DA":"2026-10-13"},"currencies":{"OMIE_ES_DA":"EUR"},"base_filter_note":null}
Cost control during trial and Starter
The trial includes 7 days and 50 calls. To stay within limits while integrating:
- Cache the last successful payload during local development; only re-fetch on demand.
- Use unit tests with the official JSON instead of repeated live calls.
- For CI, mock the HTTP layer or serve the official JSON from a test fixture.
When ready, move to the Starter plan at $19.99/month and enable production polling with the safeguards described above.
FAQ
Q1: Which fields do I need for a finance-grade record?
A1: Read rates.OMIE_ES_DA (price), dates.OMIE_ES_DA (market date), and currencies.OMIE_ES_DA (currency). Annotate unit as EUR/MWh and keep base in the record for context.
Q2: How should I handle the base field?
A2: For a single-symbol request like OMIE_ES_DA, base is EUR in the official sample. If you expand to multi-symbol requests, base may be MIXED; always read currencies.OMIE_ES_DA for the symbol’s actual currency. Do not pass base=USD when you also need TTF_GAS or EUA_CO2.
Q3: What if the market date does not change for a day?
A3: Keep your cache and compare dates.OMIE_ES_DA to your stored value before triggering downstream jobs. If unchanged, skip recalculation and optionally alert if staleness exceeds your policy threshold.
Q4: Can I request historical data from this endpoint?
A4: This guide covers the latest endpoint only. For other endpoints or additional parameters, see the Documentation.
Q5: Is there a host or parameter named MCP I should use?
A5: No. There is no MCP host for this integration. Use the endpoint and parameters shown here.
Next step: create your API key and ship your OMIE_ES_DA integration. Start with the 7-day trial (50 calls), wire the parser using the official response, and deploy with caching and base checks in place. Register and review the Documentation to complete your setup.
Ready to get started?
Get your API key and start querying energy commodity prices in minutes.
Get API KeyRelated posts
Unlock the power of Spain's OMIE Hourly Price API in your finance workflows. Learn to fetch, parse, and integr...
Read more →
Learn to use the Finance API to fetch Spain's OMIE day-ahead electricity prices in Python. Enhance your financ...
Read more →
Discover how to streamline option volatility surface calibration in power markets using a Finance API. Enhance...
Read more →
Discover how to design a reproducible backtesting framework for power trading strategies using Energy API time...
Read more →
Streamline your PPA tendering and price discovery with an Energy API. Discover how to build an efficient renew...
Read more →