chore: Improve wrapper thread safety and logging
- Add thread-safe locking to BaseNT8StrategyWrapper - Add BasicLogger initialization - Improve null checking and error handling - Minor adapter enhancements
This commit is contained in:
@@ -8,6 +8,8 @@ namespace NT8.Core.Common.Models
|
||||
/// </summary>
|
||||
public class RiskConfig
|
||||
{
|
||||
// Phase 1 - Basic Risk Properties
|
||||
|
||||
/// <summary>
|
||||
/// Daily loss limit in dollars
|
||||
/// </summary>
|
||||
@@ -28,8 +30,30 @@ namespace NT8.Core.Common.Models
|
||||
/// </summary>
|
||||
public bool EmergencyFlattenEnabled { get; set; }
|
||||
|
||||
// Phase 2 - Advanced Risk Properties (Optional)
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for RiskConfig
|
||||
/// Weekly loss limit in dollars (optional, for advanced risk management)
|
||||
/// </summary>
|
||||
public double? WeeklyLossLimit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Trailing drawdown limit in dollars (optional, for advanced risk management)
|
||||
/// </summary>
|
||||
public double? TrailingDrawdownLimit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Maximum cross-strategy exposure in dollars (optional, for advanced risk management)
|
||||
/// </summary>
|
||||
public double? MaxCrossStrategyExposure { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Maximum correlated exposure in dollars (optional, for advanced risk management)
|
||||
/// </summary>
|
||||
public double? MaxCorrelatedExposure { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for RiskConfig (Phase 1 - backward compatible)
|
||||
/// </summary>
|
||||
public RiskConfig(
|
||||
double dailyLossLimit,
|
||||
@@ -41,6 +65,35 @@ namespace NT8.Core.Common.Models
|
||||
MaxTradeRisk = maxTradeRisk;
|
||||
MaxOpenPositions = maxOpenPositions;
|
||||
EmergencyFlattenEnabled = emergencyFlattenEnabled;
|
||||
|
||||
// Phase 2 properties default to null (not set)
|
||||
WeeklyLossLimit = null;
|
||||
TrailingDrawdownLimit = null;
|
||||
MaxCrossStrategyExposure = null;
|
||||
MaxCorrelatedExposure = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for RiskConfig (Phase 2 - with advanced parameters)
|
||||
/// </summary>
|
||||
public RiskConfig(
|
||||
double dailyLossLimit,
|
||||
double maxTradeRisk,
|
||||
int maxOpenPositions,
|
||||
bool emergencyFlattenEnabled,
|
||||
double? weeklyLossLimit,
|
||||
double? trailingDrawdownLimit,
|
||||
double? maxCrossStrategyExposure,
|
||||
double? maxCorrelatedExposure)
|
||||
{
|
||||
DailyLossLimit = dailyLossLimit;
|
||||
MaxTradeRisk = maxTradeRisk;
|
||||
MaxOpenPositions = maxOpenPositions;
|
||||
EmergencyFlattenEnabled = emergencyFlattenEnabled;
|
||||
WeeklyLossLimit = weeklyLossLimit;
|
||||
TrailingDrawdownLimit = trailingDrawdownLimit;
|
||||
MaxCrossStrategyExposure = maxCrossStrategyExposure;
|
||||
MaxCorrelatedExposure = maxCorrelatedExposure;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user