History of Forecast

This endpoint will return a dictionary containing several arrays of data, for each day, corresponding to the requested series and date or date-range at various updates to the forecast (see Enact's history of forecasts page).


Using the LCPDelta Python Package

Synchronous

from lcp_delta import enact
from datetime import datetime
from datetime import timezone as tz

enact_api_helper = enact.APIHelper(username, public_api_key)

# see 'BODY PARAMS' section below for details on corresponding parameter values

response_dataframe = enact_api_helper.get_history_of_forecast_for_given_date(
	"Tsdf",
	datetime(2023,6,20, tzinfo=tz.utc),
	"Gb"
)

print(response_dataframe)

response_dictionary = enact_api_helper.get_history_of_forecast_for_date_range(
	"Tsdf",
	datetime(2023,6,21, tzinfo=tz.utc),
	datetime(2023,6,23, tzinfo=tz.utc),
	"Gb"
)

print(response_dictionary)

Asynchronous (package version 1.3.0 and later)

from lcp_delta import enact
from datetime import datetime
from datetime import timezone as tz
import asyncio

async def main():
    enact_api_helper = enact.APIHelper(username, public_api_key)

    # see 'BODY PARAMS' section below for details on corresponding parameter values

    response_dataframe = await enact_api_helper.get_history_of_forecast_for_given_date_async(
        "Tsdf",
        datetime(2023,6,20, tzinfo=tz.utc),
        "Gb"
    )

    print(response_dataframe)

    response_dictionary = await enact_api_helper.get_history_of_forecast_for_date_range_async(
        "Tsdf",
        datetime(2023,6,21, tzinfo=tz.utc),
        datetime(2023,6,23, tzinfo=tz.utc),
        "Gb"
    )

    print(response_dictionary)

asyncio.run(main())

Using the API Directly

To request data for a date range, populate the from and to fields of the request body. In this case, the response object will hold all data for the requested series across the requested date range. Each response data key will be a requested date, with its value containing data for the associated date. Within this data for a given date, the 'Time' key will contain all the dates we have a forecast iteration for, and the arrays for all other keys will correspond to the data points at each value in the 'Time' key.

To request data for a single day, populate the date fields of the request body. In this case, the response object will hold all data for the requested series at the requested date. The 'Time' key will contain all the dates we have a forecast iteration for, and the arrays for all other keys will correspond to the data points at each value in the 'Time' key.

Body Params
string
required
Defaults to Tsdf

The Enact ID for the requested series.

optionId
array of strings

The options that specify the requested series, required if applicable. Note: this is an array to allow for separate options, not multiple values of the same option (for example, a zone and summary statistic if required, not two values for zone).

optionId
string
required
Defaults to Gb

The Enact ID for the country of the requested series.

date-time
Defaults to 2023-06-21T00:00:00Z

The start of the date range to return all iterations of the forecast for.

date-time
Defaults to 2023-06-21T00:00:00Z

The end of the date range to return all iterations of the forecast for (inclusive).

date-time

The date to return all iterations of the forecast for.

Responses

Language
Credentials
Bearer
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json