|
1 | 1 | """Indian Energy Exchange (IEX) Day-Ahead Market price parser. |
2 | 2 |
|
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 |
10 | 15 | """ |
11 | 16 |
|
12 | 17 | from __future__ import annotations |
|
21 | 26 | from requests import Response, Session |
22 | 27 |
|
23 | 28 | from electricitymap.contrib.lib.models.event_lists import PriceList |
| 29 | +from electricitymap.contrib.lib.models.events import EventSourceType |
24 | 30 | from electricitymap.contrib.parsers.lib.config import refetch_frequency |
25 | 31 | from electricitymap.contrib.parsers.lib.exceptions import ParserException |
26 | 32 | from electricitymap.contrib.types import ZoneKey |
27 | 33 |
|
28 | 34 | TZ = ZoneInfo("Asia/Kolkata") |
| 35 | +# Root domain of the Indian Energy Exchange (see Event.source docs). |
29 | 36 | SOURCE = "iexindia.com" |
30 | 37 | CURRENCY = "INR" |
31 | 38 | PARSER = "IEX.py" |
32 | 39 |
|
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. |
34 | 42 | 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 | +} |
35 | 47 |
|
36 | 48 | # e.g. "00:00 - 00:15", "23:45 - 24:00" |
37 | 49 | _TIME_BLOCK_RE = re.compile( |
@@ -131,7 +143,9 @@ def _parse_dam_html( |
131 | 143 |
|
132 | 144 |
|
133 | 145 | 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 | + ) |
135 | 149 | if not response.ok: |
136 | 150 | raise ParserException( |
137 | 151 | PARSER, |
@@ -178,13 +192,16 @@ def fetch_price( |
178 | 192 |
|
179 | 193 | price_list = PriceList(logger) |
180 | 194 | 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. |
181 | 197 | price_list.append( |
182 | 198 | zoneKey=zone_key, |
183 | 199 | datetime=start, |
184 | 200 | end_datetime=end, |
185 | 201 | price=price, |
186 | 202 | currency=CURRENCY, |
187 | 203 | source=SOURCE, |
| 204 | + sourceType=EventSourceType.published, |
188 | 205 | ) |
189 | 206 | return price_list.to_list() |
190 | 207 |
|
|
0 commit comments