From 7a4fb2ddc15d1afd519d4a7a0ab1306c33f3f8bc Mon Sep 17 00:00:00 2001 From: Martin-Molinero Date: Fri, 19 Jun 2026 20:34:51 +0000 Subject: [PATCH] Cache cross-zero unsupported-order-type set in brokerage models TastytradeBrokerageModel and TradeStationBrokerageModel declared NotSupportedCrossZeroOrderTypes as an expression-bodied property, allocating a new constant HashSet on every CanSubmitOrder call (used per order in BrokerageExtensions.ValidateCrossZeroOrder). Make it a static readonly field, built once, matching the existing BrokerageExtensions.DefaultNotSupportedCrossZeroOrderTypes pattern. Set contents are unchanged, so cross-zero validation behavior is identical. Co-Authored-By: Claude Opus 4.8 (1M context) --- Common/Brokerages/TastytradeBrokerageModel.cs | 2 +- Common/Brokerages/TradeStationBrokerageModel.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/Brokerages/TastytradeBrokerageModel.cs b/Common/Brokerages/TastytradeBrokerageModel.cs index cd81bc786d52..8671a9d11e92 100644 --- a/Common/Brokerages/TastytradeBrokerageModel.cs +++ b/Common/Brokerages/TastytradeBrokerageModel.cs @@ -55,7 +55,7 @@ public class TastytradeBrokerageModel : DefaultBrokerageModel /// /// The set of values that cannot be used for cross-zero execution. /// - private static IReadOnlySet NotSupportedCrossZeroOrderTypes => new HashSet() + private static readonly IReadOnlySet NotSupportedCrossZeroOrderTypes = new HashSet() { OrderType.ComboLimit }; diff --git a/Common/Brokerages/TradeStationBrokerageModel.cs b/Common/Brokerages/TradeStationBrokerageModel.cs index 30309319b0d9..51e4fe5139e4 100644 --- a/Common/Brokerages/TradeStationBrokerageModel.cs +++ b/Common/Brokerages/TradeStationBrokerageModel.cs @@ -75,7 +75,7 @@ public class TradeStationBrokerageModel : DefaultBrokerageModel /// /// The set of values that cannot be used for cross-zero execution. /// - private static IReadOnlySet NotSupportedCrossZeroOrderTypes => new HashSet() + private static readonly IReadOnlySet NotSupportedCrossZeroOrderTypes = new HashSet() { OrderType.ComboMarket, OrderType.ComboLimit,