Skip to main content

aiosvkmimer

Asyncio library for SVK Mimer https://mimer.svk.se/

UNDER DEVELOPMENT!!!

Example

#!/usr/bin/env python3
import asyncio
import logging
import pprint

from aiosvkmimer.client import Mimer
from prettytable import PrettyTable

# settings
AVAILABLE_KW = 8
LOGGING_LEVEL = logging.INFO
PERIOD_FROM = '2023-09-01'
PERIOD_TO = '2023-09-01'

# configure logging
logging.basicConfig(
    format='%(asctime)s.%(msecs)03d %(levelname)s %(module)s - %(funcName)s: %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S',
    level=LOGGING_LEVEL
)

def nice_price_output(prices, prices_sum, description):
    table = PrettyTable()
    table.field_names = ['Date', f'{description} Price (SEK)']
    table.align = 'l'
    table.padding_width = 2
    for date, price in prices.items():
        table.add_row([date, price])
    table.add_row(['Total', prices_sum])
    print(table)

async def main():
    mimer = Mimer(
        kw_available=AVAILABLE_KW
    )
    await mimer.fetch(
        period_from=PERIOD_FROM,
        period_to=PERIOD_TO
    )

    prices_fcr_n = mimer.get_fcr_n_prices()
    prices_fcr_d_up = mimer.get_fcr_d_up_prices()
    prices_fcr_d_down = mimer.get_fcr_d_down_prices()

    nice_price_output(
        prices = prices_fcr_n,
        prices_sum = mimer.get_sum_prices(prices_fcr_n),
        description = 'FCR-N'
    )

    nice_price_output(
        prices = prices_fcr_d_up,
        prices_sum = mimer.get_sum_prices(prices_fcr_d_up),
        description = 'FCR-D UP'
    )

    nice_price_output(
        prices = prices_fcr_d_down,
        prices_sum = mimer.get_sum_prices(prices_fcr_d_down),
        description = 'FCR-D DOWN'
    )

if __name__ == '__main__':
    asyncio.run(main())

Output

+-----------------------+----------------------+
|  Date                 |  FCR-N Price (SEK)   |
+-----------------------+----------------------+
|  2023-09-01 00:00:00  |  5.486731094065      |
|  2023-09-01 01:00:00  |  5.473278975271923   |
|  2023-09-01 02:00:00  |  5.483046953399573   |
|  2023-09-01 03:00:00  |  6.024919011768675   |
|  2023-09-01 04:00:00  |  6.104584800746637   |
|  2023-09-01 05:00:00  |  5.986810670706285   |
|  2023-09-01 06:00:00  |  5.294082266137055   |
|  2023-09-01 07:00:00  |  5.916679569335204   |
|  2023-09-01 08:00:00  |  5.313394297072511   |
|  2023-09-01 09:00:00  |  5.348831037548244   |
|  2023-09-01 10:00:00  |  5.9203287697025315  |
|  2023-09-01 11:00:00  |  5.135825881194346   |
|  2023-09-01 12:00:00  |  5.444676166159138   |
|  2023-09-01 13:00:00  |  5.870019916245568   |
|  2023-09-01 14:00:00  |  5.850853828046824   |
|  2023-09-01 15:00:00  |  5.273275331522941   |
|  2023-09-01 16:00:00  |  5.797683169549086   |
|  2023-09-01 17:00:00  |  5.319454888932867   |
|  2023-09-01 18:00:00  |  5.611263498677803   |
|  2023-09-01 19:00:00  |  5.239250943858182   |
|  2023-09-01 20:00:00  |  5.93201670243       |
|  2023-09-01 21:00:00  |  5.210278111126205   |
|  2023-09-01 22:00:00  |  5.133704096332981   |
|  2023-09-01 23:00:00  |  5.356158378649376   |
|  Total                |  133.52714835847897  |
+-----------------------+----------------------+
+-----------------------+------------------------+
|  Date                 |  FCR-D UP Price (SEK)  |
+-----------------------+------------------------+
|  2023-09-01 00:00:00  |  3.311632998865711     |
|  2023-09-01 01:00:00  |  3.288935554512015     |
|  2023-09-01 02:00:00  |  3.213295847960331     |
|  2023-09-01 03:00:00  |  3.3367902114671084    |
|  2023-09-01 04:00:00  |  3.398391009694043     |
|  2023-09-01 05:00:00  |  3.3220856146399993    |
|  2023-09-01 06:00:00  |  3.57437562248         |
|  2023-09-01 07:00:00  |  3.3276878273599997    |
|  2023-09-01 08:00:00  |  3.5360363853152434    |
|  2023-09-01 09:00:00  |  3.3858881034742017    |
|  2023-09-01 10:00:00  |  3.4942032289633813    |
|  2023-09-01 11:00:00  |  3.4234401975693007    |
|  2023-09-01 12:00:00  |  3.398380667428867     |
|  2023-09-01 13:00:00  |  3.4784308005587947    |
|  2023-09-01 14:00:00  |  3.467791909074881     |
|  2023-09-01 15:00:00  |  3.356563749603953     |
|  2023-09-01 16:00:00  |  3.4768104629727423    |
|  2023-09-01 17:00:00  |  3.3993578147653962    |
|  2023-09-01 18:00:00  |  3.4107899648525573    |
|  2023-09-01 19:00:00  |  3.399232440138542     |
|  2023-09-01 20:00:00  |  3.26405194036575      |
|  2023-09-01 21:00:00  |  3.3716430111448683    |
|  2023-09-01 22:00:00  |  3.287736021089064     |
|  2023-09-01 23:00:00  |  3.3028224861553075    |
|  Total                |  81.22637387045205     |
+-----------------------+------------------------+
+-----------------------+--------------------------+
|  Date                 |  FCR-D DOWN Price (SEK)  |
+-----------------------+--------------------------+
|  2023-09-01 00:00:00  |  6.320488106056495       |
|  2023-09-01 01:00:00  |  6.112997699823686       |
|  2023-09-01 02:00:00  |  6.134507849844338       |
|  2023-09-01 03:00:00  |  6.499827573714409       |
|  2023-09-01 04:00:00  |  6.844614022955501       |
|  2023-09-01 05:00:00  |  6.503989107457241       |
|  2023-09-01 06:00:00  |  5.819638910411214       |
|  2023-09-01 07:00:00  |  5.3365174089495655      |
|  2023-09-01 08:00:00  |  5.884750472026569       |
|  2023-09-01 09:00:00  |  5.607872638348425       |
|  2023-09-01 10:00:00  |  6.010793589290964       |
|  2023-09-01 11:00:00  |  5.860842833901714       |
|  2023-09-01 12:00:00  |  5.903521302210824       |
|  2023-09-01 13:00:00  |  5.986418718780103       |
|  2023-09-01 14:00:00  |  5.638328690026532       |
|  2023-09-01 15:00:00  |  5.50365199491099        |
|  2023-09-01 16:00:00  |  6.00273359520028        |
|  2023-09-01 17:00:00  |  5.799405263827196       |
|  2023-09-01 18:00:00  |  6.062401602087815       |
|  2023-09-01 19:00:00  |  5.780730776740605       |
|  2023-09-01 20:00:00  |  6.2497822237014375      |
|  2023-09-01 21:00:00  |  5.658725413145366       |
|  2023-09-01 22:00:00  |  5.317705775310582       |
|  2023-09-01 23:00:00  |  6.1910944685587         |
|  Total                |  143.03134003728056      |
+-----------------------+--------------------------+

Download files

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

Source Distribution

aiosvkmimer-0.1.15.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

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

aiosvkmimer-0.1.15-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file aiosvkmimer-0.1.15.tar.gz.

File metadata

  • Download URL: aiosvkmimer-0.1.15.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for aiosvkmimer-0.1.15.tar.gz
Algorithm Hash digest
SHA256 baf21a7f0b77363e8d1526b2f84ce863e1571f66886f2d133e908e976e5459fc
MD5 d0bab67d35207cc37f25d37becf78a2d
BLAKE2b-256 d1571113c87038ba371f8d8666e366355cf0ecab742475bc28a2b0eaed7ec43e

See more details on using hashes here.

File details

Details for the file aiosvkmimer-0.1.15-py3-none-any.whl.

File metadata

  • Download URL: aiosvkmimer-0.1.15-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for aiosvkmimer-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 0e1772d04a8e695a41c8876b8d5d4f84153873e4c1507a6ff099dd30bb8a1f8d
MD5 cdde23f9209abeda76a879403e6806c3
BLAKE2b-256 a0138dd81a2bb19336e5ae03b155931db0e780e9e85a1fa0b24fad42c4932f65

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.15 This release

2 files

0.1.14

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.5

2 files

0.1.2

2 files

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page