Reject IB weekly restart times later than 23:30 UTC - #663
Open
AlexCatarino wants to merge 1 commit into
Open
Conversation
Interactive Brokers doesn't support weekly restart times later than 23:30 UTC, but the CLI happily accepted any value and only failed once the deployment reached the brokerage. Add a TimeParameter click type enforcing the hh:mm:ss format and an optional upper bound, and bind it to ib-weekly-restart-utc-time. It covers the command line option, the interactive prompt and the values read from an existing Lean config, which don't go through click. Input without seconds is accepted as well, but the value is always normalized to hh:mm:ss, the format the API expects. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
AlexCatarino
force-pushed
the
feature-ib-weekly-restart-time-validation
branch
from
August 14, 2026 22:52
390c81a to
ac5f578
Compare
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.
Description
Interactive Brokers doesn't support weekly restart times later than 23:30 UTC, but
--ib-weekly-restart-utc-timeaccepted any string. An invalid value was only rejected once the deployment reached the brokerage, after the project was compiled and the API call was made.This adds a
TimeParameterclick type that enforces thehh:mm:ssformat and an optional upper bound, bound toib-weekly-restart-utc-timethrough a newmap_id_to_typesonPromptUserInput. The constraint lives in Python rather than in the modules json because that file is re-downloaded from the CDN daily, so an edit there wouldn't survive.It covers the three ways a value reaches the config:
Configuration.validate()called fromJsonModule.config_build()Input without seconds is accepted too, but the value is always normalized to
hh:mm:ss, which is what the API schema documents.Related Issue
N/A
Motivation and Context
Fail fast and locally with a clear message, instead of after a compile and a round trip, and keep a hand-edited
lean.jsonfrom carrying an unsupported value into a deployment.Requires Documentation Change
No.
How Has This Been Tested?
TimeParameterintests/test_click.py, covering normalization, malformed input and the upper bound.23:30:01/23:50:00/23:50/invalid, and that both21:00and21:00:00reachapi_client.live.startas21:00:00.lean.jsonaborts before the runner is called.tests/commands/test_live.py,tests/test_click.py,tests/modelsandtests/commands/cloud/liveall pass.Types of changes
Checklist:
🤖 Generated with Claude Code