Listing Challenges for Market Sessions¶
After retrieving the open market sessions, you may want to list the challenges associated with a specific market session and target resource. Challenges are opportunities published by the Market Owner (Elia) that Forecasters can submit forecasts for.
Important
- Each challenge is created for a specific use case, target day, and associated target resource.
- For this proof of concept two challenges will be open per market session, creating opportunities for forecasters to submit forecasts for offshore wind power generation in Belgian grid and solar power generation in Belgian grid.
One challenge per resource
- The challenge for wind forecasting will have as target a resource identified as 'offshore_wind_opendata_elia'
- The challenge for solar forecasting will have as target a resource identified as 'belgium_solar_opendata_elia'
API Endpoints¶
To interact with the Predico API and retrieve information about challenges published in open market sessions, you can use the following endpoints:
- GET
/api/v1/market/session- Retrieve list of market sessions (you can filter by 'open' sessions with query parameters) - GET
/api/v1/market/challenge- Retrieve challenges for an open market session.
Prerequisites
- Access Token: Ensure you have a valid access token. Refer to the Authentication section if needed.
- Open Market Session ID: You should have the ID of the open market session you're interested in. See Listing Open Sessions to retrieve it.
- Resource Name or UUID: You can filter the queried challenges by the target resource UUID or name ('offshore_wind_opendata_elia' or 'belgium_solar_opendata_elia').
Retrieving Challenges for an Open Market Session¶
Here's how you can retrieve the list of registered challenges for a specific open market session using Python:
Tip: How to filter to currently-open challenges
- By default, the
/market/challengeendpoint returns every challenge registered in the platform (including those of past sessions). To restrict the response to challenges of currently-open market sessions, add the query parameteropen_only=true.
Tip: You can filter challenges by target resource name or use case
- To filter the challenges by target resource name, you can use the
resource_namequery parameter. - To filter the challenges by use case, you can use the
use_casequery parameter. - See more filtering options on our REST API OpenAPI Specification.
import requests
# Predico instance URL. Switch BASE_URL to the environment you want to use:
# - Playground: https://playground.predico.inesctec.pt
# - Production: https://predico.inesctec.pt
BASE_URL = "https://predico.inesctec.pt"
API_URL = f"{BASE_URL}/api/v1"
access_token = "your_access_token_here"
open_market_session_id = "your_open_market_session_id"
headers = {
'Authorization': f'Bearer {access_token}',
'Accept': 'application/json'
}
params = {
'market_session': open_market_session_id
}
# Note that this request will list ALL the challenges for this specific session
# you can filter these challenges by use case, resource name, etc. with the
# query parameters. Check our API documentation for more information.
response = requests.get(
url=f"{API_URL}/market/challenge",
params=params,
headers=headers,
timeout=30
)
# Check if the request was successful
if response.status_code == 200:
challenges = response.json()
print("Challenges for Open Market Session:")
print(challenges)
else:
print("Failed to retrieve challenges.")
print(f"Status code: {response.status_code}")
JSON Example Response¶
After running the example script, you will receive a response containing a list of market challenges. It's important to verify whether the response contains any data, as there may be no challenges created yet, by the Market Owner.
If the response is empty, you may need to try again later.
Click to view Example Response
{
"code": 200,
"data": [
{
"id": "ef3a473f-0fcf-4880-8b42-93f6bf732e3a",
"use_case": "wind_power",
"start_datetime": "2024-06-24T22:00:00Z",
"end_datetime": "2024-06-25T21:45:00Z",
"target_day": "2024-06-25",
"registered_at": "2024-06-24T09:19:33.990638Z",
"updated_at": "2024-06-24T09:19:33.990638Z",
"user": "3ca74375-2ac0-46f4-b4bf-7cf013d0c28f",
"resource": "b92c96d1-f5ee-4f96-a4cc-216a92acb10b",
"market_session": 1,
"resource_name": "offshore_wind_opendata_elia"
},
{
"id": "a53e433a-3bcd-5340-2b31-95a7af782e3a",
"use_case": "solar_power",
"start_datetime": "2024-06-24T22:00:00Z",
"end_datetime": "2024-06-25T21:45:00Z",
"target_day": "2024-06-25",
"registered_at": "2024-06-24T09:19:33.990638Z",
"updated_at": "2024-06-24T09:19:33.990638Z",
"user": "3ca74375-2ac0-46f4-b4bf-7cf013d0c28f",
"resource": "a92s06d4-f5cc-6e56-e4ac-317a32abb30b",
"market_session": 1,
"resource_name": "belgium_solar_opendata_elia"
}
]
}