Access data¶
Our API allows you to access all the time series data which are available to you on the Nena Portal’s Fundamentals Data page. In addition the API offers several convenience features which does common times series tasks like:
Resample the time resolution of the data
Filter out specific time periods from a time series
Extract specific data such as peak and offpeak from a time series.
Get series metadata¶
Metadata on time series can be retrieved using either of the two API endpoints shown below. The metadata contains information on the start and end date of the time series as well as describing what kind of data the series contain. It is also possible to see from the metadata when a series was last updated.
Retrieve metadata on a single series¶
To fetch metadata on a single data series, the following request endpoint is used.
- POST /api/fundamental/meta
Get metadata from a single series.
Note: You should replace Username with your Nena username and Token with the access token received by the login request.
- Content-Type
application/json
- form
{ "SeriesId": "string", "UserInfo": { "UserName": "string", "Token": "string" } }
Form parameters
Parameter
Type
Example
SeriesId
string
“dehrwind”, “ukdayprice”
UserInfo.UserName
string
my.user.name
UserInfo.Token
string
Tip
All time series ids can be found on the Nena portal’s fundamentals data page in the information box on the bottom left of the page.
Example Request
curl --location --request POST 'https://api.nena.no/api/user/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"UserName": "<your-username>",
"Password": "<your-password>"
}'
import requests
import json
url = "https://api.nena.no/api/fundamental/meta"
payload = json.dumps(
{
"SeriesId": "NP",
"UserInfo": {
"UserName": "<your-username>",
"Token": "<your-password>"
}
}
)
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Example Respons
{
"startdate": "2012-12-11T00:00:00",
"enddate": "2022-02-08T23:00:00",
"Code": "NPsp",
"Description": "Hourly Day Ahead System Price in Nordics (EUR/MWh)",
"Unit": "EUR/MWh",
"Resolution": 0
}
Retireve metadata on multiple series using a prefix search¶
Metadata from several data series can be fetched by performing a prefix search. This request returns all data series with matching series id prefix.
Warning
When using prefix searches it is possible that you may return time series codes for data not in your Nena subscription plan. Trying to access these series will return:
- POST /api/fundamental/meta/all
Get metadata on all series matching a series id prefix.
Note: You should replace Username with your Nena username and Token with the access token recieved by the login request.
- Content-Type
application/json
- root
test
- form
{ "Prefix": "string", "UserInfo": { "UserName": "string", "Token": "string" } }
form parameters
Parameter
Type
Example
Prefix
string
“dehr”, “uk”
UserInfo.UserName
string
my.user.name
UserInfo.Token
string
Tip
Here are some examples of search prefixes:
- country codes - Ex: “uk”, “fr”
Will return all series with the country code as prefix in their series id.
- country codes + resolution - Ex: “ukhr”
Will return all country specific series with hourly resolution.
- model codes - Ex: “nhse”
Will return all swedish nordic balance series ids.
Example Request
curl --location --request POST 'https://api.nena.no/api/fundamental/meta/all' \
--header 'Content-Type: application/json' \
--data-raw '{
"Prefix": "nhse",
"UserInfo": {
"UserName": "<your-username>",
"Token": "<your-access-token>"
}
}'
import requests
import json
url = "https://api.nena.no/api/fundamental/meta/all"
payload = json.dumps(
{
"Prefix": "nhse",
"UserInfo": {
"UserName": "<your-username>",
"Token": "<your-access-token>"
}
}
)
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Example Response
[
{
"lastupdated": "2022-02-01T11:21:15.24",
"resolution_name": "hour",
"startdate": "2010-01-01T01:00:00",
"enddate": "2022-02-27T23:00:00",
"Code": "nhsecons",
"Description": "Hourly Consumption in Sweden (MWh/h)",
"Unit": "MWh",
"Resolution": 0
},
{
"lastupdated": "2022-02-01T11:21:15.24",
"resolution_name": "hour",
"startdate": "2010-01-01T01:00:00",
"enddate": "2022-02-27T23:00:00",
"Code": "nhseexch",
"Description": "Hourly Net exchange to/from Sweden (MWh/h)",
"Unit": "MWh",
"Resolution": 0
},
{
"lastupdated": "2022-02-01T11:21:15.24",
"resolution_name": "hour",
"startdate": "2010-01-01T01:00:00",
"enddate": "2022-02-27T23:00:00",
"Code": "nhseprod",
"Description": "Total production in Sweden (MWh/h)",
"Unit": "MWh",
"Resolution": 0
},
{
"lastupdated": "2022-02-01T11:21:15.24",
"resolution_name": "hour",
"startdate": "2010-01-01T01:00:00",
"enddate": "2022-02-27T23:00:00",
"Code": "nhsehydro",
"Description": "Hourly Hydro power production in Sweden (MWh/h)",
"Unit": "MWh",
"Resolution": 0
},
{
"lastupdated": "2022-02-01T11:21:15.24",
"resolution_name": "hour",
"startdate": "2010-01-01T01:00:00",
"enddate": "2022-02-27T23:00:00",
"Code": "nhsewind",
"Description": "Hourly Wind power generation in Sweden (MWh/h)",
"Unit": "MWh",
"Resolution": 0
},
{
"lastupdated": "2022-02-01T11:21:15.24",
"resolution_name": "hour",
"startdate": "2010-01-01T01:00:00",
"enddate": "2022-02-27T23:00:00",
"Code": "nhsenuc",
"Description": "Hourly Nuclear power production in Sweden (MWh/h)",
"Unit": "MWh",
"Resolution": 0
},
{
"lastupdated": "2022-02-01T11:21:15.24",
"resolution_name": "hour",
"startdate": "2010-01-01T01:00:00",
"enddate": "2022-02-27T23:00:00",
"Code": "nhsechpp",
"Description": "Hourly CHP production in Sweden (MWh/h)",
"Unit": "MWh",
"Resolution": 0
}
Access time series data¶
To access actual series data, you use the series API endpoint. The endpoint supports accessing one series at the time. Several convenience keywords are available which lets the API do several common time series processing tasks. This is explained here.
- POST /api/fundamental/series
Fetches series data for a single data series.
- Form
{ "FromDateTime": "string", "ToDateTime": "string", "Resolution": "string", "SeriesId": "string", "UserInfo": { "UserName": "string", "Token": "string" } }
Form parameters
Tip
The Resolution, FromDateTime and ToDateTime accepts several convenience keywords. This allows you to extract specific data from a data series such as peak or off-peak data. You can also use keywords such as “week” and “friday” to extract data within a specific time period over a time span. See a list of convenience keywords below.
Example Request
curl --location --request POST 'https://api.nena.no/api/fundamental/series' \
--header 'Content-Type: application/json' \
--data-raw '{
"FromDateTime": "today+7",
"ToDateTime": "today-7",
"Resolution": "hr",
"SeriesId": "ukhrwind",
"UserInfo": {
"UserName": "<you-username>",
"Token": "<you-access-token>"
}
}'
import requests
import json
url = "https://api.nena.no/api/fundamental/series"
payload = json.dumps(
{
"FromDateTime": "today+7",
"ToDateTime": "today-7",
"Resolution": "hr",
"SeriesId": "ukhrwind",
"UserInfo": {
"UserName": "<you-username>",
"Token": "<you-access-token>"
}
}
)
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Example Respone
{
"LastUpdated": "2022-02-07T10:02:01.143",
"Meta": {
"code": "ukhrwind",
"description": "Hourly Wind in United Kingdom (GWh/h)",
"unit": "GWh/h",
"resolution": "Hour",
"nativeresolution": "Hour",
"aggregation": "Average"
},
"Values": {}
}
Process time series data¶
As already mentioned the Nena API can return processed time series data. The API support many of the most common time series processing task. Here we will go over some of them.
Re-sampling time series¶
Many of the times series have an hourly native resolution. To resample a series you provide one of the following keywords to the Resolution parameter in the JSON request body for the /api/fundamental/series endpoint.
Resampling Keywords
Keyword |
Specifies |
---|---|
hour |
Hourly averaged data |
day |
Daily averaged data |
week |
Weekly averaged data |
month |
Monthly averaged data |
quarter |
Quarterly averaged data |
year |
Yearly averaged data |
native |
The data series’ native resolution |
Extract specific data from a time series¶
You can extract specific data from the time series such as peak and offpeak data by providing the following keywords to the Resolution parameter in the JSON request body for the /api/fundamental/series endpoint.
Extraction Keywords
Keyword |
Specifies |
Details |
|
---|---|---|---|
peak |
Peak data |
daily averaged between 09.00-20.00 CET. |
|
offpeak |
Off peak data |
daily average between 00.00-08.00 and 20.00-00.00 CET. |
|
offpeak1 |
First off peak |
daily average between 00.00-08.00 CET. |
|
offpeak2 |
Second off peak |
daily average between 20.00-00.00 CET. |
|
night |
Nightly data |
||
rushhour |
Rush hourly data |
||
offpeakweek |
Weekly off peak (off peak for weekdays |
base for week end) |
|
peakweek |
Weekly peak (peak for week days |
base for week end) |
Filtering time series¶
You can filter time series to only show specific time periods over a time span, or automatically reorient the time series. You do this by providing any of the following keywords to the FromDateTime and ToDateTime parameters in the JSON request body for the /api/fundamental/series endpoint.
Tip
All time keywords support shifting by using integers. For example writing “boy-2” will return the beginning of the year two years ago i.e. 2020-01-01.
DateTime Keywords
Keyword |
Specifies |
|
---|---|---|
today |
Todays date |
|
tomorrow |
Tomorrows date |
|
dayahead |
The next day from today |
|
yesterday |
Yesterdays date |
|
monday |
Offset from Monday in the time span |
|
Tuesday |
Offset from Tuesday in the time span |
|
Wednesday |
Offset from Wednesday in the time span |
|
Thursday |
Offset from Thursday in the time span |
|
Friday |
Offset from Friday in the time span |
|
Saturday |
Offset from Saturday in the time span |
|
Sunday |
Offset from Sunday in the time span |
|
eow |
End of the week |
|
month |
Offset from the current month |
|
eom |
End of the month |
|
year |
Year |
|
boy |
Beginning of the year |
|
eoy |
End of the year |
|
bohy |
Beginning of the hydrological year (1 st. of September) |
|
eohy |
End of hydrological year |
|
quarter |
Quarter period |
|
boq |
Beginning of the quarter |
|
eoq |
End of the quarter |
|
q1 |
1st quarter period |
|
q2 |
2nd quarter period |
|
q3 |
3rd quarter period |
|
q4 |
4th quarter period |
|
eoq1 |
End of first quarter period |
|
eoq2 |
End of second quarter period |
|
eoq3 |
End of third quarter period |
|
eoq4 |
End of fourth quarter period |