Skip to content

fix(CA-ON): update price parser to use DAHourlyOntarioZonalPrice#8731

Open
wil-liammacleod wants to merge 4 commits into
electricitymaps:masterfrom
wil-liammacleod:master
Open

fix(CA-ON): update price parser to use DAHourlyOntarioZonalPrice#8731
wil-liammacleod wants to merge 4 commits into
electricitymaps:masterfrom
wil-liammacleod:master

Conversation

@wil-liammacleod
Copy link
Copy Markdown

@wil-liammacleod wil-liammacleod commented May 14, 2026

Summary

  • IESO discontinued the DispUnconsHOEP (HOEP) report when its Market Renewal Program went live on May 1, 2025, moving Ontario to a two-settlement market structure (a financially binding day-ahead market settled against real-time). The legacy HOEP report's final publication was April 30, 2025, which caused CA-ON price data to stop appearing on hourly and daily timescales. This is documented in IESO's Quick Take: Changes to Reports Site (decommissioned reports p.10, new reports p.4).
  • Switched fetch_price to the replacement DAHourlyOntarioZonalPrice endpoint, which provides equivalent hourly CAD zonal prices for Ontario. This keeps CA-ON consistent with the platform's day-ahead-as-price convention (Nord Pool and ENTSOE zones).
  • Added an IESO_NAMESPACE constant (http://www.ieso.ca/schema) used by IESO's newer reports, with a comment explaining why two namespaces coexist in the parser (legacy theIMO.com/schema for production/exchange, new ieso.ca/schema for forecasts and the DA price).
  • Added test_fetch_price covering the new endpoint with a mocked report fixture and snapshot.
  • Fixed a dead link in CONTRIBUTING.md — updated the parser README URL to its current path.

Test plan

  • uv run pytest electricitymap/contrib/parsers/tests/test_CA_ON.py — all tests pass
  • uv run test_parser CA-ON price — confirm hourly prices are returned for today and yesterday

🤖 Generated with Claude Code

wil-liammacleod and others added 2 commits May 14, 2026 14:06
IESO discontinued the DispUnconsHOEP report in August 2025 when they
launched their new two-settlement market structure. Switch fetch_price
to the replacement DAHourlyOntarioZonalPrice endpoint which provides
the same hourly CAD prices for Ontario.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@wil-liammacleod wil-liammacleod requested a review from a team as a code owner May 14, 2026 18:59
@github-actions github-actions Bot added the python Pull requests that update Python code label May 14, 2026
@wil-liammacleod wil-liammacleod changed the title fix: update dead link to parser README in CONTRIBUTING.md fix(CA-ON): update price parser to use DAHourlyOntarioZonalPrice May 14, 2026
Copy link
Copy Markdown
Member

@VIKTORVAV99 VIKTORVAV99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi and thanks for the PR!
Sorry for the delay in reviewing!

I see this is generated with Claude Code which is perfrectly fine but could you maybe point me to some documentation about this new market structure? Particular around the two market settelement in the body of this PR and the forecasts and DA price the comment is mentioning.

Would it also be possible to create some new tests covering your change?

Other than that it looks good!

wil-liammacleod and others added 2 commits May 29, 2026 10:53
Add test_fetch_price covering the new DAHourlyOntarioZonalPrice endpoint,
using a mocked report fixture and snapshot in the same style as the
existing forecast tests.

Also correct the parser comment: IESO's Market Renewal Program launched
its two-settlement market structure on 2025-05-01 (the legacy HOEP
report's final publication was 2025-04-30), not August 2025.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wil-liammacleod
Copy link
Copy Markdown
Author

@VIKTORVAV99 thanks for the review, and no rush at all!

Market structure / docs: This is IESO's Market Renewal Program, which went live on May 1, 2025 and moved Ontario to a two-settlement market (a binding day-ahead market settled against real-time). The specific report change is documented in IESO's Quick Take: Changes to Reports Site:

  • Old HOEP report (DispUnconsHOEP) — decommissioned, final publication April 30, 2025 (p.10)
  • New Day-Ahead Hourly Ontario Zonal Energy Price (DAHourlyOntarioZonalPrice) — live May 1, 2025 (p.4)

The doc also notes a 90-day retention window (p.11), which is why only ~3 months of history is available. The two-namespace comment in the parser just reflects that the older reports use the legacy theIMO.com/schema while the newer ones (forecasts, DA price) use ieso.ca/schema.

For context, it's my understanding that day-ahead-as-price is the standard convention here — France and the other Nord Pool zones use NORDPOOL.fetch_price (day-ahead) and the ENTSOE zones look to do the same — so that's why I went with it for CA-ON to stay consistent. That said, IESO does also publish a real-time zonal price report (a 5-minute feed) if you think that'd be a better fit — happy to switch or adjust if you'd prefer.

Tests: Added test_fetch_price (matching the existing forecast tests). It mocks a real DAHourlyOntarioZonalPrice report fixture and snapshots the parsed output, covering the new endpoint and the hour-ending → hour-starting conversion. Run with:

uv run pytest electricitymap/contrib/parsers/tests/test_CA_ON.py

Also caught a mistake in my original description — the cutover was May 1, 2025, not August 2025. Fixed in both the description and the code comment. I've also merged the latest master to bring the branch up to date.

@VIKTORVAV99 VIKTORVAV99 self-requested a review May 29, 2026 16:54
@VIKTORVAV99
Copy link
Copy Markdown
Member

@VIKTORVAV99 thanks for the review, and no rush at all!

Market structure / docs: This is IESO's Market Renewal Program, which went live on May 1, 2025 and moved Ontario to a two-settlement market (a binding day-ahead market settled against real-time). The specific report change is documented in IESO's Quick Take: Changes to Reports Site:

  • Old HOEP report (DispUnconsHOEP) — decommissioned, final publication April 30, 2025 (p.10)
  • New Day-Ahead Hourly Ontario Zonal Energy Price (DAHourlyOntarioZonalPrice) — live May 1, 2025 (p.4)

The doc also notes a 90-day retention window (p.11), which is why only ~3 months of history is available. The two-namespace comment in the parser just reflects that the older reports use the legacy theIMO.com/schema while the newer ones (forecasts, DA price) use ieso.ca/schema.

For context, it's my understanding that day-ahead-as-price is the standard convention here — France and the other Nord Pool zones use NORDPOOL.fetch_price (day-ahead) and the ENTSOE zones look to do the same — so that's why I went with it for CA-ON to stay consistent. That said, IESO does also publish a real-time zonal price report (a 5-minute feed) if you think that'd be a better fit — happy to switch or adjust if you'd prefer.

Tests: Added test_fetch_price (matching the existing forecast tests). It mocks a real DAHourlyOntarioZonalPrice report fixture and snapshots the parsed output, covering the new endpoint and the hour-ending → hour-starting conversion. Run with:

uv run pytest electricitymap/contrib/parsers/tests/test_CA_ON.py

Also caught a mistake in my original description — the cutover was May 1, 2025, not August 2025. Fixed in both the description and the code comment. I've also merged the latest master to bring the branch up to date.

Day ahead is the correct to use for this. The live price might also be useful but we should build another parser endpoint for that if we want to use it so we don't mix data.

I'll take a look at the documentation and a second pass at the code on Monday and merge if it looks good!

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants