Tags: QuantConnect/lean-cli
Tags
Validate configuration values with a regex from the modules json (#663) * feature: validate configuration values with a regex from the modules json Adds an optional "input-regex" and "input-regex-message" to the module configurations, so a module describes the values it accepts instead of the CLI hard coding them. The regex is checked wherever a value enters the CLI: the command line options, the interactive prompts and the values read from the Lean config, which don't go through click and are validated by config_build. In interactive mode an unsupported value read from the Lean config is prompted for again, instead of aborting the deployment. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feature: add the modules json regex to the input type instead of replacing it The regex now wraps the type of the input method, so a path is still converted to a Path, a prompt with an integer input type still converts to an int and the choices are still checked, with the regex on top. It is ignored, with a debug message, for the choice and confirm input methods, whose prompts already describe the values they accept and can never be satisfied by a regex. An empty value isn't validated anymore, it means the user didn't provide one, which config_build reports as a missing option. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G7iy3o91JamKGac8H88FMQ --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Martin Molinero <martin.molinero1@gmail.com>
Fix: don't downgrade map/factor-file provider based only on USA equit… …y data (#653) * fix: don't downgrade map/factor-file provider based only on USA equity data `_handle_data_providers` downgraded the global `map-file-provider` (and `factor-file-provider`) from the Zip provider to the Disk provider based solely on the state of `equity/usa/map_files`. The provider is a single global engine setting and the Disk provider silently ignores `map_files_*.zip` archives, so a futures-only data folder (whose map files ship only inside the zip) had its provider swapped out and continuous futures never mapped (`Mapped: None`) with no error raised. Gate the downgrade on every market's auxiliary folder instead of just `equity/usa`: only fall back to the Disk provider when there is no recent zip to lose for any market. Adds regression tests covering futures-only data, loose-csv-only data, and stale-zip data. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * refactor: use datetime.min sentinel to drop None checks Initialize newest_zip_date to datetime.min so the "no zip found" case naturally falls through the >7-days-old downgrade check, removing both explicit None checks. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * refactor: simplify provider gate, short-circuit on first recent zip, add debug logging - Glob the auxiliary zips directly (*/*/<dir>/*.zip) instead of walking dirs/files. - Return as soon as any market has a zip within the freshness window instead of scanning all markets for the newest date (equivalent decision, fewer iterations). - Hoist datetime.now() out of the loop. - Add debug logs for both outcomes (which provider is used and why). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
feat: add require-user-name support to AuthConfiguration and Auth0 en… …dpoints (#636) * feat: add require-user-name support to AuthConfiguration and Auth0 endpoints Adds optional userId parameter to Auth0 read and authorize flows so brokerages like Charles Schwab can pass a login ID to pre-fill the OAuth authorization page. AuthConfiguration now reads require-user-name from config JSON, prompts the user for their login ID (checking CLI args and lean config first), and threads the value through get_authorization → Auth0Client.read (payload) and Auth0Client.authorize (URL). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: persist user_name to lean_config and add get_user_name unit tests After prompting for login ID, the value is saved to lean_config under the derived key (e.g. charles-schwab-user-name) so subsequent runs skip the prompt. Adds 4 unit tests covering all get_user_name code paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: validate and clear stale account number from lean_config after OAuth When the Auth0 OAuth flow returns a new account list, the previously saved account number in lean.json may no longer be valid. Previously the code would silently use the stale value, causing live trading to be configured with the wrong account. Now, after fetching API account IDs: - If the saved account is no longer in the API response, it is cleared so the user is prompted to select a valid one. - If the API returns multiple accounts (even if the saved value is still valid), it is cleared so the user actively confirms their selection from the current list. - If the API returns exactly one account and it matches the saved value, no prompt is needed. Also adds three unit tests covering stale, ambiguous, and valid cases. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: validate and clear stale account number from lean_config after OAuth Use plain brokerage_id as cache key when user_name is None to preserve original behaviour; use (brokerage_id, user_name) tuple when user_name is provided so different users get isolated cache entries. Adds two cache tests: no-user-name single-call check and per-user-name isolation check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
PreviousNext