Archimedes Python SDK
archimedes
is the name of the Python SDK for accessing Optimeering data.
Installation
You can install the SDK directly from PyPi:
Authentication
There are two options for authenticating towards the API when using the Python Client.
- Using personal credentials
- Using machine credentials
Personal Credentials:
To use personal credentials you first need to install the archimedes command line tool arcl
.
pip install arcl
arcl auth login # then, follow the instructions to login with your Microsoft account
Once logged in, API login credentials will be stored in the ~/.archimedes
directory.
Machine Credentials:
To setup Machine Credentials (ie. Service Account credentials) you first need to obtain an API Secret. Only Group owners have the ability to create API Secrets.
- Go to the User Portal - https://user-admin.fabapps.io/index/
- Click on the Group for your Company and then the View API Secrets button
- Click on the Add New button if you want to generate a new Secret
- Take note of the:
- Directory (tenant) ID
- Application (client) ID
- The Secret value
To use the generated credentials set the following environment variables before running invoking the Python Client:
export AZURE_AD_TENANT_ID=<<replace with Dirctory(tenant) ID from above>>
export AZURE_AD_APP_ID=<<replace with Application (client) ID from above>>
export AZURE_AD_APP_CLIENT_CREDENTIAL=<<replace with Secret Value>>
export USE_APP_AUTHENTICATION=True
SDK Reference
rk_within_day.comparison_by_price
(*start: str | Timestamp | datetime*, *end: str | Timestamp | datetime*, *price_area: str*, *ref_price: int*, *ref_dt: str | Timestamp | datetime | None = None*, **, model_name: str= None*, *access_token: str | None = None*, ***kwargs*) → DataFrame
Get the probability of the RK price being less than or equal to the user specified reference price for each hour between start and end (inclusive).
Parameters:
- start – The first hour to fetch prediction for (inclusive).
- end – The last time to fetch prediction for (inclusive).
- price_area – The name of the price area (eg - ‘NO2’, ‘SE4’).
- ref_price – The reference price in € for price comparison.
- ref_dt – The time of the latest RK data to include in the comparison. If None, the latest available reference date is used.
- model_name - Name of prognosis model name to fetch data from.
- access_token – Access token
rk_within_day.directions
(*start: str | Timestamp | datetime*, *end: str | Timestamp | datetime*, *price_area: str*, *ref_dt: str | Timestamp | datetime | None = None*, **, model_name: str= None*, *access_token: str | None = None*, ***kwargs*) → DataFrame
The predicted probability of any given hour is up(UP), down(DOWN) or no direction(NONE).
Parameters:
- start – The first hour to fetch prediction for (inclusive).
- end – The last time to fetch prediction for (inclusive).
- price_area – The name of the price area (eg - ‘NO2’, ‘SE4’).
- ref_dt – The time of the latest RK data to include in the forecast. If not provided, all the data for the given hours with all available ref_dt will be returned.
- model_name - Name of prognosis model name to fetch data from.
- access_token – Access token
rk_within_day.distributions
(*start: str | Timestamp | datetime*, *end: str | Timestamp | datetime*, *price_area: str*, *ref_dt: str | Timestamp | datetime | None = None*, **, model_name: str= None*, *access_token: str | None = None*, ***kwargs*) → DataFrame
The predicted imbalance price distribution. In the response, spread is defined as the difference between the RK price and the spot price (priceRK - pricespot).
Parameters:
- start – The first hour to fetch prediction for (inclusive).
- end – The last time to fetch prediction for (inclusive).
- price_area – The name of the price area (eg - ‘NO2’, ‘SE4’).
- ref_dt – The time of the latest RK data to include in the forecast. If not provided, all the data for the given hours with all available ref_dt will be returned.
- model_name - Name of prognosis model name to fetch data from.
- access_token – Access token
rk_within_day.large_down_fps
(*start: str | Timestamp | datetime*, *end: str | Timestamp | datetime*, *price_area: str*, *large_price_level: int*, *ref_dt: str | Timestamp | datetime | None = None*, *conditional: bool = True*, **, model_name: str= None*, *access_token: str | None = None*, ***kwargs*) → DataFrame
Indicator for whether a given hour will experience a large down RK price.
Parameters:
- start – The first hour to fetch prediction for (inclusive).
- end – The last time to fetch prediction for (inclusive).
- price_area – The name of the price area (eg - ‘NO2’, ‘SE4’).
- large_price_level – The abs(priceRK - priceSpot) spread in €/MWh above which price the RK-spot spread is considered large. Supported values are 20, 50 and 100.
- ref_dt – The time of the latest RK data to include in the forecast. If not provided, all the data for the given hours with all available ref_dt will be returned.
- conditional – Whether to fetch conditional data (one of ‘True’ and ‘False’). Defaults to True.
- model_name - Name of prognosis model name to fetch data from.
- access_token – Access token
rk_within_day.large_up_fps
(*start: str | Timestamp | datetime*, *end: str | Timestamp | datetime*, *price_area: str*, *large_price_level: int*, *ref_dt: str | Timestamp | datetime | None = None*, *conditional: bool = True*, **, model_name: str= None*, *access_token: str | None = None*, ***kwargs*) → DataFrame
Indicator for whether a given hour will experience a large up RK price.
Parameters:
- start – The first hour to fetch prediction for (inclusive).
- end – The last time to fetch prediction for (inclusive).
- price_area – The name of the price area (eg - ‘NO2’, ‘SE4’).
- large_price_level – The abs(priceRK - priceSpot) spread in €/MWh above which price the RK-spot spread is considered large. Supported values are 20, 50 and 100.
- ref_dt – The time of the latest RK data to include in the forecast. If not provided, all the data for the given hours with all available ref_dt will be returned.
- conditional – Whether to fetch conditional data (one of ‘True’ and ‘False’). Defaults to True.
- model_name - Name of prognosis model name to fetch data from.
- access_token – Access token
quantile_average
(start: str | Timestamp | datetime, end: str | Timestamp | datetime.datetime, price_area: str, ref_dt: str | Timestamp | datetime | None = None, *, model_name: str= None, access_token: str = None, **kwargs) -> DataFrame*
Gets the average of predicted prices over different quantile.
Parameters:
- start - The first hour to fetch prediction for (inclusive).
- end - The last time to fetch prediction for (inclusive).
- price_area - The name of the price area (eg - 'NO2', 'SE4').
- ref_dt - The time of the latest RK data to include in the comparison. If None, the latest available reference date is used.
- model_name - Name of prognosis model name to fetch data from.
- access_token - Access token