Slice 4 (Fable-Fixes): H4/M1/M2/M3-min/M4/M6 + Doku

H4 – Rundungs-Dust-Reject-Schleife:
- SellLogic.RoundToTick (0.001, AwayFromZero, wie CalculateExactOrderAmounts). Die
  Leiter platziert Preise gerundet -> usdc = size × Preis geht exakt auf (kein Dust).
- ProcessLadderAsync bricht ab, wenn pos.Size < MinShares (Dust-Rest gehalten,
  ExitPending=false), statt endlos Sub-Minimum-Orders zu schicken.

M1 – GlobalPnl-Doppelzaehlung: in beiden Live-Close-Bloecken jetzt NUR innerhalb des
_processedClosures-Dedup-Guards gebucht (API-Lag zaehlte sonst doppelt).
M2 – TokenId in beiden Live-Close-Records gesetzt (sonst greift die Dedup nach Neustart nicht).
M3 (Minimum) – TradeId-Init: serverseitiges GetMaxTradeId() statt Full-Table-Find(_=>true).Max();
  Fehlschlag wird laut geloggt statt still geschluckt. (Autoincrement-Migration bewusst als
  Follow-up aufgeschoben – Schema-Aenderung an der Trade-Persistenz erst im Zielland live verifizieren.)
M4 – MongoExportParser ProfitTarget-Default 50 -> 9999 (Take-Profit bleibt dormant).
M6 – Fee-Satz (real oder Kategorie-Fallback, FeeModel.ResolveBps) in alle signierten Orders:
  Engine-BUY, SELL-Leiter (Start/Step/Floor), PreRedeem (WSS + REST). API-gated, im Zielland verifizieren.
Doku – stale [Description]: ProfitTarget/SellFloorPct als IMPLEMENTIERT markiert.

Tests: +10 (RoundToTick, Dust-Abbruch, ResolveBps). Build 0 Fehler, 233 gruen, --smoke-ui ok.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Richard
2026-07-09 14:03:00 +02:00
co-authored by Claude Opus 4.8
parent 8252219163
commit bdcd3641e4
14 changed files with 148 additions and 22 deletions
+12
View File
@@ -40,5 +40,17 @@ namespace PolyTrader.Tests
{
Assert.Equal(0m, FeeUsd((decimal)notional, bps));
}
// ----- ResolveBps (M6) -----
[Theory]
[InlineData(120, "Sports", 120)] // realer Satz gewinnt
[InlineData(0, "Sports", 75)] // kein realer Satz -> Kategorie-Fallback
[InlineData(0, "Crypto", 180)]
[InlineData(0, null, 100)] // unbekannt -> Default
public void ResolveBps_prefers_actual_then_fallback(int takerFeeBps, string? category, int expected)
{
Assert.Equal(expected, ResolveBps(takerFeeBps, category));
}
}
}