Skip to main content

AESO Python API

PyPI version Downloads Build Status License: MIT

A Python wrapper for the Alberta Electric System Operator (AESO) API. Easily access pool price reports and electricity market data.

Installation

pip install aeso-python-api

Getting Started

1. Get Your API Key

Register for a free API key at the AESO API Portal.

2. Basic Usage

import os
from aeso import AESOAPI

# Initialize with your API key from environment variable
api_key = os.environ.get('AESO_API_KEY')

# Or directly (not recommended for production)
# api_key = "your-api-key-here"

aeso = AESOAPI(api_key)

# Fetch pool price data
prices = aeso.get_pool_price_report(
    start_date="2023-06-12",
    end_date="2023-06-13"
)

print(prices)

API Reference

Pool Price Report

Fetch electricity pool price data for a specified date range.

Parameters:

  • start_date (str, required): Start date in format YYYY-MM-DD
  • end_date (str, optional): End date in format YYYY-MM-DD

If end_date is omitted, data will include pool price values for all completed settlement hours of the day specified by start_date.

Returns:

A list of PoolPrice objects with the following attributes:

@dataclass
class PoolPrice:
    begin_datetime_utc: datetime  # Start time in UTC
    begin_datetime_mpt: datetime  # Start time in Mountain Time
    pool_price: float            # Pool price in $/MWh
    forecast_pool_price: float   # Forecasted pool price
    rolling_30day_avg: float     # 30-day rolling average

Example:

from aeso import AESOAPI
import os

aeso = AESOAPI(os.environ.get('AESO_API_KEY'))

# Get prices for a date range
prices = aeso.get_pool_price_report(
    start_date="2023-06-12",
    end_date="2023-06-13"
)

# Access the data
for price in prices:
    print(f"{price.begin_datetime_mpt}: ${price.pool_price}/MWh")

Working with Data

Convert to Pandas DataFrame

import pandas as pd
from aeso import AESOAPI
import os

aeso = AESOAPI(os.environ.get('AESO_API_KEY'))

prices = aeso.get_pool_price_report(
    start_date="2023-06-12",
    end_date="2023-06-13"
)

# Convert to DataFrame
df = pd.DataFrame(prices)
print(df.head())

Convert to Spark DataFrame

import pandas as pd
from aeso import AESOAPI
import os

aeso = AESOAPI(os.environ.get('AESO_API_KEY'))

prices = aeso.get_pool_price_report(
    start_date="2023-06-12",
    end_date="2023-06-13"
)

# Convert to pandas first
pdf = pd.DataFrame(prices)

# Then to Spark
spark_df = spark.createDataFrame(pdf)

Testing Your Setup

You can test the API by using the example file:

# Set your API key
export AESO_API_KEY='your-api-key-here'

# Copy and run the example
cp example_template.py example.py
# Edit example.py with your API key, then:
python example.py

Security Note

⚠️ Keep your API key secure

  • Use environment variables instead of hardcoding your API key
  • Never commit your API key to version control
  • Files like example.py, test_new_api.py, and config.py are gitignored for your security

Requirements

  • Python 3.6+
  • requests >= 2.26.0

Resources

License

MIT License

Metadata

Release files for aeso-python-api 0.2.1

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

Source distribution (sdist)

Source distribution for aeso-python-api 0.2.1
File Size Uploaded
aeso_python_api-0.2.1.tar.gz 8.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aeso-python-api 0.2.1
File Interpreter ABI Platform
aeso_python_api-0.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 16.4 kB

Release files / aeso_python_api-0.2.1.tar.gz

Download URL aeso_python_api-0.2.1.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0420647abeb46dda8076c95038ca09dd3264618568ff1e91bd2f9bec8be5ae7a
BLAKE2b-256 checksum
How to use checksums
e8f8695ef9e93943695afcaf3808864948b08f8436f34e0d11a2c6732dfd6383
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / aeso_python_api-0.2.1-py2.py3-none-any.whl

Download URL aeso_python_api-0.2.1-py2.py3-none-any.whl
Size 8.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f82024822531339c8ff04bf4497c114b6ae4d427832759f13cb5e5b7a3ebd09d
BLAKE2b-256 checksum
How to use checksums
8060bc0b79d354f4cf82a41c54a788b72b7dfb01361c1543d07946b130e5e90a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

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