|
26 | 26 | warnings.filterwarnings('ignore', category=XMLParsedAsHTMLWarning)
|
27 | 27 |
|
28 | 28 | __title__ = "entsoe-py"
|
29 |
| -__version__ = "0.7.4" |
| 29 | +__version__ = "0.7.5" |
30 | 30 | __author__ = "EnergieID.be, Frank Boerman"
|
31 | 31 | __license__ = "MIT"
|
32 | 32 |
|
@@ -184,13 +184,44 @@ def query_day_ahead_prices(self, country_code: Union[Area, str],
|
184 | 184 | 'documentType': 'A44',
|
185 | 185 | 'in_Domain': area.code,
|
186 | 186 | 'out_Domain': area.code,
|
187 |
| - 'offset': offset |
| 187 | + 'offset': offset, |
| 188 | + 'contract_MarketAgreement.type': 'A01' |
188 | 189 | }
|
189 | 190 | if sequence is not None:
|
190 | 191 | params['classificationSequence_AttributeInstanceComponent.position'] = sequence
|
191 | 192 | response = self._base_request(params=params, start=start, end=end)
|
192 | 193 | return response.text
|
193 | 194 |
|
| 195 | + |
| 196 | + |
| 197 | + def query_intraday_prices(self, country_code: Union[Area, str], |
| 198 | + start: pd.Timestamp, end: pd.Timestamp, |
| 199 | + sequence: int, offset: int = 0) -> str: |
| 200 | + """ |
| 201 | + Parameters |
| 202 | + ---------- |
| 203 | + country_code : Area|str |
| 204 | + start : pd.Timestamp |
| 205 | + end : pd.Timestamp |
| 206 | +
|
| 207 | + Returns |
| 208 | + ------- |
| 209 | + str |
| 210 | + """ |
| 211 | + area = lookup_area(country_code) |
| 212 | + params = { |
| 213 | + 'documentType': 'A44', |
| 214 | + 'in_Domain': area.code, |
| 215 | + 'out_Domain': area.code, |
| 216 | + 'offset': offset, |
| 217 | + 'contract_MarketAgreement.type': 'A07' |
| 218 | + } |
| 219 | + if sequence is not None: |
| 220 | + params['classificationSequence_AttributeInstanceComponent.position'] = sequence |
| 221 | + response = self._base_request(params=params, start=start, end=end) |
| 222 | + return response.text |
| 223 | + |
| 224 | + |
194 | 225 | def query_aggregated_bids(self, country_code: Union[Area, str],
|
195 | 226 | process_type: str,
|
196 | 227 | start: pd.Timestamp, end: pd.Timestamp) -> str:
|
@@ -1347,6 +1378,64 @@ def _query_day_ahead_prices(
|
1347 | 1378 | raise NoMatchingDataError
|
1348 | 1379 | return series
|
1349 | 1380 |
|
| 1381 | + # we need to do offset, but we also want to pad the days so wrap it in an internal call |
| 1382 | + def query_intraday_prices( |
| 1383 | + self, country_code: Union[Area, str], |
| 1384 | + start: pd.Timestamp, |
| 1385 | + end: pd.Timestamp, |
| 1386 | + sequence: int) -> pd.Series: |
| 1387 | + """ |
| 1388 | + Parameters |
| 1389 | + ---------- |
| 1390 | + this will return the IDA prices, forced to the correct resolution |
| 1391 | + country_code : Area|str |
| 1392 | + start : pd.Timestamp |
| 1393 | + end : pd.Timestamp |
| 1394 | + sequence: int, 1, 2 or 3 corresponding to IDA 1, 2, 3. only some zones publish this on entsoe |
| 1395 | +
|
| 1396 | + Returns |
| 1397 | + ------- |
| 1398 | + pd.Series |
| 1399 | + """ |
| 1400 | + |
| 1401 | + area = lookup_area(country_code) |
| 1402 | + # we do here extra days at start and end to fix issue 187 |
| 1403 | + series = self._query_intraday_prices( |
| 1404 | + area, |
| 1405 | + start=start-pd.Timedelta(days=1), |
| 1406 | + end=end+pd.Timedelta(days=1), |
| 1407 | + sequence=sequence |
| 1408 | + ) |
| 1409 | + series = series.tz_convert(area.tz).sort_index() |
| 1410 | + series = series.truncate(before=start, after=end) |
| 1411 | + # because of the above fix we need to check again if any valid data exists after truncating |
| 1412 | + if len(series) == 0: |
| 1413 | + raise NoMatchingDataError |
| 1414 | + return series |
| 1415 | + |
| 1416 | + @year_limited |
| 1417 | + @documents_limited(100) |
| 1418 | + def _query_intraday_prices( |
| 1419 | + self, area: Area, |
| 1420 | + start: pd.Timestamp, |
| 1421 | + end: pd.Timestamp, |
| 1422 | + sequence: int, |
| 1423 | + offset: int = 0) -> pd.Series: |
| 1424 | + text = super(EntsoePandasClient, self).query_intraday_prices( |
| 1425 | + area, |
| 1426 | + start=start, |
| 1427 | + end=end, |
| 1428 | + offset=offset, |
| 1429 | + sequence=sequence |
| 1430 | + ) |
| 1431 | + series = parse_prices(text)['15min'] |
| 1432 | + series = series.tz_convert(area.tz).sort_index() |
| 1433 | + series = series.truncate(before=start, after=end) |
| 1434 | + # because of the above fix we need to check again if any valid data exists after truncating |
| 1435 | + if len(series) == 0: |
| 1436 | + raise NoMatchingDataError |
| 1437 | + return series |
| 1438 | + |
1350 | 1439 | # we need to do offset, but we also want to pad the days so wrap it in an internal call
|
1351 | 1440 | def query_day_ahead_prices_local(
|
1352 | 1441 | self, country_code: Union[Area, str],
|
|
0 commit comments