Skip to content

Commit 7518752

Browse files
fix(IN): mark IEX DAM prices as published sourceType
Cleared day-ahead MCP spans the next delivery day and often sits more than 24h ahead of fetch time, which rejects EventSourceType.measured. Use published for ex-ante market-clearing results. Also document that attribution uses the IEX root domain (iexindia.com) while the provisional HTML is hosted on iexrtmprice.com, and send a polite User-Agent on the scrape.
1 parent 4e60dcc commit 7518752

3 files changed

Lines changed: 126 additions & 105 deletions

File tree

electricitymap/contrib/parsers/IEX.py

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
"""Indian Energy Exchange (IEX) Day-Ahead Market price parser.
22
3-
Source: unconstrained DAM MCP published on IEX's provisional DAM page
4-
https://iexrtmprice.com/view-dam-provisional-mcv-and-mcp-data/
5-
(linked from https://www.iexindia.com/market-data/day-ahead-market/market-snapshot)
6-
7-
The page currently exposes the latest cleared delivery day as 15-minute
8-
blocks (MCP in ₹/MWh). Historical backfill is not available from this
9-
endpoint; see https://github.com/electricitymaps/electricitymaps-contrib/issues/8796
3+
Data: unconstrained DAM market clearing price (MCP) from IEX's public
4+
provisional DAM page (15-minute blocks, ₹/MWh):
5+
https://iexrtmprice.com/view-dam-provisional-mcv-and-mcp-data/
6+
Linked from the official IEX DAM market snapshot:
7+
https://www.iexindia.com/market-data/day-ahead-market/market-snapshot
8+
9+
Attribution uses the IEX root domain ``iexindia.com`` (project convention:
10+
root URL of the datasource, not the provisional page host).
11+
12+
The provisional page exposes the latest cleared delivery day only.
13+
Historical backfill is out of scope for this endpoint; see
14+
https://github.com/electricitymaps/electricitymaps-contrib/issues/8796
1015
"""
1116

1217
from __future__ import annotations
@@ -21,17 +26,24 @@
2126
from requests import Response, Session
2227

2328
from electricitymap.contrib.lib.models.event_lists import PriceList
29+
from electricitymap.contrib.lib.models.events import EventSourceType
2430
from electricitymap.contrib.parsers.lib.config import refetch_frequency
2531
from electricitymap.contrib.parsers.lib.exceptions import ParserException
2632
from electricitymap.contrib.types import ZoneKey
2733

2834
TZ = ZoneInfo("Asia/Kolkata")
35+
# Root domain of the Indian Energy Exchange (see Event.source docs).
2936
SOURCE = "iexindia.com"
3037
CURRENCY = "INR"
3138
PARSER = "IEX.py"
3239

33-
# Provisional unconstrained DAM MCP/MCV table (no auth).
40+
# Provisional unconstrained DAM MCP/MCV table (public, no auth).
41+
# Host is iexrtmprice.com; brand/attribution remains iexindia.com.
3442
DAM_PROVISIONAL_URL = "https://iexrtmprice.com/view-dam-provisional-mcv-and-mcp-data/"
43+
_REQUEST_HEADERS = {
44+
"User-Agent": "electricitymaps-contrib/IEX-parser (+https://github.com/electricitymaps/electricitymaps-contrib)",
45+
"Accept": "text/html,application/xhtml+xml",
46+
}
3547

3648
# e.g. "00:00 - 00:15", "23:45 - 24:00"
3749
_TIME_BLOCK_RE = re.compile(
@@ -131,7 +143,9 @@ def _parse_dam_html(
131143

132144

133145
def _fetch_dam_html(session: Session) -> str:
134-
response: Response = session.get(DAM_PROVISIONAL_URL, timeout=30)
146+
response: Response = session.get(
147+
DAM_PROVISIONAL_URL, timeout=30, headers=_REQUEST_HEADERS
148+
)
135149
if not response.ok:
136150
raise ParserException(
137151
PARSER,
@@ -178,13 +192,16 @@ def fetch_price(
178192

179193
price_list = PriceList(logger)
180194
for start, end, price in rows:
195+
# Cleared day-ahead MCP for the delivery day — often >24h ahead of
196+
# fetch time, so use published (ex-ante market result), not measured.
181197
price_list.append(
182198
zoneKey=zone_key,
183199
datetime=start,
184200
end_datetime=end,
185201
price=price,
186202
currency=CURRENCY,
187203
source=SOURCE,
204+
sourceType=EventSourceType.published,
188205
)
189206
return price_list.to_list()
190207

0 commit comments

Comments
 (0)