a dalsi pokus o opravu
Some checks failed
CI and deploy / migration-check (push) Failing after 19s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-05-30 22:15:40 +02:00
parent 96d0d52b07
commit 4f67aad4d8
4 changed files with 67 additions and 98 deletions

View File

@@ -2796,45 +2796,12 @@ class ChargeAcquisitionArbitrageTests(unittest.TestCase):
self.assertLessEqual(len(push), 4)
self.assertEqual(push, [0, 1, 2, 3][: len(push)])
def test_home01_evening_no_push_when_sell_below_buy(self) -> None:
"""v46: OTE večer sell<buy — žádný push (ne vývoz za 3 Kč při buy 5 Kč)."""
prague = ZoneInfo("Europe/Prague")
base = datetime(2026, 5, 30, 20, 0, tzinfo=prague)
slots = [
PlanningSlot(
interval_start=base + timedelta(minutes=15 * i),
buy_price=5.5,
sell_price=3.3 - 0.05 * i,
pv_a_forecast_w=0,
pv_b_forecast_w=0,
load_baseline_w=1400,
ev1_connected=False,
ev2_connected=False,
allow_discharge_export=True,
charge_acquisition_buy_czk_kwh=0.61,
)
for i in range(4)
]
battery = _battery(uc_wh=64_000.0, terminal_soc_value_factor=0.0)
per_slot = min(18_000, 13_500) * 0.95 * 0.25
push = _evening_battery_export_push_indices(
slots,
charge_acquisition_czk_kwh=0.61,
degrad_czk_kwh=0.15,
current_soc_wh=0.55 * battery.soc_max_wh,
min_soc_wh=battery.min_soc_wh,
soc_max_wh=battery.soc_max_wh,
per_slot_discharge_wh=per_slot,
discharge_slot_buffer=1.5,
spot_push_sell_ge_buy=True,
)
self.assertEqual(push, [])
def test_spot_evening_push_requires_sell_ge_buy(self) -> None:
"""v46: spot nepush když sell < buy (3 Kč vývoz / 5 Kč nákup)."""
base = datetime(2026, 5, 30, 20, 0, tzinfo=ZoneInfo("Europe/Prague"))
bad = PlanningSlot(
interval_start=base.astimezone(timezone.utc),
def test_evening_push_ok_when_sell_below_buy_vs_acq(self) -> None:
"""v47: večer sell<buy ale >acq — push pro vyprázdnění před neg dnem."""
slot = PlanningSlot(
interval_start=datetime(
2026, 5, 30, 20, 0, tzinfo=ZoneInfo("Europe/Prague")
).astimezone(timezone.utc),
buy_price=5.5,
sell_price=3.3,
pv_a_forecast_w=0,
@@ -2844,39 +2811,9 @@ class ChargeAcquisitionArbitrageTests(unittest.TestCase):
ev2_connected=False,
allow_discharge_export=True,
)
ok = PlanningSlot(
interval_start=base.astimezone(timezone.utc),
buy_price=2.0,
sell_price=4.0,
pv_a_forecast_w=0,
pv_b_forecast_w=0,
load_baseline_w=1400,
ev1_connected=False,
ev2_connected=False,
allow_discharge_export=True,
)
self.assertFalse(
_slot_evening_push_profitable(
bad,
charge_acquisition_czk_kwh=0.61,
min_spread=0.15,
spot_push_sell_ge_buy=True,
)
)
self.assertTrue(
_slot_evening_push_profitable(
ok,
charge_acquisition_czk_kwh=0.61,
min_spread=0.15,
spot_push_sell_ge_buy=True,
)
)
self.assertTrue(
_slot_evening_push_profitable(
bad,
charge_acquisition_czk_kwh=0.61,
min_spread=0.15,
spot_push_sell_ge_buy=False,
slot, charge_acquisition_czk_kwh=0.61, min_spread=0.15
)
)