Skip to content

Preparing a Session Forecast

After downloading the raw measurements data, the next step for Forecasters is to prepare their forecasts for an open session and respective challenges (with clear start and end datetime boundaries) This involves creating forecast submissions based on the retrieved data and any additional variables or models the Forecaster might utilize.

In this example, we'll demonstrate how to prepare a simple 24-hour submission using randomly generated data. In a real-world scenario, you would replace this with your forecasting model based on the dataset retrieved in the previous step.

Note

  • Example Purpose: This example demonstrates preparing a 24-hour forecast submission with 15-minute interval samples using random data. Replace this with your forecasting model for actual use.
  • Quantiles: The example submission includes values for three variables, specifically 'quantiles' 10, 50, and 90.

Prerequisites

  • Python Environment: Ensure you have Python installed with the necessary libraries (pandas, numpy, requests).
  • Access Token: A valid access token is required for authentication. Refer to the Authentication section if needed.
  • Challenges List: A list of challenges retrieved from the Listing Challenges section.

How does it work?

Forecasters can submit forecasts for open session Challenges, competing for the prize money available. They may commence or stop contributing to the market at any time.

Before you submit

  • Submit all three quantiles — Q10, Q50, Q90. Partial submissions are excluded from scoring and payment.
  • Quantiles should satisfy Q10 ≤ Q50 ≤ Q90 at every timestamp — crossing quantiles generally hurt the MWI score.
  • Match the challenge's 15-minute resolution and cover the full window (96 values per day, or 92 / 100 on DST-transition days).
  • Datetimes in UTC; check each challenge's gate_closure — late submissions are rejected.
  • One variable per HTTP request (one request for Q10, one for Q50, one for Q90).

What's needed for a day to qualify

Submitting one challenge is the start, not the finish. Intraday needs every slot of every timestamp filled — typically a cadence of intraday submissions plus a D+1 / D+N commitment for the same target day. D+1 and D+N require submitting your full Q10/Q50/Q90 to every opened session of that target day (D+1 currently opens once per day, at 10h00 CET). See Evaluation.

Selecting a Challenge

First, retrieve the information about the challenge you want to submit a forecast for. In the example below, we will select a challenge for a specific market session (open_market_session_id) and target resource name (resource_name).

submit_session_forecast.py
# Get the session id from `/market/session/` endpoint
open_market_session_id = "your_open_market_session_id"

# Challenge resource identifier (name):
resource_name = "wind_farm_1"

# Request the challenges for the open market session:
response = requests.get(
    url=f"{API_URL}/market/challenge",
    params={'market_session': int(open_market_session_id),
            'resource_name': resource_name},
    headers=headers,
    timeout=30
)

# Check if the request was successful
if response.status_code == 200:
    challenges = response.json()
else:
    print("Failed to retrieve challenges.")
    print(f"Status code: {response.status_code}")
    exit()

# Select the first challenge of the list of challenges previous retrieved
# Note that as we're filtering by resource_name, there should be only a
# single challenge per session
selected_challenge = challenges["data"][0]

# Unpack selected challenge information
resource_id = selected_challenge["resource"]  # challenge resource UUID
challenge_id = selected_challenge["id"] # challenge UUID
start_datetime = selected_challenge["start_datetime"] # first forecast leadtime
end_datetime = selected_challenge["end_datetime"] # last forecast leadtime
print(f"""
Challenge info:
ID: {challenge_id}
Resource ID: {resource_id}
First forecast leadtime): {start_datetime}
Last forecast leadtime): {end_datetime}

Preparing Forecast Submissions Time-series Data

Next, prepare the forecast data for submission.

Use your own model

The example uses random samples for illustration. Replace it with your model, fed from the raw measurements (Downloading Raw Data) and any external signals you have.

Info

After each submission you'll receive a confirmation email.

submit_session_forecast.py
# Create a random 24h submission (random values):
# Generate datetime values for the challenge period:
datetime_range = pd.date_range(start=start_datetime,
                               end=end_datetime,
                               freq='15min')
datetime_range = [x.strftime("%Y-%m-%dT%H:%M:%SZ") for x in datetime_range]
# Generate random Q50 (median) values, then derive Q10/Q90 around it so that
# Q10 <= Q50 <= Q90 holds at every timestamp (as required by the API).
q50 = np.random.uniform(low=0.1, high=0.9, size=len(datetime_range))
quantile_values = {
    "q10": [round(float(x), 3) for x in np.clip(q50 - 0.1, 0.0, 1.0)],
    "q50": [round(float(x), 3) for x in q50],
    "q90": [round(float(x), 3) for x in np.clip(q50 + 0.1, 0.0, 1.0)],
}

# Prepare submissions for the three quantiles Q10, Q50, Q90:
submission_list = []
for qt in ["q50", "q10", "q90"]:
    qt_forec = pd.DataFrame({
        'datetime': datetime_range,
        'value': quantile_values[qt],
    })
    submission_list.append({
        "variable": qt,
        "forecasts": qt_forec.to_dict(orient="records")
    })

Download Full Example