-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathREADME.Rmd
More file actions
196 lines (162 loc) · 9.05 KB
/
README.Rmd
File metadata and controls
196 lines (162 loc) · 9.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# entsoeapi {width="120" height="120"}
<!-- badges: start -->
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)\
[](https://github.com/krose/entsoeapi/actions/workflows/lint-project.yml)\
[](https://github.com/krose/entsoeapi/actions/workflows/R-CMD-check.yml)\
[](https://github.com/krose/entsoeapi/actions/workflows/test-coverage.yml)
<!-- badges: end -->
The goal of `entsoeapi` package is to create an easy wrapper around the ENTSO-E [API](https://documenter.getpostman.com/view/7009892/2s93JtP3F6)'s data and transform them to tabular format without effort. (The downloadable data are available interactively on the ENTSO-E [transparency platform](https://transparency.entsoe.eu/) website as well.)
The package helps with
- displaying the queried endpoint URL to easier double check
- upfront checking of function arguments' validity to avoid useless API calls
- query pagination, by allowing the user to not worry about it at all since the package does all necessary requests
- unpacking compressed file responses
- caching data to enhance processing speed
- converting XML structures to tabular ones
- composing consistent and detailed outputs
- providing related, but not API accessible data (for instance: business_types)
- automatic assigning definitions to codes
- calculating and adding timestamps to data points (the response xml does not contain such information explicitly)
------------------------------------------------------------------------
- Already available ENTSO-E API endpoints:
- MARKET
- implicit_offered_transfer_capacities (11.1)
- explicit_offered_transfer_capacities (11.1.A)
- continuous_offered_transfer_capacities (11.1)
- flow_based_allocations (11.1.B)
- auction_revenue (12.1.A)
- total_nominated_capacity (12.1.B)
- already_allocated_total_capacity (12.1.C)
- day_ahead_prices (12.1.D)
- net_positions (12.1.E)
- congestion_income (12.1.E)
- allocated_transfer_capacities_3rd_countries (12.1.H)
- LOAD
- load_actual_total (6.1.A)
- load_day_ahead_total_forecast (6.1.B)
- load_week_ahead_total_forecast (6.1.C)
- load_month_ahead_total_forecast (6.1.D)
- load_year_ahead_total_forecast (6.1.E)
- load_year_ahead_forecast_margin (8.1)
- GENERATION
- gen_installed_capacity_per_pt (14.1.A)
- the gen_installed_capacity_per_pu (14.1.B)
- gen_day_ahead (14.1.C)
- gen_wind_solar_forecasts (14.1.D)
- gen_per_gen_unit (16.1.A)
- gen_per_prod_type (16.1.B&C)
- the gen_storage_mean_filling_rate (16.1.D)
- TRANSMISSION
- expansion_and_dismantling_project (9.1) (no data available on the ENTSO-E API yet, as of 24 March 2026)
- intraday_cross_border_transfer_limits (11.3)
- forecasted_transfer_capacities (11.1.A)
- day_ahead_commercial_sched (12.1.F)
- total_commercial_sched (12.1.F)
- cross_border_physical_flows (12.1.G)
- redispatching_internal (13.1.A)
- redispatching_cross_border (13.1.A)
- countertrading (13.1.B)
- costs_of_congestion_management (13.1.C)
- OUTAGES
- outages_cons_units (7.1.A&B)
- outages_fallbacks (IFs IN 7.2, mFRR 3.11, aFRR 3.10)
- outages_transmission_grid (10.1.A&B)
- outages_offshore_grid (10.1.C)
- outages_gen_units (15.1.A&B)
- outages_prod_units (15.1.C&D)
- outages_both (15.1.A&B + 15.1.C&D)
- BALANCING
- exchanged_volumes (aFRR 3.16, mFRR 3.17)
- netted_volumes (IFs IN 3.10)
- elastic_demands (IF mFRR 3.4)
- balancing_border_cap_limit (IFs 4.3 & 4.4)
- exchanged_volumes_per_border (3.10, 3.16 & 3.17)
- netted_volumes_per_border (3.10, 3.16 & 3.17) (no data available on the ENTSO-E API yet, as of 24 March 2026)
- hvdc_link_constrains (4.5) (no data available on the ENTSO-E API yet, as of 24 March 2026)
- changes_to_bid_availability (mFRR 9.9, aFRR 9.6&9.8) (no data available on the ENTSO-E API yet, as of 24 March 2026)
- current_balancing_state (12.3.A)
- balancing_energy_bids (12.3.B&C) (no data available on the ENTSO-E API yet, as of 24 March 2026)
- (12.3.D)
- aggregated_balancing_energy_bids (12.3.E)
- procured_balancing_capacity (12.3.F)
- allocation_of_cross_zonal_balancing_cap (12.3.H&I) (no data available on the ENTSO-E API yet, as of 24 March 2026)
- contracted_reserves (17.1.B&C)
- activated_balancing_prices (17.1.F)
- imbalance_prices (17.1.G)
- imbalance_volumes (17.1.H)
- financial_expenses_and_income (17.1.I)
- fcr_total_capacity (187.2)
- rr_and_frr_actual_capacity (188.4 & 189.3)
- shares_of_fcr_capacity (187.2)
- sharing_of_rr_and_frr_capacity (SO GL 190.1) (no data available on the ENTSO-E API yet, as of 24 March 2026)
Be aware, that not all API endpoints are implemented in this package, and not every endpoint provides data.
If you would like to use an unimplemented endpoint, please submit an [issue](https://github.com/krose/entsoeapi/issues/new/choose) and we'll do our best to resolve it.
If the endpoint is already implemented, but the related function gives back an empty table, then check the response XML in a browser using the request URL displayed in the console just after issuing the function call. Another verification option might be to check the response on the [Entsoe-e Transparency Platform](https://transparency.entsoe.eu/).
In case of beta test version functions there may be unique quirks which are not handled yet. So please, compare the resulting tables to the data fn the [Entsoe-e Transparency Platform](https://transparency.entsoe.eu/).
\
<b>IMPORTANT!</b>\
Since the underlying engine has fairly been standardized with the introduction of version 0.7.0.0, there are significant (breaking) changes between the 0.7.0.0 and the previous versions.
## Installation
You can install the development version of entsoeapi from [GitHub](https://github.com/krose/entsoeapi) with:
```{r install, eval=FALSE}
if (!require("devtools", quietly = TRUE)) install.packages("devtools", quiet = TRUE)
devtools::install_github(repo = "krose/entsoeapi", ref = "main")
```
## Security token
Read the related ENTSO-E Transparency Platform documentation [here](https://transparencyplatform.zendesk.com/hc/en-us/articles/12845911031188-How-to-get-security-token) about how to get a security token. You should also create a `.Renviron` file in your working directory with a security token and call it `ENTSOE_PAT`.
```{r edit renviron, eval=FALSE}
if (!require("usethis", quietly = TRUE)) install.packages("usethis", quiet = TRUE)
usethis::edit_r_environ()
```
`ENTSOE_PAT = "your_security_token"`
## Examples
You use the eic codes to get the data. Let’s try to find the eic code for Germany.
```{r example 1}
if (!require("dplyr", quietly = TRUE)) install.packages("dplyr", quiet = TRUE)
entsoeapi::all_approved_eic() |>
dplyr::filter(eic_long_name == "Germany") |>
dplyr::glimpse()
```
For some of the data you need to translate the generation codes.
```{r example 2}
if (!require("knitr", quietly = TRUE)) install.packages("knitr", quiet = TRUE)
entsoeapi::asset_types |>
head(n = 12L) |>
knitr::kable(format = "html")
```
Let’s get the demand of 2020-01-01 in Germany.
```{r example 3}
if (!require("dplyr", quietly = TRUE)) install.packages("dplyr")
entsoeapi::load_actual_total(
eic = "10Y1001A1001A83F",
period_start = lubridate::ymd("2020-01-01", tz = "CET"),
period_end = lubridate::ymd("2020-01-02", tz = "CET")
) |>
dplyr::glimpse()
```
This is basically how all the functions work, so let’s try to get the production data too.
```{r example 4}
if (!require("dplyr", quietly = TRUE)) install.packages("dplyr")
entsoeapi::gen_per_prod_type(
eic = "10Y1001A1001A83F",
period_start = lubridate::ymd("2020-01-01", tz = "CET"),
period_end = lubridate::ymd("2020-01-02", tz = "CET"),
gen_type = NULL,
tidy_output = TRUE
) |>
dplyr::glimpse()
```
## Code of Conduct
Please note that the entsoeapi project is released with a [Contributor Code of Conduct](https://krose.github.io/entsoeapi/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.