using System; namespace NT8.Core.Execution { /// /// Decision result for order routing /// public class RoutingDecision { /// /// Order ID being routed /// public string OrderId { get; set; } /// /// Venue to route the order to /// public string RoutingVenue { get; set; } /// /// Routing strategy used /// public RoutingStrategy Strategy { get; set; } /// /// Confidence level in the routing decision (0-100) /// public int Confidence { get; set; } /// /// Expected execution quality /// public ExecutionQuality ExpectedQuality { get; set; } /// /// Expected latency in milliseconds /// public int ExpectedLatencyMs { get; set; } /// /// Whether the routing decision is valid /// public bool IsValid { get; set; } /// /// Reason for the routing decision /// public string Reason { get; set; } /// /// Constructor for RoutingDecision /// /// Order ID /// Venue to route to /// Routing strategy /// Confidence level /// Expected quality /// Expected latency in ms /// Whether decision is valid /// Reason for decision public RoutingDecision( string orderId, string routingVenue, RoutingStrategy strategy, int confidence, ExecutionQuality expectedQuality, int expectedLatencyMs, bool isValid, string reason) { if (string.IsNullOrEmpty(orderId)) throw new ArgumentNullException("orderId"); OrderId = orderId; RoutingVenue = routingVenue; Strategy = strategy; Confidence = confidence; ExpectedQuality = expectedQuality; ExpectedLatencyMs = expectedLatencyMs; IsValid = isValid; Reason = reason; } } /// /// Information for checking duplicate orders /// public class OrderDuplicateCheck { /// /// Order ID to check /// public string OrderId { get; set; } /// /// Symbol of the order /// public string Symbol { get; set; } /// /// Side of the order /// public OMS.OrderSide Side { get; set; } /// /// Quantity of the order /// public int Quantity { get; set; } /// /// Time when the order intent was created /// public DateTime IntentTime { get; set; } /// /// Whether this is a duplicate order /// public bool IsDuplicate { get; set; } /// /// Time window for duplicate checking /// public TimeSpan DuplicateWindow { get; set; } /// /// Constructor for OrderDuplicateCheck /// /// Order ID /// Symbol /// Order side /// Quantity /// Intent time /// Duplicate window public OrderDuplicateCheck( string orderId, string symbol, OMS.OrderSide side, int quantity, DateTime intentTime, TimeSpan duplicateWindow) { if (string.IsNullOrEmpty(orderId)) throw new ArgumentNullException("orderId"); if (string.IsNullOrEmpty(symbol)) throw new ArgumentNullException("symbol"); OrderId = orderId; Symbol = symbol; Side = side; Quantity = quantity; IntentTime = intentTime; DuplicateWindow = duplicateWindow; } } /// /// Current state of circuit breaker /// public class CircuitBreakerState { /// /// Whether the circuit breaker is active /// public bool IsActive { get; set; } /// /// Current state of the circuit breaker /// public CircuitBreakerStatus Status { get; set; } /// /// Reason for the current state /// public string Reason { get; set; } /// /// Time when the state was last updated /// public DateTime LastUpdateTime { get; set; } /// /// Time when the circuit breaker will reset (if applicable) /// public DateTime? ResetTime { get; set; } /// /// Number of violations that triggered the state /// public int ViolationCount { get; set; } /// /// Constructor for CircuitBreakerState /// /// Whether active /// Current status /// Reason for state /// Violation count public CircuitBreakerState( bool isActive, CircuitBreakerStatus status, string reason, int violationCount) { IsActive = isActive; Status = status; Reason = reason; ViolationCount = violationCount; LastUpdateTime = DateTime.UtcNow; } } /// /// Routing strategy enumeration /// public enum RoutingStrategy { /// /// Direct routing to primary venue /// Direct = 0, /// /// Smart routing based on market conditions /// Smart = 1, /// /// Fallback to alternative venue /// Fallback = 2 } /// /// Circuit breaker status enumeration /// public enum CircuitBreakerStatus { /// /// Normal operation /// Closed = 0, /// /// Circuit breaker activated /// Open = 1, /// /// Testing if conditions have improved /// HalfOpen = 2 } }