ENTSO-EConnection

ENTSO-E Connection

class eta_utility.connectors.ENTSOEConnection(url: str = 'https://web-api.tp.entsoe.eu/', *, api_token: str, nodes: Nodes | None = None)[source]

ENTSOEConnection is a class to download and upload multiple features from and to the ENTSO-E transparency platform database as timeseries. The platform contains data about the european electricity markets.

Parameters:
  • url – Url of the server with scheme (https://web-api.tp.entsoe.eu/)

  • usr – Username for login to the platform (usually not required - default: None)

  • pwd – Password for login to the platform (usually not required - default: None)

  • api_token – Token for API authentication

  • nodes – Nodes to select in connection

API_PATH: str = '/api'
read(nodes: Nodes | None = None) pd.DataFrame[source]

Warning

Cannot read single values from ENTSO-E transparency platform. Use read_series instead

Parameters:

nodes – List of nodes to read values from

Returns:

Pandas DataFrame containing the data read from the connection

write(values: Mapping[AnyNode, Mapping[datetime, Any]], time_interval: timedelta | None = None) None[source]

Warning

Cannot write to ENTSO-E transparency platform.

Parameters:
  • values – Dictionary of nodes and data to write. {node: value}

  • time_interval – Interval between datapoints (i.e. between “From” and “To” in EnEffCo Upload), default 1s

subscribe(handler: SubscriptionHandler, nodes: Nodes | None = None, interval: TimeStep = 1) None[source]

Subscribe to nodes and call handler when new data is available. This will return only the last available values.

Parameters:
  • handler – SubscriptionHandler object with a push method that accepts node, value pairs

  • interval – interval for receiving new data. It is interpreted as seconds when given as an integer.

  • nodes – identifiers for the nodes to subscribe to

read_series(from_time: datetime, to_time: datetime, nodes: Nodes | None = None, interval: TimeStep = 1, **kwargs: Any) pd.DataFrame[source]

Download timeseries data from the ENTSO-E Database

Parameters:
  • nodes – List of nodes to read values from

  • from_time – Starting time to begin reading (included in output)

  • to_time – Time to stop reading at (not included in output)

  • interval – interval between time steps. It is interpreted as seconds if given as integer.

Returns:

Pandas DataFrame containing the data read from the connection

subscribe_series(handler: SubscriptionHandler, req_interval: TimeStep, offset: TimeStep | None = None, nodes: Nodes | None = None, interval: TimeStep = 1, data_interval: TimeStep = 1, **kwargs: Any) None[source]

Warning

Not implemented: Cannot subscribe to data from the ENTSO-E transparency platform.

Parameters:
  • handler – SubscriptionHandler object with a push method that accepts node, value pairs

  • req_interval – Duration covered by requested data (time interval). Interpreted as seconds if given as int

  • offset – Offset from datetime.now from which to start requesting data (time interval). Interpreted as seconds if given as int. Use negative values to go to past timestamps.

  • data_interval – Time interval between values in returned data. Interpreted as seconds if given as int.

  • interval – interval (between requests) for receiving new data. It it interpreted as seconds when given as an integer.

  • nodes – identifiers for the nodes to subscribe to

close_sub() None[source]

Warning

Not implemented: Cannot subscribe to data from the ENTSO-E transparency platform.

usr: str | None

Username fot login to server

pwd: str | None

Password for login to server

exc: BaseException | None

NodeENTSO-E

class eta_utility.connectors.node.NodeEntsoE(name: str, url: str, protocol: str, *args: Any, **kwargs: Any)[source]

Node for the EntsoE API (see ENTSO-E Transparency Platform API).

Available endpoint

Endpoint

Description

ActualGenerationPerType

Actual Generation Per Energy Type

Price

Price day ahead

Currently, there is only two endpoints available, due to the parameter managing required by the API documentation. The other possible endpoints are listed in

eta_utility.connectors.entso_e._ConnectionConfiguration._doc_types

Main bidding zone

Bidding Zone

Description

DEU-LUX

Deutschland-Luxemburg

The other possible bidding zones are listed in

eta_utility.connectors.entso_e._ConnectionConfiguration._bidding_zones

endpoint: str

REST endpoint.

bidding_zone: str

Bidding zone.

name: str

Name for the node.

url: str

URL of the connection.

url_parsed: ParseResult

Parse result object of the URL (in case more post-processing is required).

usr: str | None

Username for login to the connection (default: None).

pwd: str | None

Password for login to the connection (default: None).

interval: str | None

Interval

dtype: Callable | None

Data type of the node (for value conversion). Note that strings will be interpreted as utf-8 encoded. If you do not want this behaviour, use ‘bytes’.

Example Usage

An example using the ENTSO-E connection:

# Define your ENTSO-E Token
entsoe_token = ""

# Check out NodeEntsoE documentation for endpoint and bidding zone information
node = NodeEntsoE(
    "CH1.Elek_U.L1-N",
    "https://transparency.entsoe.eu/",
    "entsoe",
    endpoint="Price",
    bidding_zone="DEU-LUX",
)

# start connection from one or multiple nodes
server = ENTSOEConnection.from_node(node, api_token=entsoe_token)

# Define time interval as datetime values
from_datetime = datetime.strptime("2022-02-15T13:18:12", "%Y-%m-%dT%H:%M:%S")
to_datetime = datetime.strptime("2022-02-15T14:00:00", "%Y-%m-%dT%H:%M:%S")

# read_series will request data from specified connection and time interval
# The DataFrame will have index with time delta of the specified interval in seconds
if isinstance(server, ENTSOEConnection):
    df = server.read_series(from_time=from_datetime, to_time=to_datetime, interval=1)
else:
    raise TypeError("The connection must be an ENTSOEConnection, to be able to call read_series.")