This endpoint will return a dictionary containing several arrays of data, for each day, corresponding to the requested series and including the latest generated forecast before the requested date time (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_latest_forecast_generated_at_given_time(
"Tsdf",
datetime(2024,3,2, tzinfo=tz.utc),
datetime(2024,3,5, tzinfo=tz.utc),
"Gb",
forecast_as_of = datetime(2024, 3, 1, 18, 30, tzinfo=tz.utc)
)
print(response_dataframe)
Asynchronous (package version 1.3.0 or 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_latest_forecast_generated_at_given_time_async(
"Tsdf",
datetime(2024,3,2, tzinfo=tz.utc),
datetime(2024,3,5, tzinfo=tz.utc),
"Gb",
forecast_as_of = datetime(2024, 3, 1, 18, 30, tzinfo=tz.utc)
)
print(response_dataframe)
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.