From 9dc3378337e3c2e979f2e5dece16214213b6e006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20=C5=A0trauch?= Date: Sun, 18 Aug 2024 00:16:11 +0200 Subject: [PATCH] Fix calculation of spot price --- .vscode/launch.json | 20 ++++++++++++++++++++ calculator/main.py | 6 +++--- 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..b345bcf --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,20 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "API server", + "type": "debugpy", + "request": "launch", + "module": "uvicorn", + "args": [ + "calculator.main:app", + "--reload" + ], + "jinja": true, + "console": "integratedTerminal" + } + ] +} diff --git a/calculator/main.py b/calculator/main.py index 53adba8..e3601d6 100644 --- a/calculator/main.py +++ b/calculator/main.py @@ -104,9 +104,9 @@ def read_item( for key, value in spot_data.items(): kwh_fees = kwh_fees_low if int(key) in low_tariff_hours_parsed else kwh_fees_high - spot_hours[key] = value / currency_ratio - spot_hours_total[key] = (value / currency_ratio + kwh_fees) * VAT - spot_hours_for_sell[key] = value / currency_ratio - sell_fees + spot_hours[key] = value * currency_ratio / 1000 + spot_hours_total[key] = (value * currency_ratio / 1000 + kwh_fees) * VAT + spot_hours_for_sell[key] = value * currency_ratio / 1000 - sell_fees spot = Price(hours=spot_hours, now=spot_hours[str(hour)] if is_today else None)