Skip to main content

comed-hourly-pricing

Async Python library to retrieve ComEd BESH (Basic Electric Service–Hourly) supply-rate pricing, both the estimated and the actual settled prices.

Prices are exposed as dollars/kWh (floats). The upstream feed reports cents/kWh (e.g. 1.8¢ → 0.018).

Endpoints

HTML ServletFeed (hourly BESH rates)

Method Source feed Columns
get_dual(day) pricingtabledual&date=YYYYMMDD hour-ending, estimated, actual settled (n/a until settled)
get_next_day() pricingtabledaynexttomorrow hour-ending, estimated (empty until ~4:30pm Central)

Timestamps mark the end of the hour and are timezone-aware in America/Chicago.

JSON API (live real-time pricing)

Method Source feed Returns
get_five_minute_feed(start, end) api?type=5minutefeed tuple[PricePoint, ...] — last 24h by default, or a custom range
get_current_hour_average() api?type=currenthouraverage PricePoint | None

start/end are optional Central-local datetimes (sent as YYYYMMDDhhmm).

See ComEd's API documentation for details.

Install / run

uv sync

Usage

import asyncio
from comed_hourly_pricing import Client

async def main():
    async with Client() as client:
        today = await client.get_dual()          # defaults to today (Central)
        for hour in today.settled:
            print(hour.hour_ending, hour.estimated, hour.actual)

        tomorrow = await client.get_next_day()
        if not tomorrow:
            print("Next-day prices not published yet.")

        recent = await client.get_five_minute_feed()   # last 24h, 5-min points
        for point in recent:
            print(point.timestamp, point.price)

        now = await client.get_current_hour_average()
        if now:
            print("Current hour avg:", now.price)

asyncio.run(main())

You may also pass your own session: Client(session=my_session) — a borrowed session is never closed by the client.

Data model

  • HourlyPrice(hour_ending: datetime, estimated: float | None, actual: float | None) — one hour's row.
  • HourlyDayPrices(date, hours) — returned by get_dual; iterable/len/bool, plus .settled and .unsettled views.
  • HourlyNextDayEstimatedPrices(date, hours) — returned by get_next_day; estimate-only (every row's actual is None).
  • PricePoint(timestamp: datetime, price: float) — one live JSON-API reading; timestamp is tz-aware America/Chicago, price is dollars/kWh. Returned by get_five_minute_feed (a tuple) and get_current_hour_average (one, or None).

CLI

uv run python -m comed_hourly_pricing --date 2026-08-02   # dual feed for a date
uv run python -m comed_hourly_pricing --next-day          # next-day estimates
uv run python -m comed_hourly_pricing --five-minute       # last 24h 5-minute feed
uv run python -m comed_hourly_pricing --current-hour      # current-hour average

Polling

These feeds should not be polled frequently. Each method makes a single request. Throttling is the caller's responsibility.

Tests

uv run pytest

Tests run fully offline against captured fixtures in tests/fixtures/.

Development

Requires Python ≥ 3.13 and aiohttp.

Metadata

Release files for comed-hourly-pricing 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for comed-hourly-pricing 0.1.0
File Size Uploaded
comed_hourly_pricing-0.1.0.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for comed-hourly-pricing 0.1.0
File Interpreter ABI Platform
comed_hourly_pricing-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.1 kB

Release files / comed_hourly_pricing-0.1.0.tar.gz

Download URL comed_hourly_pricing-0.1.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0e54c14ac0782152cfa4b23d2768fb5dcf1f7e2d9a0227b4bf78171c402449b0
BLAKE2b-256 checksum
How to use checksums
5cce988d8be157df0b897df1adc4605c73ac9b136f64fb33b8f89c5d4754e265
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.

Transparency log

Release files / comed_hourly_pricing-0.1.0-py3-none-any.whl

Download URL comed_hourly_pricing-0.1.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df4dbb1bdbd84e9bfeca736757fe946a09671aa76aea29a0664059c2bf7c382c
BLAKE2b-256 checksum
How to use checksums
a094076e7593acfa85af11030469e5cb83bd6d6070511ee9569706e7539701a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page