fix: trade_budget_eur + preferred_horizon saved and reloaded in Config

Backend:
- CycleConfigRequest: add trade_budget_eur, preferred_horizon_min/max fields
  (were missing — Pydantic silently dropped them, so saves never reached set_config)
- update_cycle_config: handle + persist the 3 new fields via set_config
- get_status(): read + return trade_budget_eur/preferred_horizon_min/max from DB
  (were missing — frontend always fell back to React default values on page load)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OpenSquared
2026-06-22 20:25:31 +02:00
parent 6cca7f66b6
commit 198341b0c2
2 changed files with 22 additions and 0 deletions

View File

@@ -1956,9 +1956,13 @@ def get_status() -> Dict[str, Any]:
min_score = int(get_config("min_score_threshold") or "0")
retention_days = int(get_config("journal_retention_days") or "90")
maturity_pct = int(get_config("maturity_threshold_pct") or "35")
trade_budget_eur = float(get_config("trade_budget_eur") or "5000")
preferred_horizon_min = int(get_config("preferred_horizon_min") or "30")
preferred_horizon_max = int(get_config("preferred_horizon_max") or "180")
except Exception:
interval_hours, enabled, sim_threshold, min_ev, min_score = 3.0, False, 0.30, 0.0, 0
retention_days, maturity_pct = 90, 35
trade_budget_eur, preferred_horizon_min, preferred_horizon_max = 5000.0, 30, 180
recent = get_cycle_runs(limit=1)
last = recent[0] if recent else None
@@ -1997,6 +2001,9 @@ def get_status() -> Dict[str, Any]:
"min_score_threshold": min_score,
"journal_retention_days": retention_days,
"maturity_threshold_pct": maturity_pct,
"trade_budget_eur": trade_budget_eur,
"preferred_horizon_min": preferred_horizon_min,
"preferred_horizon_max": preferred_horizon_max,
"weekend_cycle_enabled": weekend_enabled,
"weekend_cycle_times": weekend_cycle_times,
"last_cycle": last,