Fix calculation of spot price

This commit is contained in:
Adam Štrauch 2024-08-18 00:16:11 +02:00
parent 84e5b54837
commit 9dc3378337
Signed by: cx
GPG Key ID: 7262DAFE292BCE20
2 changed files with 23 additions and 3 deletions

20
.vscode/launch.json vendored Normal file
View File

@ -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"
}
]
}

View File

@ -104,9 +104,9 @@ def read_item(
for key, value in spot_data.items(): for key, value in spot_data.items():
kwh_fees = kwh_fees_low if int(key) in low_tariff_hours_parsed else kwh_fees_high 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[key] = value * currency_ratio / 1000
spot_hours_total[key] = (value / currency_ratio + kwh_fees) * VAT spot_hours_total[key] = (value * currency_ratio / 1000 + kwh_fees) * VAT
spot_hours_for_sell[key] = value / currency_ratio - sell_fees 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) spot = Price(hours=spot_hours, now=spot_hours[str(hour)] if is_today else None)