Skip to content

Cache cross-zero unsupported-order-type set in brokerage models#9551

Merged
Martin-Molinero merged 1 commit into
masterfrom
perf/brokerage-crosszero-set-cached
Jun 19, 2026
Merged

Cache cross-zero unsupported-order-type set in brokerage models#9551
Martin-Molinero merged 1 commit into
masterfrom
perf/brokerage-crosszero-set-cached

Conversation

@Martin-Molinero

Copy link
Copy Markdown
Member

Summary

TastytradeBrokerageModel and TradeStationBrokerageModel declared NotSupportedCrossZeroOrderTypes as an expression-bodied property (=> new HashSet<OrderType>(){...}), so a new constant set was allocated on every CanSubmitOrder call (each is used in BrokerageExtensions.ValidateCrossZeroOrder per order). Changed to a static readonly field, built once.

This matches the pattern already used in the same module — BrokerageExtensions.DefaultNotSupportedCrossZeroOrderTypes is a static readonly field.

Correctness

The set contents are identical (fixed OrderType values), so cross-zero order validation behavior is unchanged — this only removes the per-call allocation.

🤖 Generated with Claude Code

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) <noreply@anthropic.com>
@Martin-Molinero Martin-Molinero marked this pull request as ready for review June 19, 2026 20:37
@Martin-Molinero Martin-Molinero merged commit c24860a into master Jun 19, 2026
5 of 8 checks passed
@Martin-Molinero Martin-Molinero deleted the perf/brokerage-crosszero-set-cached branch June 19, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant