esios CLI provides a powerful interface for fetching and analyzing Spanish electricity market data from the ESIOS API.
Installation
Install python-esios with CLI support:Quick Start
Authentication
Set your API token (obtain from ESIOS):--tokenflag (highest priority)- Config file (
~/.config/esios/config.toml) ESIOS_API_KEYenvironment variable
Basic Usage
Command Structure
The CLI is organized into subcommands:Common Workflows
Fetch and Export Data
Get spot price data and export to CSV:Data Analysis with Python Expressions
Theexec command allows you to evaluate Python expressions on fetched data:
df— pandas DataFrame with the fetched datapd— pandas modulenp— numpy module
Work with Archives
Download and parse I90DIA archive files:Geography Filtering
Many indicators have multiple geographies. Filter by geo ID or name:Offline Catalog
The catalog provides offline access to indicator and archive metadata:Cache Management
The CLI caches API responses for performance:Output Formats
Most commands support multiple output formats via the--format flag:
table(default) — Rich-formatted table for terminal displaycsv— Comma-separated valuesjson— JSON array of recordsparquet— Apache Parquet (requires--outputpath)
Global Options
--token, -t— Override API token for a single command--help— Show help for any command or subcommand
Environment Variables
ESIOS_API_KEY— API authentication token
Configuration File
Config file location:~/.config/esios/config.toml
Example configuration:
Next Steps
Indicators
Fetch and analyze indicator data
Archives
Download and parse archive files
Cache
Manage cached API responses
Catalog
Browse offline metadata catalog
