A Python tool for fetching electricity market data from the ENTSO-E Transparency Platform RESTful API. This tool provides an interactive command-line interface to download various types of energy market data including load forecasts, generation data, prices, and cross-border flows.
- Features
- Prerequisites
- Installation
- Getting an API Key
- Usage
- Available Data Types
- Supported Countries
- Common Issues and Solutions
- API Limitations
- Development
- Contributing
- Security
- License
- References
- ✅ Interactive command-line interface
- ✅ Support for 12+ different data types (load, generation, prices, etc.)
- ✅ Automatic data chunking for large date ranges
- ✅ Comprehensive error handling with helpful messages
- ✅ Data saved to organized CSV files in a
data/folder - ✅ Support for filtering by production type (PSR)
- ✅ Environment variable support for API key management
- ✅ Detailed logging of API requests and responses
- ✅ Automatic retry logic for failed requests
- Python 3.7 or higher
- pip (Python package installer)
- Visual Studio Code (recommended) or any text editor
-
Clone or download this repository:
git clone https://github.com/yourusername/entsoe-fetch-tool.git cd entsoe-fetch-tool -
Create a virtual environment (recommended):
# Windows python -m venv venv venv\Scripts\activate # macOS/Linux python3 -m venv venv source venv/bin/activate
-
Install required packages:
pip install -r requirements.txt
If
requirements.txtdoesn't exist, install manually:pip install requests pandas python-dotenv
To access the ENTSO-E Transparency Platform API, you need a security token. Follow these steps:
-
Register on ENTSO-E Transparency Platform:
- Go to https://transparency.entsoe.eu/
- Click on "Login/Register" in the top right
- Create a new account
-
Request API Access:
- Send an email to
transparency@entsoe.eu - Subject: "Restful API access"
- Body: Include the email address you used for registration
- Example email:
Subject: Restful API access Dear ENTSO-E Transparency Team, I would like to request access to the RESTful API. My registered email address is: your.email@example.com Thank you.
- Send an email to
-
Generate Your Token:
- After approval (usually within 1-2 business days), log in to your account
- Go to "My Account Settings"
- Click on "Generate a new token"
- Copy and save your token securely
-
Configure the Tool:
- When you first run the tool, it will prompt you to enter your API key
- The key will be saved in a
.envfile for future use - Alternatively, create a
.envfile manually:ENTSOE_API_KEY=your-api-key-here
-
Open the project folder in VS Code:
- File → Open Folder → Select the
entsoe-fetch-toolfolder
- File → Open Folder → Select the
-
Open a terminal in VS Code:
- Terminal → New Terminal
- Or use `Ctrl+`` (backtick)
-
Activate virtual environment (if created):
# Windows venv\Scripts\activate # macOS/Linux source venv/bin/activate
-
Run the tool:
python entsoe-fetch-tool.py
$ python entsoe-fetch-tool.py
=== ENTSO-E Data Fetcher ===
Using API key: c905e7b6-e...0b2a
Do you want to change the API key? (y/N): n
=== ENTSO-E Data Fetcher ===
Available countries:
AL AT BA BE BG BY
CH CZ DE DE_50HZ DE_AMPRION DE_LU
...
Enter country code (e.g., PL, DE, FR): DE
Available data types:
LOAD DATA:
1: System total load forecast - Forecasted electricity consumption
2: Actual total load - Real-time electricity consumption data
GENERATION DATA:
3: Wind and solar forecast - Renewable energy predictions (limited availability)
4: Wind and solar forecast (alt) - Alternative forecast format
5: Actual generation per type - Real-time generation by fuel type
...
Select document type (1-12): 2
Enter start date (YYYY-MM-DD): 2024-01-01
Enter end date (YYYY-MM-DD): 2024-01-07
Fetching data...
✓ Success!
Data saved to: data/entsoe_data_DE_20240101_20240107.csv- System total load forecast (A65) - Day-ahead and week-ahead load forecasts
- Actual total load (A70) - Real-time electricity consumption
- Wind and solar forecast (A74) - Limited availability
- Wind and solar forecast (alt) (A69) - Alternative format
- Actual generation per type (A75) - Generation by fuel type
- Actual generation (A73) - Detailed per-unit generation
- Generation forecast (A71) - Day-ahead schedules
- Installed capacity (A68) - Available generation capacity
- Day-ahead prices (A44) - Electricity market prices
- Transfer capacity (A61) - Cross-border transmission limits
- Cross-border flow (A11) - Actual electricity flows
- Commercial exchanges (A09) - Scheduled cross-border trades
The tool supports all European countries in the ENTSO-E system:
- Western Europe: AT, BE, CH, DE, FR, LU, NL
- Southern Europe: ES, GR, IT, MT, PT
- Northern Europe: DK, FI, NO, SE
- Eastern Europe: BG, CZ, HU, PL, RO, SK
- Baltic States: EE, LT, LV
- Balkans: AL, BA, HR, ME, MK, RS, SI, XK
- Others: BY, GB, IE, RU, TR, UA
Some countries have multiple zones (e.g., DE_50HZ, IT_NORD, NO_1-5).
Problem: API returns error code 999 Solution:
- The selected data type is not available for the country/period
- Try a different data type or country
- Check the availability notes in the tool
Problem: Invalid or missing API key Solution:
- Verify your API key is correct
- Ensure you have API access approved by ENTSO-E
- Check the
.envfile contains the correct key
Problem: Too many requests Solution:
- The tool automatically waits 10 seconds
- Avoid running multiple instances simultaneously
- ENTSO-E limits: 400 requests per minute
Problem: Query successful but no data points Solution:
- Try a shorter date range (1-7 days initially)
- Some data types have specific time limitations
- Historical data may not be available for all periods
Problem: Cannot parse response Solution:
- Check your internet connection
- Verify the API endpoint is accessible
- Report persistent issues
- Most queries: Maximum 1 year
- Generation per unit (A73): Maximum 1 day
- Balancing data: Maximum 100 days
- Default chunk size: 7 days (automatic splitting)
- Maximum 100 documents per query
- Large datasets may be paginated
- Some responses delivered as ZIP files
- 400 requests per minute per user
- Automatic rate limiting built into the tool
- Not all data types available for all countries
- Historical data coverage varies
- Real-time data typically has 5-15 minute delay
entsoe-fetch-tool/
├── entsoe-fetch-tool.py # Main script
├── data/ # Output folder (created automatically)
├── .env # API key configuration (create this)
├── .env.example # Example configuration
├── .gitignore # Git ignore file
├── README.md # This file
├── CONTRIBUTING.md # Contribution guidelines
├── LICENSE.md # MIT License
├── SECURITY.md # Security policy
└── requirements.txt # Python dependencies
ENTSOE_API_KEY: Your ENTSO-E API token
-
Create
.vscode/launch.json:{ "version": "0.2.0", "configurations": [ { "name": "Python: Current File", "type": "python", "request": "launch", "program": "${file}", "console": "integratedTerminal" } ] } -
Set breakpoints by clicking left of line numbers
-
Press F5 to start debugging
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
For security concerns, please see SECURITY.md.
This project is licensed under the MIT License - see LICENSE.md for details.
- ENTSO-E Transparency Platform
- API Documentation
- Postman Collection
- XML Examples
- API Sitemap
- entsoe-py Python Package (alternative implementation)
This tool is based on the official ENTSO-E Transparency Platform API. ENTSO-E is the European Network of Transmission System Operators for Electricity.