Phase 5.2: TradingState-Split (Core-State vs. CopyTradingState)

- Core TradingState (in Core): globale Schalter, Accounts, MarketCache, GlobalPnl.
- Neuer CopyTradingState (im Modul): Traders, MasterTraderPositions,
  TraderAnalyticsCache, TotalCopyTrades/GetNextTradeId, PendingOrderTimestamps,
  SixSharesMinimum.
- 10 Konsumenten umgestellt (Program, frm_main, CopyTradingEngine,
  TraderMonitor, Alchemy, WSS, Snapshot, StartupHydration, beide Analytics-Jobs):
  Modul-Felder von _state.* auf _copyState.* umgeleitet, CopyTradingState via DI.
- Rein mechanische Feld-Umleitung, keine Logikänderung. Build 0 Fehler.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Richard
2026-07-01 20:09:50 +02:00
co-authored by Claude Opus 4.8
parent 55050a19e5
commit f8d395b2a3
13 changed files with 174 additions and 127 deletions
+4 -3
View File
@@ -37,6 +37,7 @@ internal static class Program
services.AddCorePersistence();
services.AddSingleton((IServiceProvider sp) => ServerSettings.Load("server_settings.xml"));
services.AddSingleton<TradingState>();
services.AddSingleton<CopyTradingState>();
services.AddSingleton(copySignalChannel.Writer);
services.AddSingleton(copySignalChannel.Reader);
services.AddSingleton(closedTradeChannel.Writer);
@@ -102,16 +103,16 @@ internal static class Program
}
catch { }
var state = AppHost.Services.GetRequiredService<TradingState>();
var copyState = AppHost.Services.GetRequiredService<CopyTradingState>();
var maxTradeDoc = db.GetCollection<MongoDB.Bson.BsonDocument>("closed_trades")
.Find(Builders<MongoDB.Bson.BsonDocument>.Filter.Empty)
.SortByDescending(d => d["_id"])
.Limit(1)
.FirstOrDefault();
if (maxTradeDoc != null && maxTradeDoc.Contains("_id"))
{
state.TotalCopyTrades = maxTradeDoc["_id"].AsInt32;
copyState.TotalCopyTrades = maxTradeDoc["_id"].AsInt32;
}
}
catch { }