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:
co-authored by
Claude Opus 4.8
parent
55050a19e5
commit
f8d395b2a3
@@ -0,0 +1,39 @@
|
||||
using System.Collections.Concurrent;
|
||||
using PolyTraderSharp.Models;
|
||||
|
||||
namespace PolyTraderSharp
|
||||
{
|
||||
public enum TradingMode
|
||||
{
|
||||
Inactive,
|
||||
SellOnly,
|
||||
Active
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// In-Memory Hot-Path State (Core-Teil).
|
||||
/// Enthält den modulübergreifenden Zustand: eigene Accounts, globale Betriebsschalter,
|
||||
/// Markt-Cache und Gesamt-PnL. Copytrading-spezifischer Zustand liegt im CopyTradingState
|
||||
/// (siehe PolyTrader.Modules.CopyTrading).
|
||||
/// </summary>
|
||||
public class TradingState
|
||||
{
|
||||
// Globale Betriebsschalter
|
||||
public bool GlobalTradingPaused { get; set; } = false;
|
||||
public TradingMode LiveTradingMode { get; set; } = TradingMode.Inactive;
|
||||
public TradingMode DemoTradingMode { get; set; } = TradingMode.Inactive;
|
||||
public bool IsAlchemyHealthy { get; set; } = false;
|
||||
public bool EnableBlockchainParser { get; set; } = true;
|
||||
public bool DebugPollingLog { get; set; } = false;
|
||||
public bool DebugOrderPayloadLog { get; set; } = false;
|
||||
|
||||
// Eigene Trading-Accounts (AccountId -> State)
|
||||
public ConcurrentDictionary<int, AccountState> Accounts { get; } = new();
|
||||
|
||||
// Aggregierte PnL über alle Module (Dashboard/Overview)
|
||||
public decimal GlobalPnl { get; set; } = 0.0m;
|
||||
|
||||
// High-Performance globaler Markt-Cache, verhindert DB-Flaschenhälse im Signalpfad.
|
||||
public ConcurrentDictionary<string, MarketData> MarketCache { get; } = new(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user