EnergieID / entsoe-py

Python client for the ENTSO-E API (european network of transmission system operators for electricity)
MIT License
409 stars 182 forks source link

Querying day-ahead prices does not differentiate between PT15M and PT60M #204

Closed raffaele-sg closed 2 years ago

raffaele-sg commented 2 years ago

Apparently, ENTSO-E changed the API response to the day-ahead price request to accommodate the quarter-hourly intraday auction. Looking at the implementation, I think this case is not handled yet by the response parser.

For example:

from entsoe import EntsoeRawClient, EntsoePandasClient, parsers

response = EntsoeRawClient(api_key=ENTSOE_KEY).query_day_ahead_prices(
    country_code="DE_LU",
    start=pd.Timestamp("2022-08-20 00:00").tz_localize("Europe/Berlin"),
    end=pd.Timestamp("2022-08-21 00:00").tz_localize("Europe/Berlin"),
)

ds1 = parsers.parse_prices(response)

ds2 = EntsoePandasClient(api_key=ENTSOE_KEY).query_day_ahead_prices(
    country_code="DE_LU",
    start=pd.Timestamp("2022-08-20 00:00").tz_localize("Europe/Berlin"),
    end=pd.Timestamp("2022-08-21 00:00").tz_localize("Europe/Berlin"),
)

Querying the day-ahead prices on the 20th of August results in two time series contained in the response text. One with hourly granularity (under the resolution tag “PT60M”) and one with quarter-hourly granularity (under the resolution tag “PT15M”).

This causes the timestamp alone to not be a unique identifier for the price (because there are two price points for each whole hour). I feel this is not accounted for in the _extract_timeseries function (parsers.py). In fact, the series ds1 resulting from parse_prices contains duplicate indices.

When using directly the EntsoePandasClient the duplicates to not appear in the series ds2 (I have not been able to figure out which operation erases these).

Maybe I’m overlooking something, but I see two problems:

fboerman commented 2 years ago

hi @raffaele-sg yes I saw that too yesterday didnt get around to writing a fix yet. its a bit weird anyway since those 15min prices for germany correspond to a specific exchange with a product that is not coupled in the normal way. I will try to write a fix soon that by default 60min is returned

fboerman commented 2 years ago

hi @raffaele-sg please update your version and you will get hourly day ahead prices again. you can also choose to get the 15min.

btw the 15min listed on this endpoint is NOT intraday auctions. it is a day ahead product thats why it is now listed as such on transparancy. however it is a bit of a weird reasoning to publish it like this, I have contacted the responsible people to have a discussion on this.

raffaele-sg commented 2 years ago

hi @raffaele-sg please update your version and you will get hourly day ahead prices again. you can also choose to get the 15min.

btw the 15min listed on this endpoint is NOT intraday auctions. it is a day ahead product thats why it is now listed as such on transparancy. however it is a bit of a weird reasoning to publish it like this, I have contacted the responsible people to have a discussion on this.

Hi @fboerman, thank you very much for the incredibly fast fix and for the clarification!