Packages¶
This page lists note-worthy classes and data models.
energyquantified¶
The top-level package with the main class:
EnergyQuantified: The client class. Use this class to initialize the client with an API key and to access API operations.
There is also additional class available here:
RealtoConnection: An alternative client class for Realto users. Use this class to connect to the API via a Realto subscription.
energyquantified.data¶
Where the time series, period-based series and OHLC data models are implemented:
Timeseries: The time series data model. A time series is more or less a series of values. There are three different value types:
TimeseriesList: A list of time series objects.
Periodseries: The period-based series data model. It has two different period types:
OHLC: A data class for a single OHLC. OHLC objects has a reference to:
Product: A description of a traded product (future contract).
OHLCList: A list of OHLC data objects.
SRMC: The server response from an short-run marginal cost (SRMC) calculation. It has multiple attributes, most are defined and used elsewhere. But it has one that is specific for SRMC:
SRMCOptions: A data class holding all factors used in an SRMC calculation.
AbsoluteResult: The absolute forecast data model. It has multiple attributes, most of which are defined and used elsewhere, but theitemsattribute is a list of AbsoluteItem’s exclusively used in AbsoluteResult:
AbsoluteItem: A data class consisting of an instance and a value. The value is the instance’s forecasted value for the delivery of the AbsoluteResult.
energyquantified.metadata¶
Metadata classes are data classes with constants, such as enumerators. There
are quite many classes in energyquantified.metadata:
These two enumerators are useful for aggregation:
Aggregation: Aggregetion methods such as mean, max, min, and so forth.
Filter: Enumerator of filters for electricity futures products such as base, peak.
Area: Representing a price area (or country). An area has a set of exchangeBorderwith some capacityAllocation.
Curve: The identifier of any data series on Energy Quantified. Curves have aCurveTypeto define its storage types (time series, instance, period-based, OHLC) andDataTypefor its data type (forecast, normal, actual, etc.)
Instance: The identifier of any instance (forecasts, mostly).
Place: An identifier of anything with a geographical location, such as a powerplant, a large consumer, a location on a river. SeePlaceTypefor all types.For
OHLCdata, these metadata classes are used:
OHLCField: Enumerator of fields in OHLC data objects.
ContractPeriod: Enumerator of contract periods for OHLC data objects. Typically week, month, quarter, year.These classes are used for subscription information:
Subscription: A class describing your subscription for a given curve.
SubscriptionAccess: Enumerator of access levels for subscriptions.
SubscriptionType: Enumerator of subscription types.
SubscriptionCollectionPerm: Enumerator of user’s permission for a collection.
energyquantified.user¶
User classes provide details for the user account:
User: The user account details.
Organization: The organization details.
AccountManager: The account manager details.
energyquantified.time¶
Date and time utilities.
Resolution: A combination of a frequency and a timezone. It has utility methods for stepping forward and backward in a given interval.
Frequency: Enumerator of supported frequencies on Energy Quantified. Mostly used for aggregations and in combination with resolutions.Commonly used timezones in the European power markets:
local_tz(): Get your the local timezone on your workstation.Useful functions to get dates and date-times:
now(): Get a timezone aware date-time of the current time.
today(): Get a timezone aware date-time of the today at midnight.
to_timezone(): Convert a date-time to given timezone.
get_date(): Create a date with sensible defaults.
get_datetime(): Create a date-time with sensible defaults.
energyquantified.utils¶
Most utilities are internals, but there is one public-facing class in utils:
Page: An immutable list with paging support. Typically used by the metadata APIs to browse “pages” when searching for curves and places.
energyquantified.exceptions¶
All exceptions are defined in this package.
APIError: Base exception for all API errors. It’s subclasses are:
InitializationError: Exception for when client initialization fails.
PageError: Exception for paging failures (see Page).
ParseException: Exception for parsing errors on API responses.
energyquantified.events¶
Implementation of event models and related metadata classes:
Events from the stream are accessed through
eq.events.get_next(),
and there are a few different event models. What is common for all events is
that they have the event_type property with an
energyquantified.events.EventType. The different
events and possible event types:
CurveUpdateEvent: The curve event data model. Curve events describe change in data for aCurve, sometimes also related to anInstance. How data is changed is described by theevent_type:EventType.CURVE_UPDATE: Data in a curve is updatedEventType.CURVE_DELETE: Some data in a curve (or an entire instance) is removedEventType.CURVE_TRUNCATE: All data in a curve is removed
ConnectionEvent: Describes change in the stream connection, such as the cause of a disconnect. Possible event types:EventType.DISCONNECTED: Not connected. The cause (e.g., disconnect or never with connected witheq.events.connect()) is described by other attributes in theConnectionEvent.
TimeoutEvent: Filler event that enable users to act in between events during quiet times. Timeout events are only generated if thetimeoutparameter is set when iteratingeq.events.get_next(). The single event type:EventType.TIMEOUT: No new events in the lasttimeoutseconds
Subscribe to curve events in
eq.events.subscribe_curve_events()
with a list of any of the following filters:
CurveNameFilter: Filter by exact curves
CurveAttributeFilter: Search filters similar to the curve search (metadata)
A successful subscribe returns a
energyquantified.events.CurvesSubscribeResponse object which
consists of the filters and (optionally) event ID subscribed with, confirmed by
the server.
Request the currently active curve event filters from the server with
eq.events.get_curve_filters().