Skip to main content

Python client for Volatile forecast data via the public GraphQL API.

Project description

Volatile Forecast SDK

Python client for authenticated access to forecast dataset queries on the Volatile public GraphQL API. It focuses on a small, typed surface (execute_dataset_query, my_datasets, me, token lifecycle) with client-side validation so integrators pick only supported bidding zones, IANA time zones, percentile fields, and aggregation modes.

About Volatile

Volatile is an energy intelligence company focused on making European power-market data and forecasting workflows easier to consume and operationalize.
This SDK is one of the tools provided to help customers integrate Volatile forecast products directly into Python-based analytics, trading, and automation pipelines.

Install

From this folder:

pip install -e ./python_sdk

Published wheel (after you upload to PyPI):

pip install volatile-forecast-sdk

Runtime dependency: tzdata (IANA zone database for zoneinfo on all platforms).

Runnable checks (login, datasets, query, token-only flow) live in examples/ — see examples/README.md.

License and access model

This SDK is open source under the Apache-2.0 license and is publicly installable.

API usage still requires a valid Volatile customer account and API credentials. The license for this SDK does not grant free API access, and API use is governed by your contract and applicable API Terms of Service.

API endpoint

VolatileForecastClient() targets production by default (https://api.volatile.de). Override when you need staging or another host:

from volatile_forecast_sdk import VolatileForecastClient, DEFAULT_BASE_URL

client = VolatileForecastClient()  # same as VolatileForecastClient(DEFAULT_BASE_URL)
client = VolatileForecastClient("https://api.staging.example.com")

Existing access token, same default:

client = VolatileForecastClient.from_token("eyJ…")  # optional: base_url="https://…"

If you used an older SDK signature from_token(base_url, access_token) positionally, switch to from_token(access_token, base_url=...) (or rely on the default base URL and pass only the token).

Discover parameters (PFM datasets)

For products such as Volatile Load PFM-1, Volatile Spot PFM-1, and Volatile IDC DAS-1, the SDK ships a structured catalog that mirrors the server rules (zone, issue time, and dataset-specific optional keys):

from volatile_forecast_sdk import format_parameter_hints, list_catalog_dataset_names

print(list_catalog_dataset_names())
print(format_parameter_hints("Volatile Load PFM-1"))

Use ForecastQueryParams for a fluent builder with validation and tab-friendly enums:

from volatile_forecast_sdk import (
    VolatileForecastClient,
    ForecastQueryParams,
    EuropeanBiddingZone,
    CommonTimeZone,
    ForecastPercentileField,
    TimeAggregation,
)

client = VolatileForecastClient()
client.login("user", "pass")

params = (
    ForecastQueryParams.for_dataset("Volatile Load PFM-1")
    .with_zone(EuropeanBiddingZone.NO_2)
    .with_time_zone(CommonTimeZone.EUROPE_BERLIN)
    .with_forecast_issue_latest()
    .with_fields(ForecastPercentileField.P50, ForecastPercentileField.P90)
    .with_aggregation(TimeAggregation.FIFTEEN_MINUTES)
    .with_forecast_horizon_hours(168)
)

result = client.execute_dataset_query(name="Volatile Load PFM-1", parameters=params)
rows = result.parsed_rows()

IDC DAS example (lean parameter set):

from volatile_forecast_sdk import CommonTimeZone, EuropeanBiddingZone, ForecastQueryParams

params = (
    ForecastQueryParams.for_dataset("Volatile IDC DAS-1")
    .with_zone(EuropeanBiddingZone.DE_LU)
    .with_time_zone(CommonTimeZone.EUROPE_BERLIN)
    .with_forecast_issue_latest()
)
result = client.execute_dataset_query(name="Volatile IDC DAS-1", parameters=params)

European bidding zones are exposed as EuropeanBiddingZone and EUROPEAN_BIDDING_ZONE_CODES (ENTSO-E-style strings). Time zones use CommonTimeZone presets plus validate_time_zone("Europe/Stockholm") against the full IANA set (zoneinfo.available_timezones()).

Refresh token policy

VolatileForecastClient applies a default RefreshTokenPolicy:

  • Proactive: if the access token looks like a JWT, refresh when wall-clock time is within leeway_seconds of exp (requires a refresh token from login).
  • Reactive: on HTTP 401 or GraphQL errors that look like auth failures, refresh once (configurable) and retry.

Disable automation (manual refresh only):

from volatile_forecast_sdk import VolatileForecastClient, RefreshTokenPolicy

client = VolatileForecastClient(refresh_token_policy=RefreshTokenPolicy(enabled=False))

Tune behavior:

RefreshTokenPolicy(
    enabled=True,
    leeway_seconds=300,
    max_reactive_refreshes=2,
    proactive_refresh=True,
    reactive_refresh_on_graphql_auth_error=True,
)

Helpers: client.access_token_expires_at_unix(), decode_jwt_exp_unix(token) (signature not verified—scheduling only).

Classic dict parameters

You can still pass a plain mapping (no validation beyond the API):

from volatile_forecast_sdk import VolatileForecastClient, normalize_bidding_zone, validate_time_zone

client = VolatileForecastClient()
client.login("user", "pass")

params = {
    "forecast_issue_time": "latest",
    "zone_code": normalize_bidding_zone("NO_2"),
    "time_zone": validate_time_zone("Europe/Berlin"),
}
result = client.execute_dataset_query(name="Volatile Spot PFM-1", parameters=params)

Publishing to PyPI

  1. Pick a unique PyPI project name and set name in pyproject.toml (and project.urls).
  2. Align license and authors with your legal model.
  3. pip install build twine then python -m build inside python_sdk/.
  4. twine upload dist/* using an API token.

The wheel works with pip, uv, Poetry, private indexes, and conda environments as a pip-installed dependency.

API reference (high level)

Symbol Role
VolatileForecastClient GraphQL HTTP client, token policy, execute_dataset_query
DEFAULT_BASE_URL Production API root (https://api.volatile.de); pass a different base_url to override
ForecastQueryParams Validated fluent builder for query parameters
EuropeanBiddingZone, EUROPEAN_BIDDING_ZONE_CODES, normalize_bidding_zone Curated bidding-zone codes
CommonTimeZone, validate_time_zone, list_common_european_time_zones IANA time zones
ForecastPercentileField, TimeAggregation Allowed fields / aggregation values
format_parameter_hints, parameter_hints_for_dataset, STANDARD_FORECAST_DATASETS, IDC_DAS_DATASETS, STANDARD_PFM_DATASETS Documentation-oriented catalog
RefreshTokenPolicy, decode_jwt_exp_unix Token lifecycle
DatasetQueryResult.parsed_rows() Normalize row JSON strings vs objects

Authoritative GraphQL types: schema.public.graphql and graphql_api/types.py in the model_automation repository.

Project details


Download files

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

Source Distribution

volatile_forecast_sdk-0.2.2.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

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

volatile_forecast_sdk-0.2.2-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file volatile_forecast_sdk-0.2.2.tar.gz.

File metadata

  • Download URL: volatile_forecast_sdk-0.2.2.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for volatile_forecast_sdk-0.2.2.tar.gz
Algorithm Hash digest
SHA256 72c134d1df09240461375902938ade934a6ff20bf90841584f2bbd550d3ed4f2
MD5 a0cb40288961d4c25ca2dcb6bc16a5f8
BLAKE2b-256 1e007b1d0e591c4fee3dc7382fdf97689e7f39b40527ce57423e186c5d07039e

See more details on using hashes here.

File details

Details for the file volatile_forecast_sdk-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for volatile_forecast_sdk-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 acacfb5ebbecfb1482466e79b9c76c69e8aa958c92ed0be58ed5216489ed92af
MD5 ed615b9b106adb61b33f44c05105eaa2
BLAKE2b-256 22556bd36ef9ec8395675c7ff182b0b810422219384cd2743eda1e0b43feb874

See more details on using hashes here.

Supported by

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