Slice 6 (Fable-Fixes): Totcode/Demo-Balance/Settings-Validierung + Plan-Abschluss

- Totcode: services/SnapshotService.cs entfernt (nirgends registriert).
- Demo-Balance/PnL-Reconciliation: Demo-BUY zieht jetzt die Entry-Fee ab, Demo-Close
  schreibt netto (exitUsd - Exit-Fee) gut -> Summe(Balance-Aenderungen) = Summe(PnL)
  statt um die Fees zu driften (Demo als Validierung konsistent).
- Settings-Validierung: SellLogic.IsLadderConfigInverted (Max-Preisabstand >= SELL-Floor
  -> Leiter startet am Floor) + Warnung beim Settings-Laden (StartupHydration).

Bewusst als Follow-up dokumentiert (Live-Verifikation/Risiko): M3-Autoincrement-Migration,
PersistenceService-Dedup-Zeitfenster, Perf (UpsertLive-Dirty-Check, Leiter-Parallelitaet).

Tests: +3 (IsLadderConfigInverted). Build 0 Fehler, 236 gruen, --smoke-ui ok.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Richard
2026-07-09 18:45:52 +02:00
co-authored by Claude Opus 4.8
parent 84b2b276d9
commit 782c08a860
6 changed files with 50 additions and 158 deletions
+5
View File
@@ -4,6 +4,7 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using PolyTrader.Core.Persistence;
using PolyTrader.Modules.CopyTrading.Logic;
using PolyTrader.Modules.CopyTrading.Persistence;
using PolyTraderSharp.Models;
@@ -92,6 +93,10 @@ namespace PolyTraderSharp.Services
if (existing.TryGetValue(acc.AccountId, out var s))
{
_copyState.AccountSettings[acc.AccountId] = s;
// Konfig-Plausibilität: BUY-Preisabstand ≥ SELL-Floor → Leiter startet am Floor.
if (SellLogic.IsLadderConfigInverted(s.MaxPriceDifference, s.SellFloorPct))
_logger.Warning($"⚠️ [Settings] {acc.Name}: Max. Preisabstand ({s.MaxPriceDifference:F1}%) ≥ SELL-Floor " +
$"({s.SellFloorPct:F1}%) die SELL-Leiter startet direkt am Floor (keine echte Eskalation). Floor erhöhen oder Abstand senken.");
continue;
}