Volue Insight API Python Library

0.7.15 · active · verified Fri Apr 17

The `wapi-python` library provides programmatic access to the Volue Insight API (formerly Wattsight API). It allows users to retrieve energy market data, forecasts, and reports. The current version is 0.7.15. It is actively maintained with regular releases, typically multiple times per year, introducing new features and bug fixes.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a session with the Volue Insight API and retrieve a time series by its ID. It highlights the use of environment variables for credentials and shows how to convert the native `WapiSeries` object to a Pandas DataFrame.

import os
from wapi import Session

# Set up session using client ID and secret (from environment variables or direct arguments)
# Ensure WAPI_CLIENT_ID and WAPI_CLIENT_SECRET environment variables are set.
# Alternatively, pass client_id='your_id' and client_secret='your_secret' directly.
session = Session(
    client_id=os.environ.get('WAPI_CLIENT_ID', 'YOUR_CLIENT_ID'),
    client_secret=os.environ.get('WAPI_CLIENT_SECRET', 'YOUR_CLIENT_SECRET')
)

# Example: Get a single time series by ID
# (Replace 10000001 with a valid series_id from your Volue Insight subscription)
series_id = 10000001
start_date = "2023-01-01"
end_date = "2023-01-07"

try:
    ts = session.get_series(
        series_id=series_id,
        start_date=start_date,
        end_date=end_date
    )

    print(f"Retrieved series {series_id} (type: {type(ts)}):")
    if ts:
        # Convert to Pandas DataFrame for easier manipulation and printing
        print(ts.as_pandas())
    else:
        print("No data retrieved for the specified series and date range.")
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →