dalsi fix home-01
Some checks failed
CI and deploy / migration-check (push) Failing after 26s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-05-24 23:19:54 +02:00
parent 8bef1c6da6
commit b844a9182f
5 changed files with 27 additions and 3 deletions

View File

@@ -129,10 +129,12 @@ def _apply_dynamic_grid_filter(
if not remaining:
break
total_wh = len(remaining) * per_slot_wh
if total_wh <= 0:
acq = min(float(s.buy_price) for s in slots)
pos_remaining = [t for t in remaining if float(slots[t].buy_price) >= 0]
total_wh_pos = len(pos_remaining) * per_slot_wh
if total_wh_pos <= 0:
acq = min(float(s.buy_price) for s in slots if float(s.buy_price) >= 0)
else:
acq = sum(float(slots[t].buy_price) * per_slot_wh for t in remaining) / total_wh
acq = sum(float(slots[t].buy_price) * per_slot_wh for t in pos_remaining) / total_wh_pos
if abs(acq - acq_prev) < 0.05:
break
acq_prev = acq