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      |
+-----------------------+--------------------------+

Metadata

Release files for aiosvkmimer 0.1.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiosvkmimer 0.1.15
File Size Uploaded Provenance Actions
aiosvkmimer-0.1.15.tar.gz 21.4 kB Without provenance Details for aiosvkmimer-0.1.15.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiosvkmimer 0.1.15
File Interpreter ABI Platform Actions
aiosvkmimer-0.1.15-py3-none-any.whl Python 3 none any Details for aiosvkmimer-0.1.15-py3-none-any.whl

Total release size: 38.9 kB

Release files / aiosvkmimer-0.1.15.tar.gz

Download URL aiosvkmimer-0.1.15.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
baf21a7f0b77363e8d1526b2f84ce863e1571f66886f2d133e908e976e5459fc
BLAKE2b-256 checksum
How to use checksums
d1571113c87038ba371f8d8666e366355cf0ecab742475bc28a2b0eaed7ec43e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / aiosvkmimer-0.1.15-py3-none-any.whl

Download URL aiosvkmimer-0.1.15-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e1772d04a8e695a41c8876b8d5d4f84153873e4c1507a6ff099dd30bb8a1f8d
BLAKE2b-256 checksum
How to use checksums
a0138dd81a2bb19336e5ae03b155931db0e780e9e85a1fa0b24fad42c4932f65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Security for aiosvkmimer 0.1.15

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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