Repository navigation
Wait out a brokerage disconnection when the algorithm has only custom data - #10261
Closed
quantconnect-kronos[bot] wants to merge 1 commit into
Closed
quantconnect-kronos[bot] wants to merge 1 commit into
quantconnect-kronos[bot] wants to merge 1 commit into
Conversation
DefaultBrokerageMessageHandler looked for the next market open among the securities that aren't custom data and took the minimum of an empty sequence when there were none, so it threw and never started the wait that stops an algorithm still disconnected. It now falls back to an hour from now, as it already did for an algorithm without securities. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Author
|
Closing: as decided in QuantConnect/Lean.Brokerages.Tradier#68, the Tradier change doesn't take a Lean change. The bug is tracked in #10262 for Lean's maintainers to decide. |
quantconnect-kronos
Bot
deleted the
kronos/bug-67-outage-disconnect-grace-period
branch
November 27, 2026 19:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DefaultBrokerageMessageHandlernow waits out a disconnection, then stops the algorithm if it's still disconnected, when the algorithm has only custom data securities.Part of QuantConnect/Lean.Brokerages.Tradier#68, which reports a Tradier outage as a disconnection that Lean waits out instead of stopping the algorithm at once.
What changed
SecurityType.Base). When every security was custom data, it tookMin()of an empty sequence, soHandleMessagethrewInvalidOperationException: Sequence contains no elementsand never started the wait. A brokerage that reports a disconnection only once, until it reconnects, never stopped that algorithm while still disconnected.Tests
DefaultBrokerageMessageHandlerTests.SetsAlgorithmRunTimeErrorOnPersistentDisconnectWithOnlyCustomData: an algorithm with only custom data stays disconnected, and the handler sets the runtime error once the wait is over. It fails without the fix (Sequence contains no elements) and passes with it. It takes about a minute because the handler checks once a minute.TestCategory!=TravisExclude&TestCategory!=ResearchRegressionTests): 40049 passed, 0 failed, 112 skipped.