Production hardening: kill switch, circuit breaker, trailing stops, log level, holiday calendar
Some checks failed
Build and Test / build (push) Has been cancelled
Some checks failed
Build and Test / build (push) Has been cancelled
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
- [Risk Management](#risk-management)
|
||||
- [Position Sizing](#position-sizing)
|
||||
- [Order Management](#order-management)
|
||||
- [Analytics](#analytics)
|
||||
- [Data Models](#data-models)
|
||||
- [Enumerations](#enumerations)
|
||||
|
||||
@@ -782,6 +783,223 @@ orderManager.UnsubscribeFromOrderUpdates(OnOrderUpdate);
|
||||
|
||||
---
|
||||
|
||||
## Analytics
|
||||
|
||||
### TradeRecorder
|
||||
|
||||
**Namespace:** `NT8.Core.Analytics`
|
||||
|
||||
Records and queries full trade lifecycle data.
|
||||
|
||||
**Key Methods:**
|
||||
|
||||
```csharp
|
||||
public void RecordEntry(string tradeId, StrategyIntent intent, OrderFill fill, ConfluenceScore score, RiskMode mode)
|
||||
public void RecordExit(string tradeId, OrderFill fill)
|
||||
public void RecordPartialFill(string tradeId, OrderFill fill)
|
||||
public TradeRecord GetTrade(string tradeId)
|
||||
public List<TradeRecord> GetTrades(DateTime start, DateTime end)
|
||||
public List<TradeRecord> GetTradesByGrade(TradeGrade grade)
|
||||
public List<TradeRecord> GetTradesByStrategy(string strategyName)
|
||||
public string ExportToCsv(List<TradeRecord> trades)
|
||||
public string ExportToJson(List<TradeRecord> trades)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### PerformanceCalculator
|
||||
|
||||
**Namespace:** `NT8.Core.Analytics`
|
||||
|
||||
Calculates aggregate performance statistics from trade history.
|
||||
|
||||
**Key Methods:**
|
||||
|
||||
```csharp
|
||||
public PerformanceMetrics Calculate(List<TradeRecord> trades)
|
||||
public double CalculateWinRate(List<TradeRecord> trades)
|
||||
public double CalculateProfitFactor(List<TradeRecord> trades)
|
||||
public double CalculateExpectancy(List<TradeRecord> trades)
|
||||
public double CalculateSharpeRatio(List<TradeRecord> trades, double riskFreeRate)
|
||||
public double CalculateSortinoRatio(List<TradeRecord> trades, double riskFreeRate)
|
||||
public double CalculateMaxDrawdown(List<TradeRecord> trades)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### PnLAttributor
|
||||
|
||||
**Namespace:** `NT8.Core.Analytics`
|
||||
|
||||
Builds attribution reports for performance decomposition.
|
||||
|
||||
**Key Methods:**
|
||||
|
||||
```csharp
|
||||
public AttributionReport AttributeByGrade(List<TradeRecord> trades)
|
||||
public AttributionReport AttributeByRegime(List<TradeRecord> trades)
|
||||
public AttributionReport AttributeByStrategy(List<TradeRecord> trades)
|
||||
public AttributionReport AttributeByTimeOfDay(List<TradeRecord> trades)
|
||||
public AttributionReport AttributeMultiDimensional(List<TradeRecord> trades, List<AttributionDimension> dimensions)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### DrawdownAnalyzer
|
||||
|
||||
**Namespace:** `NT8.Core.Analytics`
|
||||
|
||||
Tracks equity drawdowns and recovery behavior.
|
||||
|
||||
**Key Methods:**
|
||||
|
||||
```csharp
|
||||
public DrawdownReport Analyze(List<TradeRecord> trades)
|
||||
public List<DrawdownPeriod> IdentifyDrawdowns(List<TradeRecord> trades)
|
||||
public DrawdownAttribution AttributeDrawdown(DrawdownPeriod period)
|
||||
public double CalculateRecoveryTime(DrawdownPeriod period)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### GradePerformanceAnalyzer
|
||||
|
||||
**Namespace:** `NT8.Core.Analytics`
|
||||
|
||||
Analyzes edge and expectancy by grade.
|
||||
|
||||
**Key Methods:**
|
||||
|
||||
```csharp
|
||||
public GradePerformanceReport AnalyzeByGrade(List<TradeRecord> trades)
|
||||
public double CalculateGradeAccuracy(TradeGrade grade, List<TradeRecord> trades)
|
||||
public TradeGrade FindOptimalThreshold(List<TradeRecord> trades)
|
||||
public Dictionary<TradeGrade, PerformanceMetrics> GetMetricsByGrade(List<TradeRecord> trades)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### RegimePerformanceAnalyzer
|
||||
|
||||
**Namespace:** `NT8.Core.Analytics`
|
||||
|
||||
Evaluates strategy behavior by volatility/trend regime and transitions.
|
||||
|
||||
**Key Methods:**
|
||||
|
||||
```csharp
|
||||
public RegimePerformanceReport AnalyzeByRegime(List<TradeRecord> trades)
|
||||
public PerformanceMetrics GetPerformance(VolatilityRegime volRegime, TrendRegime trendRegime, List<TradeRecord> trades)
|
||||
public List<RegimeTransitionImpact> AnalyzeTransitions(List<TradeRecord> trades)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### ConfluenceValidator
|
||||
|
||||
**Namespace:** `NT8.Core.Analytics`
|
||||
|
||||
Validates confluence factor quality and suggested weighting.
|
||||
|
||||
**Key Methods:**
|
||||
|
||||
```csharp
|
||||
public FactorAnalysisReport AnalyzeFactor(FactorType factor, List<TradeRecord> trades)
|
||||
public Dictionary<FactorType, double> CalculateFactorImportance(List<TradeRecord> trades)
|
||||
public Dictionary<FactorType, double> RecommendWeights(List<TradeRecord> trades)
|
||||
public bool ValidateScore(ConfluenceScore score, TradeOutcome outcome)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### ReportGenerator
|
||||
|
||||
**Namespace:** `NT8.Core.Analytics`
|
||||
|
||||
Generates periodic performance reports and export content.
|
||||
|
||||
**Key Methods:**
|
||||
|
||||
```csharp
|
||||
public DailyReport GenerateDailyReport(DateTime date, List<TradeRecord> trades)
|
||||
public WeeklyReport GenerateWeeklyReport(DateTime weekStart, List<TradeRecord> trades)
|
||||
public MonthlyReport GenerateMonthlyReport(DateTime monthStart, List<TradeRecord> trades)
|
||||
public EquityCurve BuildEquityCurve(List<TradeRecord> trades)
|
||||
public string ExportToText(Report report)
|
||||
public string ExportToCsv(List<TradeRecord> trades)
|
||||
public string ExportToJson(Report report)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### TradeBlotter
|
||||
|
||||
**Namespace:** `NT8.Core.Analytics`
|
||||
|
||||
Provides in-memory filtering, sorting, and query operations over trades.
|
||||
|
||||
**Key Methods:**
|
||||
|
||||
```csharp
|
||||
public void SetTrades(List<TradeRecord> trades)
|
||||
public void AddOrUpdateTrade(TradeRecord trade)
|
||||
public List<TradeRecord> FilterByDate(DateTime start, DateTime end)
|
||||
public List<TradeRecord> FilterBySymbol(string symbol)
|
||||
public List<TradeRecord> FilterByGrade(TradeGrade grade)
|
||||
public List<TradeRecord> FilterByPnL(double minPnL, double maxPnL)
|
||||
public List<TradeRecord> SortBy(string column, SortDirection direction)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### ParameterOptimizer
|
||||
|
||||
**Namespace:** `NT8.Core.Analytics`
|
||||
|
||||
Performs sensitivity analysis and optimization scaffolding.
|
||||
|
||||
**Key Methods:**
|
||||
|
||||
```csharp
|
||||
public OptimizationResult OptimizeParameter(string paramName, List<double> values, List<TradeRecord> trades)
|
||||
public GridSearchResult GridSearch(Dictionary<string, List<double>> parameters, List<TradeRecord> trades)
|
||||
public WalkForwardResult WalkForwardTest(StrategyConfig config, List<BarData> historicalData)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### MonteCarloSimulator
|
||||
|
||||
**Namespace:** `NT8.Core.Analytics`
|
||||
|
||||
Runs simulation-based distribution and risk-of-ruin analysis.
|
||||
|
||||
**Key Methods:**
|
||||
|
||||
```csharp
|
||||
public MonteCarloResult Simulate(List<TradeRecord> historicalTrades, int numSimulations, int numTrades)
|
||||
public double CalculateRiskOfRuin(List<TradeRecord> trades, double drawdownThreshold)
|
||||
public ConfidenceInterval CalculateConfidenceInterval(MonteCarloResult result, double confidenceLevel)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### PortfolioOptimizer
|
||||
|
||||
**Namespace:** `NT8.Core.Analytics`
|
||||
|
||||
Calculates portfolio allocations and Sharpe-oriented mixes.
|
||||
|
||||
**Key Methods:**
|
||||
|
||||
```csharp
|
||||
public AllocationResult OptimizeAllocation(List<StrategyPerformance> strategies)
|
||||
public double CalculatePortfolioSharpe(Dictionary<string, double> allocation, List<StrategyPerformance> strategies)
|
||||
public Dictionary<string, double> RiskParityAllocation(List<StrategyPerformance> strategies)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Data Models
|
||||
|
||||
### StrategyIntent
|
||||
|
||||
Reference in New Issue
Block a user