OMIEData:
Python package to import data from OMIE (Iberian Peninsula's Electricity Market Operator): https://www.omie.es/
Concretely, you can easily access to data for the following markets:
- Daily market: hourly prices in Spain and Portugal, total hourly energy after auction (with/without billateral contracts), breakdown of the total hourly energy by technology and bid/ask curves.
- Intra-day market: hourly prices for the different sessions and total hourly energy.
- Additional data in next releases.
Installation
The package is uploaded at https://pypi.org/project/OMIEData/, so
python -m pip install OMIEData
from the command line will install the last version uploaded to pypi.
Aternatively, to install it from GitHub repository, type:
python -m pip install git+https://github.com/acruzgarcia/OMIEData
in the command line. You can also install the .whl or .tar.gz files within dist as:
python -m pip install OMIEData-VERSION-py3-none-any.whl
or
python -m pip install OMIEData-VERSION.tar.gz
or to install a previous version from dist_old.
Examples:
A very simple example to download hourly electricity prices and demand:
import datetime as dt
import matplotlib.pyplot as plt
from OMIEData.DataImport.omie_marginalprice_importer import OMIEMarginalPriceFileImporter
from OMIEData.Enums.all_enums import DataTypeInMarginalPriceFile
dateIni = dt.datetime(2020, 1, 1)
dateEnd = dt.datetime(2022, 3, 22)
# This can take time, it is downloading the files from the website..
df = OMIEMarginalPriceFileImporter(date_ini=dateIni, date_end=dateEnd).read_to_dataframe(verbose=True)
df.sort_values(by='DATE', axis=0, inplace=True)
print(df)
The code will generate a data-frame like the following one:
DATE CONCEPT H1 ... H22 H23 H24
0 2020-01-01 PRICE_SP 41.88 ... 45.60 42.90 37.55
1 2020-01-01 PRICE_PT 41.88 ... 45.60 42.90 37.55
2 2020-01-01 ENER_IB 18132.30 ... 22492.60 21800.90 19946.30
3 2020-01-01 ENER_IB_BILLAT 26488.50 ... 32611.70 31523.70 29088.30
4 2020-01-02 PRICE_SP 35.40 ... 42.00 38.60 33.39
... ... ... ... ... ... ...
3241 2022-03-21 PRICE_PT 218.69 ... 261.44 240.29 228.88
3245 2022-03-22 PRICE_PT 223.00 ... 256.00 242.18 212.99
3246 2022-03-22 ENER_IB 20652.20 ... 27113.50 24167.60 21841.50
3244 2022-03-22 PRICE_SP 223.00 ... 256.00 242.18 212.99
3247 2022-03-22 ENER_IB_BILLAT 29840.30 ... 38281.20 34781.90 31872.50
[3248 rows x 26 columns]
You can filter the data-frame to have only the prices in spain, and then plot
# Just prices in spain
str_price_spain = str(DataTypeInMarginalPriceFile.PRICE_SPAIN)
dfPrices = df[df.CONCEPT == str_price_spain]
# Plotting
plt.figure()
plt.plot(dfPrices.DATE, dfPrices.H12, label='H12')
plt.plot(dfPrices.DATE, dfPrices.H23, label='H23')
plt.legend()
plt.show()
which will produce the following plot:
Another example to download hourly demand resulting of the daily market auction, breakdown by technologies:
import datetime as dt
from OMIEData.Enums.all_enums import SystemType
from OMIEData.DataImport.omie_energy_by_technology_importer import OMIEEnergyByTechnologyImporter
dateIni = dt.datetime(2020, 6, 1)
dateEnd = dt.datetime(2020, 7, 30)
system_type = SystemType.SPAIN
# This can take time, it is downloading the files from the website..
df = OMIEEnergyByTechnologyImporter(date_ini=dateIni,
date_end=dateEnd,
system_type=system_type).read_to_dataframe(verbose=True)
df.sort_values(by=['DATE', 'HOUR'], axis=0, inplace=True)
print(df)
Another example to download supply/demand curves:
import datetime as dt
from OMIEData.DataImport.omie_supply_demand_curve_importer import OMIESupplyDemandCurvesImporter
dateIni = dt.datetime(2020, 6, 1)
dateEnd = dt.datetime(2020, 6, 1)
hour = 1
# This can take time, it is downloading the files from the website..
df = OMIESupplyDemandCurvesImporter(date_ini=dateIni, date_end=dateEnd, hour=hour).read_to_dataframe(verbose=True)
df.sort_values(by=['DATE', 'HOUR'], axis=0, inplace=True)
print(df)
Other examples that illustrate the use of the package in here:
Enjoy!.
Metadata
Release files for OMIEData 0.4.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| omiedata-0.4.0.0.tar.gz | 14.1 kB | Without provenance | Details for omiedata-0.4.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| omiedata-0.4.0.0-py3-none-any.whl | Python 3 | none | any | Details for omiedata-0.4.0.0-py3-none-any.whl |
Total release size: 38.0 kB
Release files / omiedata-0.4.0.0.tar.gz
| Download URL | omiedata-0.4.0.0.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9ca7c32dadd61154decba35a165cc8ecf159b86f6f1859f4819d4a99210afe6
|
|
BLAKE2b-256 checksum How to use checksums |
dbad96c7d2897db8e7231d67939a79a56b48b5f0153f08e39e9412f6dd2efcc0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.3
|
Release files / omiedata-0.4.0.0-py3-none-any.whl
| Download URL | omiedata-0.4.0.0-py3-none-any.whl |
|---|---|
| Size | 24.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3cdd4c0d1212b13a5c3e8b6afa29c65eafb228b2d067c22e9a0797b22516a0d
|
|
BLAKE2b-256 checksum How to use checksums |
40d0ecbfed515bf24361181927fffe1a547ab8c85df5775ebb0ed8d410917f54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.3
|
Security for OMIEData 0.4.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.