This is a Websocket-based service that pushes updates for Enact series. To receive updates to a series in Enact, you must first subscribe to the relevant Enact series push group.

Each time you subscribe to a new push group, it will count as 10 API calls towards your monthly API usage. For example, if you subscribe to Realtime Demand and you have not previously subscribed to it that day, your API usage will be incremented by 10.


Using the LCPDelta Python Package

To receive updates to a series in Enact, you must subscribe to the relevant Enact series push group using the subscribe_to_series_updates() method and the Series ID as shown below. You can then pass in your push handler method:

from lcp_delta import enact

def handle_updates(x):
    # A callback function that will be invoked with the received series updates.
    # The function should accept one argument, which will be the data received from the series updates.
    print(x)

dps_helper = enact.DPSHelper(username, public_api_key)
# Input method to handle any update to the series, alongside the series ID, that can be found on Enact.
dps_helper.subscribe_to_series_updates(handle_updates, "RealtimeDemand", parse_datetimes=True)

message = None
while message != "exit()":
    message = input(">> ")

#Terminate the connection at the end
dps_helper.terminate_hub_connection()

The parse_datetimes parameter is optional and will parse dates to datetimes in the returned DataFrame and index by them (ascending) if set to true.

Each DPS update from the python package will be in pandas DataFrame format:

>>
GMT Time							Gb&RealtimeDemand					 DateTimeLastUpdated
2024-01-18T00:01:00Z            29290.0 	2024-01-18 15:38:25.468880
2024-01-18T00:02:00Z            29238.0 	2024-01-18 15:38:25.468880
2024-01-18T00:03:00Z            29232.0 	2024-01-18 15:38:25.468880
...                                 ... 	                       ...
2024-01-18T15:31:00Z            40616.0 	2024-01-18 15:38:25.468880
2024-01-18T15:33:00Z            40826.0 	2024-01-18 15:38:25.468880
2024-01-18T15:35:00Z            40942.0 	2024-01-18 15:38:34.964317

Using our DPS Directly

To receive updates to a series in Enact, you will need to follow the pattern detailed in Get Started with the Enact DPS in the language of your choice. You must first subscribe to the relevant Enact series push group using a 'join object' in the format below:

{
  "seriesId": "RealtimeDemand", // The Enact ID for the requested series.
  "countryId": "Gb" // The Enact ID for the requested country.
}

As explained in Get Started with the Enact DPS, once subscribed you can use the 'PushName' value (in this example, 'Gb&OutturnFuel&Coal') from the confirmation response to handle point-level updates to the corresponding series:

Every push you receive will take the form of the JSON response object shown below:

{
  "messages": [],
  "data": {
    "day": "26012024",
    "id": "Gb&RealtimeDemand&none",
    "data": [
      {
        "deletePoint": false,
        "newPoint": false,
        "byPoint": false,
        "current": {
          "arrayPoint": [
            1706265660000,
            30923.0
          ],
          "objectPoint": null,
          "datePeriod": {
            "date": "2024-01-26T00:00:00",
            "period": 22,
            "datePeriodCombinedGmt": "2024-01-26T10:41:00Z",
            "datePeriodStartGmt": "2024-01-26T10:30:00Z"
          }
        },
        "original": {
          "arrayPoint": [
            1706265660000,
            30923.0
          ],
          "objectPoint": null,
          "datePeriod": {
            "date": "2024-01-26T00:00:00",
            "period": 22,
            "datePeriodCombinedGmt": "2024-01-26T10:41:00Z",
            "datePeriodStartGmt": "2024-01-26T10:30:00Z"
          }
        },
        "previous": {
          "arrayPoint": [
            1706265600000,
            30954.0
          ],
          "objectPoint"": null,
          "datePeriod": {
            "date": "2024-01-26T00:00:00",
            "period": 22,
            "datePeriodCombinedGmt": "2024-01-26T10:40:00Z",
            "datePeriodStartGmt": "2024-01-26T10:30:00Z"
          }
        }
      }
    ],
    "replaceSeries": false
  }
}