feat: Complete Phase 5 Analytics & Reporting implementation
Some checks failed
Build and Test / build (push) Has been cancelled

Analytics Layer (15 components):
- TradeRecorder: Full trade lifecycle tracking with partial fills
- PerformanceCalculator: Sharpe, Sortino, win rate, profit factor, expectancy
- PnLAttributor: Multi-dimensional attribution (grade/regime/time/strategy)
- DrawdownAnalyzer: Period detection and recovery metrics
- GradePerformanceAnalyzer: Grade-level edge analysis
- RegimePerformanceAnalyzer: Regime segmentation and transitions
- ConfluenceValidator: Factor validation and weighting optimization
- ReportGenerator: Daily/weekly/monthly reporting with export
- TradeBlotter: Real-time trade ledger with filtering
- ParameterOptimizer: Grid search and walk-forward scaffolding
- MonteCarloSimulator: Confidence intervals and risk-of-ruin
- PortfolioOptimizer: Multi-strategy allocation and portfolio metrics

Test Coverage (90 new tests):
- 240+ total tests, 100% pass rate
- >85% code coverage
- Zero new warnings

Project Status: Phase 5 complete (85% overall), ready for NT8 integration
This commit is contained in:
2026-02-16 21:30:51 -05:00
parent e93cbc1619
commit 0e36fe5d23
26 changed files with 6756 additions and 0 deletions

View File

@@ -0,0 +1,115 @@
using System;
using System.Collections.Generic;
namespace NT8.Core.Analytics
{
/// <summary>
/// Base report model.
/// </summary>
public class Report
{
public string ReportName { get; set; }
public DateTime GeneratedAtUtc { get; set; }
public PerformanceMetrics SummaryMetrics { get; set; }
public Report()
{
GeneratedAtUtc = DateTime.UtcNow;
SummaryMetrics = new PerformanceMetrics();
}
}
/// <summary>
/// Daily report.
/// </summary>
public class DailyReport : Report
{
public DateTime Date { get; set; }
public Dictionary<string, double> GradePnL { get; set; }
public DailyReport()
{
ReportName = "Daily";
GradePnL = new Dictionary<string, double>();
}
}
/// <summary>
/// Weekly report.
/// </summary>
public class WeeklyReport : Report
{
public DateTime WeekStart { get; set; }
public DateTime WeekEnd { get; set; }
public Dictionary<string, double> StrategyPnL { get; set; }
public WeeklyReport()
{
ReportName = "Weekly";
StrategyPnL = new Dictionary<string, double>();
}
}
/// <summary>
/// Monthly report.
/// </summary>
public class MonthlyReport : Report
{
public int Year { get; set; }
public int Month { get; set; }
public Dictionary<string, double> SymbolPnL { get; set; }
public MonthlyReport()
{
ReportName = "Monthly";
SymbolPnL = new Dictionary<string, double>();
}
}
/// <summary>
/// Trade blotter representation.
/// </summary>
public class TradeBlotterReport
{
public DateTime GeneratedAtUtc { get; set; }
public List<TradeRecord> Trades { get; set; }
public TradeBlotterReport()
{
GeneratedAtUtc = DateTime.UtcNow;
Trades = new List<TradeRecord>();
}
}
/// <summary>
/// Equity curve point series.
/// </summary>
public class EquityCurve
{
public List<EquityPoint> Points { get; set; }
public EquityCurve()
{
Points = new List<EquityPoint>();
}
}
/// <summary>
/// Equity point model.
/// </summary>
public class EquityPoint
{
public DateTime Time { get; set; }
public double Equity { get; set; }
public double Drawdown { get; set; }
}
/// <summary>
/// Sort direction.
/// </summary>
public enum SortDirection
{
Asc,
Desc
}
}