Name | awattar JSON |
Version |
0.8.1
JSON |
| download |
home_page | |
Summary | aWATTar Client to analyse the energy market data |
upload_time | 2023-12-20 18:02:26 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.8 |
license | GPL-3.0 |
keywords |
awattar
energy market price api
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# awattar
## Installation
```sh
$ pip install awattar
```
This package is tested with Python 3.9, 3.10, 3.11
## Command line
Use the command `awattar --help` and `awattar fetch-prices --help` to get more information.
```shell
$ awattar --help
Usage: awattar [OPTIONS] COMMAND [ARGS]...
Access aWATTar's energy prices API.
Options:
--country [DE|AT] the API's target country (either Germany or Austria),
default: AT
--help Show this message and exit.
Commands:
fetch-prices Fetch hourly energy prices
```
### Command line example
```shell
$ awattar --country AT fetch-prices --day 2023-02-20
[
{
"start": "2023-02-20T00:00:00+01:00",
"end": "2023-02-20T01:00:00+01:00",
"price": 85.96,
"unit": "Eur/MWh",
"currency": "Eur",
"energy_unit": "MWh",
"price_per_kWh": 0.08596
},
...
]
```
## Examples
```python
from awattar.client import AwattarClient
print ('Connect to aWATTar')
client = AwattarClient('AT') # or DE for Germany
print ('Get marketdata from API')
data = client.request()
for item in data:
print(f'{item.start_datetime:%Y-%m-%d %H:%M:%S} - {item.end_datetime:%Y-%m-%d %H:%M:%S} - {(item.marketprice / 1000):.4f} EUR/kWh')
```
Output
```
Connect to aWATTar
Get marketdata from API
2020-08-11 13:00:00 - 2020-08-11 14:00:00 - 0.0350 EUR/kWh
2020-08-11 14:00:00 - 2020-08-11 15:00:00 - 0.0341 EUR/kWh
2020-08-11 15:00:00 - 2020-08-11 16:00:00 - 0.0340 EUR/kWh
2020-08-11 16:00:00 - 2020-08-11 17:00:00 - 0.0387 EUR/kWh
2020-08-11 17:00:00 - 2020-08-11 18:00:00 - 0.0417 EUR/kWh
2020-08-11 18:00:00 - 2020-08-11 19:00:00 - 0.0430 EUR/kWh
2020-08-11 19:00:00 - 2020-08-11 20:00:00 - 0.0465 EUR/kWh
2020-08-11 20:00:00 - 2020-08-11 21:00:00 - 0.0413 EUR/kWh
2020-08-11 21:00:00 - 2020-08-11 22:00:00 - 0.0400 EUR/kWh
2020-08-11 22:00:00 - 2020-08-11 23:00:00 - 0.0369 EUR/kWh
2020-08-11 23:00:00 - 2020-08-12 00:00:00 - 0.0309 EUR/kWh
```
## Usage
### Initialize Awattar Client
Currently only Austria and Germany are supported
```python
client = AwattarClient('AT') # or DE for Germany
```
### Get Market data
Get current Market data
```python
data = client.request()
```
Get Market data from 2020-05-17
```python
data = client.request(datetime.datetime(2020, 5, 17))
```
Get Market data between 2020-05-18 and 2020-05-19
```python
data = client.request(datetime.datetime(2020, 5, 18), datetime.datetime(2020, 5, 19))
```
### Analyse Market data
```python
print ('Connect to aWATTar')
client = AwattarClient('AT')
print ('Get Market data from API')
client.request()
min_item = client.min()
print(f'Min: {min_item.start_datetime:%Y-%m-%d %H:%M:%S} - {min_item.end_datetime:%Y-%m-%d %H:%M:%S} - {(min_item.marketprice / 1000):.4f} EUR/kWh')
max_item = client.max()
print(f'Max: {max_item.start_datetime:%Y-%m-%d %H:%M:%S} - {max_item.end_datetime:%Y-%m-%d %H:%M:%S} - {(max_item.marketprice / 1000):.4f} EUR/kWh')
mean_item = client.mean()
print(f'Mean: {mean_item.start_datetime:%Y-%m-%d %H:%M:%S} - {mean_item.end_datetime:%Y-%m-%d %H:%M:%S} - {(mean_item.marketprice / 1000):.4f} EUR/kWh')
best_slot = client.best_slot(3)
if best_slot is None:
print("No slot found")
else:
print(f'Best slot 1: {best_slot.start_datetime:%Y-%m-%d %H:%M:%S} - {best_slot.end_datetime:%Y-%m-%d %H:%M:%S} - {(best_slot.marketprice / 1000):.4f} EUR/kWh')
best_slot = client.best_slot(1,datetime.datetime(2020, 10, 5, 0, 0, 0),datetime.datetime(2020, 10, 6, 3, 0, 0))
if best_slot is None:
print("No slot found")
else:
print(f'Best slot 2: {best_slot.start_datetime:%Y-%m-%d %H:%M:%S} - {best_slot.end_datetime:%Y-%m-%d %H:%M:%S} - {(best_slot.marketprice / 1000):.4f} EUR/kWh')
```
Output
```
Connect to aWATTar
Get Market data from API
Min: 2020-10-06 03:00:00 - 2020-10-06 04:00:00 - 0.0107 EUR/kWh
Max: 2020-10-05 19:00:00 - 2020-10-05 20:00:00 - 0.0544 EUR/kWh
Mean: 2020-10-05 17:00:00 - 2020-10-06 17:00:00 - 0.0349 EUR/kWh
Best slot 1: 2020-10-06 02:00:00 - 2020-10-06 05:00:00 - 0.0149 EUR/kWh
Best slot 2: 2020-10-06 02:00:00 - 2020-10-06 03:00:00 - 0.0190 EUR/kWh
```
# Source code
The source code is currently available on Github: [https://github.com/Gransi/awattar](https://github.com/Gransi/awattar)
Raw data
{
"_id": null,
"home_page": "",
"name": "awattar",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "awattar,energy market price api",
"author": "",
"author_email": "Peter Gransdorfer <peter.gransdorfer@cattronix.com>",
"download_url": "https://files.pythonhosted.org/packages/59/d1/ee2a988061abadac29f3df2ea55254138bbb49c169f3c365a0134a0e2086/awattar-0.8.1.tar.gz",
"platform": null,
"description": "# awattar\n\n## Installation\n\n```sh\n$ pip install awattar\n```\n\nThis package is tested with Python 3.9, 3.10, 3.11\n\n## Command line\n\nUse the command `awattar --help` and `awattar fetch-prices --help` to get more information.\n\n```shell\n$ awattar --help\nUsage: awattar [OPTIONS] COMMAND [ARGS]...\n\n Access aWATTar's energy prices API.\n\nOptions:\n --country [DE|AT] the API's target country (either Germany or Austria),\n default: AT\n --help Show this message and exit.\n\nCommands:\n fetch-prices Fetch hourly energy prices\n```\n\n### Command line example\n\n```shell\n$ awattar --country AT fetch-prices --day 2023-02-20\n[\n {\n \"start\": \"2023-02-20T00:00:00+01:00\",\n \"end\": \"2023-02-20T01:00:00+01:00\",\n \"price\": 85.96,\n \"unit\": \"Eur/MWh\",\n \"currency\": \"Eur\",\n \"energy_unit\": \"MWh\",\n \"price_per_kWh\": 0.08596\n },\n ...\n]\n```\n\n## Examples\n\n```python\n from awattar.client import AwattarClient\n\n print ('Connect to aWATTar')\n client = AwattarClient('AT') # or DE for Germany\n\n print ('Get marketdata from API')\n data = client.request()\n \n for item in data:\n print(f'{item.start_datetime:%Y-%m-%d %H:%M:%S} - {item.end_datetime:%Y-%m-%d %H:%M:%S} - {(item.marketprice / 1000):.4f} EUR/kWh')\n\n```\n\nOutput\n```\nConnect to aWATTar\nGet marketdata from API\n2020-08-11 13:00:00 - 2020-08-11 14:00:00 - 0.0350 EUR/kWh\n2020-08-11 14:00:00 - 2020-08-11 15:00:00 - 0.0341 EUR/kWh\n2020-08-11 15:00:00 - 2020-08-11 16:00:00 - 0.0340 EUR/kWh\n2020-08-11 16:00:00 - 2020-08-11 17:00:00 - 0.0387 EUR/kWh\n2020-08-11 17:00:00 - 2020-08-11 18:00:00 - 0.0417 EUR/kWh\n2020-08-11 18:00:00 - 2020-08-11 19:00:00 - 0.0430 EUR/kWh\n2020-08-11 19:00:00 - 2020-08-11 20:00:00 - 0.0465 EUR/kWh\n2020-08-11 20:00:00 - 2020-08-11 21:00:00 - 0.0413 EUR/kWh\n2020-08-11 21:00:00 - 2020-08-11 22:00:00 - 0.0400 EUR/kWh\n2020-08-11 22:00:00 - 2020-08-11 23:00:00 - 0.0369 EUR/kWh\n2020-08-11 23:00:00 - 2020-08-12 00:00:00 - 0.0309 EUR/kWh\n```\n\n## Usage\n\n### Initialize Awattar Client\n\nCurrently only Austria and Germany are supported\n\n```python\n client = AwattarClient('AT') # or DE for Germany\n```\n\n### Get Market data\n\nGet current Market data\n```python\n data = client.request()\n```\n\nGet Market data from 2020-05-17\n```python\n data = client.request(datetime.datetime(2020, 5, 17))\n```\n\nGet Market data between 2020-05-18 and 2020-05-19\n```python\n data = client.request(datetime.datetime(2020, 5, 18), datetime.datetime(2020, 5, 19))\n```\n\n### Analyse Market data\n\n```python\n print ('Connect to aWATTar')\n client = AwattarClient('AT')\n\n print ('Get Market data from API')\n client.request()\n \n min_item = client.min()\n print(f'Min: {min_item.start_datetime:%Y-%m-%d %H:%M:%S} - {min_item.end_datetime:%Y-%m-%d %H:%M:%S} - {(min_item.marketprice / 1000):.4f} EUR/kWh')\n\n max_item = client.max()\n print(f'Max: {max_item.start_datetime:%Y-%m-%d %H:%M:%S} - {max_item.end_datetime:%Y-%m-%d %H:%M:%S} - {(max_item.marketprice / 1000):.4f} EUR/kWh')\n\n mean_item = client.mean()\n print(f'Mean: {mean_item.start_datetime:%Y-%m-%d %H:%M:%S} - {mean_item.end_datetime:%Y-%m-%d %H:%M:%S} - {(mean_item.marketprice / 1000):.4f} EUR/kWh')\n\n\n best_slot = client.best_slot(3)\n if best_slot is None:\n print(\"No slot found\")\n else: \n print(f'Best slot 1: {best_slot.start_datetime:%Y-%m-%d %H:%M:%S} - {best_slot.end_datetime:%Y-%m-%d %H:%M:%S} - {(best_slot.marketprice / 1000):.4f} EUR/kWh')\n\n best_slot = client.best_slot(1,datetime.datetime(2020, 10, 5, 0, 0, 0),datetime.datetime(2020, 10, 6, 3, 0, 0))\n if best_slot is None:\n print(\"No slot found\")\n else: \n print(f'Best slot 2: {best_slot.start_datetime:%Y-%m-%d %H:%M:%S} - {best_slot.end_datetime:%Y-%m-%d %H:%M:%S} - {(best_slot.marketprice / 1000):.4f} EUR/kWh')\n```\n\nOutput\n```\nConnect to aWATTar\nGet Market data from API\nMin: 2020-10-06 03:00:00 - 2020-10-06 04:00:00 - 0.0107 EUR/kWh\nMax: 2020-10-05 19:00:00 - 2020-10-05 20:00:00 - 0.0544 EUR/kWh\nMean: 2020-10-05 17:00:00 - 2020-10-06 17:00:00 - 0.0349 EUR/kWh\nBest slot 1: 2020-10-06 02:00:00 - 2020-10-06 05:00:00 - 0.0149 EUR/kWh\nBest slot 2: 2020-10-06 02:00:00 - 2020-10-06 03:00:00 - 0.0190 EUR/kWh\n```\n\n# Source code\nThe source code is currently available on Github: [https://github.com/Gransi/awattar](https://github.com/Gransi/awattar)\n",
"bugtrack_url": null,
"license": "GPL-3.0",
"summary": "aWATTar Client to analyse the energy market data",
"version": "0.8.1",
"project_urls": {
"Download": "https://github.com/Gransi/awattar",
"Homepage": "https://github.com/Gransi/awattar",
"Source": "https://github.com/Gransi/awattar",
"Tracker": "https://github.com/Gransi/awattar/issues"
},
"split_keywords": [
"awattar",
"energy market price api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6ce07cbada9567144795453892670d729d01d7e70dab25f2de410c6d66bf45d1",
"md5": "a6ebea84c59cf4bd8af0afe95d7f7807",
"sha256": "73e576c309c980ea9ba3111819900bbc597dac9425f90514f341e71e1ff4c275"
},
"downloads": -1,
"filename": "awattar-0.8.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a6ebea84c59cf4bd8af0afe95d7f7807",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 22556,
"upload_time": "2023-12-20T18:02:25",
"upload_time_iso_8601": "2023-12-20T18:02:25.817662Z",
"url": "https://files.pythonhosted.org/packages/6c/e0/7cbada9567144795453892670d729d01d7e70dab25f2de410c6d66bf45d1/awattar-0.8.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "59d1ee2a988061abadac29f3df2ea55254138bbb49c169f3c365a0134a0e2086",
"md5": "abafa1c3d88ae7dffeb0c93e7ebc4201",
"sha256": "8e33c64ece050f66672ab2724ee9a94895ad7cbe511e56a83ca868a140e0cb9b"
},
"downloads": -1,
"filename": "awattar-0.8.1.tar.gz",
"has_sig": false,
"md5_digest": "abafa1c3d88ae7dffeb0c93e7ebc4201",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 27241,
"upload_time": "2023-12-20T18:02:26",
"upload_time_iso_8601": "2023-12-20T18:02:26.893786Z",
"url": "https://files.pythonhosted.org/packages/59/d1/ee2a988061abadac29f3df2ea55254138bbb49c169f3c365a0134a0e2086/awattar-0.8.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-20 18:02:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Gransi",
"github_project": "awattar",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "awattar"
}