Regular rate pvpc (Precio Voluntario para el Pequeño Consumidor) (in spanish) is a way of fixing the electricity price. It was designed and is regulated by Spanish Government. It only concerns to clients within regulated electricity market.
This price es calculated daily by Red Eléctrica de España (REE) (in spanish) in terms of hourly prices of market energy. Electricity price can change hourly according to the evolution of electric market.
Prices are daily published at Red Eléctrica Española website.
The idea behing this project is to make a daily scraping on REE website and get the pvpc of next day, adding these new data to an existing file containing historical data.
pvpc data is available on file pvpc.csv. There is information since 1st April 2014 with records during 24 hours per day and data concerning the Spanish Mainland, Balearic and Canary Islands (peaje 2.0 TD).
Each record has got these two fields:
YYYYMMDDTHHMMSS
This file is updated daily in an automatic manner.
Datasets are also available at Kaggle.
Create a Python virtualenv and install requirements:
$ python3.10 -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
Optionally, you can create a .env
file in the working directory to overwrite settings from settings.py.
There are few external requirements for the project to work properly:
$ python main.py --help
Usage: main.py [OPTIONS]
Options:
-v, --verbose Increase loglevel to debug.
-t, --tomorrow Get kWh prices for tomorrow.
-x, --recreate Recreate output data file.
-d, --dates TEXT Date(s) to be scraped. If a range is wanted, use YYYY-MM-
DD:YYYY-MM:DD (both included). [default: 2022-07-13]
-o, --output PATH Output file to store results. [default:
/apps/pvpc/data/pvpc.csv]
--help Show this message and exit.
A common usage would be just python main.py -v
. It will try to get electricity prices for today. After each execution, new data is appended to pvpc.csv.