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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

comed_hourly_pricing-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

comed_hourly_pricing-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file comed_hourly_pricing-0.1.0.tar.gz.

File metadata

  • Download URL: comed_hourly_pricing-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for comed_hourly_pricing-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0e54c14ac0782152cfa4b23d2768fb5dcf1f7e2d9a0227b4bf78171c402449b0
MD5 727946f26e59ba16135aa34f1191bb60
BLAKE2b-256 5cce988d8be157df0b897df1adc4605c73ac9b136f64fb33b8f89c5d4754e265

See more details on using hashes here.

Provenance

The following attestation bundles were made for comed_hourly_pricing-0.1.0.tar.gz:

Publisher: pypi.yml on jjlawren/comed-hourly-pricing

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file comed_hourly_pricing-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for comed_hourly_pricing-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df4dbb1bdbd84e9bfeca736757fe946a09671aa76aea29a0664059c2bf7c382c
MD5 594559b1d8ebdd715ecad55082c025f5
BLAKE2b-256 a094076e7593acfa85af11030469e5cb83bd6d6070511ee9569706e7539701a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for comed_hourly_pricing-0.1.0-py3-none-any.whl:

Publisher: pypi.yml on jjlawren/comed-hourly-pricing

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page