R8: Accounting- + Supervisor-Modul + Core-Datenfundament (S-0)
Portierung der beiden fehlenden Grundbausteine aus PolytraderSharp (voller Ausbau). Core S-0 (Datenfundament fuer Analyse/Forensik): - core_decision_journal + core_order_events (+ ReasonCode/Decision/OrderEvent-Enums), IDecisionJournal/IOrderEventLog mit fehlertoleranten EF-Impls (Handel bricht nie). - SignalId-Durchreichung TradeSignal -> ExecutionService -> core_trade_history; ExecutionService schreibt an jeder Verzweigung Journal/Order-Events. - JSONL-Log-Sink (LogJson + Dual-Sink), pure Analytik: RealizedPnlEngine (FIFO), TradeAnalytics, DossierBuilder. Migration AddAnalysisFoundation. Accounting-Modul (acc_): unabhaengiger IBKR-Kontoauszug (Activity Flex Query) hinter Interfaces mit Offline-Null-Stubs -> append-only Ledger + Periodenabrechnung/BWA + FX (USD/EUR) + CSV/PDF (PDFsharp/MigraDoc). Steuerschicht bewusst offen (Platzhalter-Tab). Kein Handel. Migration InitialAccounting. Supervisor-Modul (sup_): read-only OpenRouter-Agent (Function-Calling-Loop) + read-only Tool-Registry (8 Tools) + Profile + Dossier-Browser + Counterfactual-Job (Stub) + Tagesbericht/MCP-Light (opt-in). Migration InitialSupervisor. Verdrahtung: Program.cs (beide Module + Icons), slnx/App/Tests-Referenzen, provision-db.ps1, AppSettings-Sektionen, docs/konzepte, README. Tests: 79 -> 117 gruen (FIFO/KPIs/Dossier/JSONL, Classifier/Engine/FX/Idempotenz, OpenRouter/Registry/Agent/MCP, STA-Konstruktion beider neuen Fenster). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
cbbedb2e0e
commit
2a312ca035
@@ -0,0 +1,43 @@
|
||||
using FluentAssertions;
|
||||
using IBKRTrader.Core.Logging;
|
||||
|
||||
namespace IBKRTrader.Tests.Logging;
|
||||
|
||||
[Trait("cat", "unit")]
|
||||
public class LogJsonTests
|
||||
{
|
||||
[Fact]
|
||||
public void RoundTrip_PreservesFields()
|
||||
{
|
||||
var ts = new DateTime(2026, 7, 30, 12, 34, 56, DateTimeKind.Utc);
|
||||
var line = LogJson.WriteLine(ts, AppLogLevel.Warn, "CT", "Kurs fehlt für AAPL", "sig-123");
|
||||
|
||||
var parsed = LogJson.ParseLine(line);
|
||||
|
||||
parsed.Should().NotBeNull();
|
||||
parsed!.Ts.Should().Be(ts);
|
||||
parsed.Level.Should().Be("Warn");
|
||||
parsed.Source.Should().Be("CT");
|
||||
parsed.Cid.Should().Be("sig-123");
|
||||
parsed.Message.Should().Be("Kurs fehlt für AAPL");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WriteLine_OmitsCid_WhenNull()
|
||||
{
|
||||
var line = LogJson.WriteLine(DateTime.UtcNow, AppLogLevel.Info, "Core", "hello", null);
|
||||
|
||||
line.Should().NotContain("cid");
|
||||
LogJson.ParseLine(line)!.Cid.Should().BeNull();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("")]
|
||||
[InlineData(" ")]
|
||||
[InlineData("nicht json")]
|
||||
[InlineData("{ kaputt")]
|
||||
public void ParseLine_ReturnsNull_OnGarbage(string input)
|
||||
{
|
||||
LogJson.ParseLine(input).Should().BeNull();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user