Menu

Getting Brazil's wholesale electricity price (ONS CMO) in Python – hourly, in English, CC BY 4.0
📰

Getting Brazil's wholesale electricity price (ONS CMO) in Python – hourly, in English, CC BY 4.0

DEV Community: python·JP Open Data·6 days ago
#pfp00bLn
#devtopython#devto#dev#hourly#dataset
Reading 0:00
15s threshold

Brazil runs one of the world's largest hydro-dominated power systems, and its grid operator ONS publishes the half-hourly CMO ( Custo Marginal de Operação , marginal operating cost) for each submarket as open data under CC BY 4.0 . The CMO is the basis of the PLD spot price. Here's how to use it.

The raw data

Dataset page: https://dados.ons.org.br/dataset/cmo-semi-horario

One CSV per year, semicolon-separated:

id_subsistema;nom_subsistema;din_instante;val_cmo SE;SUDESTE;2026-11-08 23:30:00;27.75 N;NORTE;2026-11-08 23:30:00;103.95

Enter fullscreen mode

Exit fullscreen mode

id_subsistema : SE (Southeast/Center-West), S (South), NE (Northeast), N (North)

din_instante : start of the half-hour, Brasília time (UTC-03:00), no offset in the string

val_cmo : BRL/MWh

Hourly averages with only the standard library

import csv , io , urllib .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.