feat: trade mandate (budget + horizon) wired end-to-end

- database.py: add trade_budget_eur / preferred_horizon_min/max config
  defaults and include them in cycle config migrations
- auto_cycle.py: read trade params from config and inject into cycle_meta
- ai_analyzer.py: inject INVESTOR TRADE MANDATE block into scoring and
  suggestion prompts so GPT-4o penalises horizon mismatches and sizes
  within the capital cap
- Config.tsx: Trade Parameters card with budget + horizon sliders and live
  mandate summary
- TradeIdeas.tsx: horizon filter pills (< 1M / 1-3M / 3-6M / > 6M) and
  budget/horizon indicator pulled from saved config
- useApi.ts: extend useUpdateCycleConfig type with new config fields

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OpenSquared
2026-06-22 17:24:38 +02:00
parent 9b98594c07
commit a68a08d9af
6 changed files with 151 additions and 6 deletions

View File

@@ -255,6 +255,10 @@ def run_cycle_once(trigger: str = "auto") -> Dict[str, Any]:
_market_session = "after_hours"
_market_note = "After-hours US — prix indicatifs, liquidité réduite."
_budget_eur = float(get_config("trade_budget_eur") or "5000")
_horizon_min = int(get_config("preferred_horizon_min") or "30")
_horizon_max = int(get_config("preferred_horizon_max") or "180")
cycle_meta = {
"current_cycle_ts": _now.isoformat(),
"last_cycle_ts": _last_cycle_ts_str,
@@ -265,6 +269,9 @@ def run_cycle_once(trigger: str = "auto") -> Dict[str, Any]:
"is_weekend": _is_weekend,
"market_session": _market_session,
"market_note": _market_note,
"trade_budget_eur": _budget_eur,
"preferred_horizon_min": _horizon_min,
"preferred_horizon_max": _horizon_max,
}
logger.info(
f"[Cycle {run_id[:16]}] Cycle meta: delta={_delta_minutes:.0f}min depuis dernier cycle"