-
Notifications
You must be signed in to change notification settings - Fork 0
fix: harden IBKR strategy switch contract #199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -407,6 +407,31 @@ jobs: | |
| print(f"- `{assignment['name']}` = `{assignment['value']}`") | ||
| PY | ||
|
|
||
| - name: Preflight IBKR deployment plan | ||
| if: env.PLATFORM == 'ibkr' && env.SERVICE_TARGETS_MODE != 'off' | ||
| env: | ||
| TARGET_REPOSITORY: ${{ steps.platform.outputs.repository }} | ||
| run: | | ||
| set -euo pipefail | ||
| platform_root="${RUNNER_TEMP}/interactive-brokers-platform" | ||
| repository_variables_file="${RUNNER_TEMP}/ibkr-repository-variables.json" | ||
| trap 'rm -f "${repository_variables_file}"' EXIT | ||
|
|
||
| gh auth setup-git | ||
| git clone --quiet --depth 1 --branch main \ | ||
| "https://github.com/${TARGET_REPOSITORY}.git" \ | ||
| "${platform_root}" | ||
| python3 -m pip install --quiet uv | ||
| uv sync --frozen --no-dev --quiet --project "${platform_root}" | ||
| gh variable list \ | ||
| --repo "${TARGET_REPOSITORY}" \ | ||
| --json name,value \ | ||
| > "${repository_variables_file}" | ||
|
Comment on lines
+426
to
+429
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When an IBKR switch uses the supported Useful? React with 👍 / 👎. |
||
| python3 python/scripts/preflight_ibkr_switch.py \ | ||
| --target-file "${TARGET_FILE}" \ | ||
| --platform-root "${platform_root}" \ | ||
| --repository-variables-file "${repository_variables_file}" | ||
|
|
||
| - name: Apply GitHub variable updates | ||
| if: env.APPLY_SWITCH == 'true' | ||
| run: python3 python/scripts/runtime_settings.py apply "${TARGET_FILE}" --yes | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,27 +62,27 @@ | |
| "profiles": { | ||
| "us_daily": { | ||
| "timezone": "America/New_York", | ||
| "main_time": "45 15 * * *", | ||
| "probe_time": "35 9,15 * * *", | ||
| "precheck_time": "45 9 * * *" | ||
| "main_time": "45 15 * * 1-5", | ||
| "probe_time": "35 9,15 * * 1-5", | ||
| "precheck_time": "45 9 * * 1-5" | ||
| }, | ||
| "us_dca_month_end": { | ||
| "timezone": "America/New_York", | ||
| "main_time": "45 15 25-29 * *", | ||
| "probe_time": "35 9,15 25-29 * *", | ||
| "precheck_time": "45 9 25-29 * *" | ||
| "main_time": "45 15 * * 1-5", | ||
| "probe_time": "35 9,15 * * 1-5", | ||
| "precheck_time": "45 9 * * 1-5" | ||
| }, | ||
| "us_snapshot_month_start": { | ||
| "timezone": "America/New_York", | ||
| "main_time": "45 15 1-7 * *", | ||
| "probe_time": "35 9,15 1-7 * *", | ||
| "precheck_time": "45 9 1-7 * *" | ||
| "main_time": "45 15 * * 1-5", | ||
| "probe_time": "35 9,15 * * 1-5", | ||
| "precheck_time": "45 9 * * 1-5" | ||
| }, | ||
| "hk_daily": { | ||
| "timezone": "Asia/Hong_Kong", | ||
| "main_time": "45 15 * * *", | ||
| "probe_time": "35 9,15 * * *", | ||
| "precheck_time": "45 9 * * *" | ||
| "main_time": "45 15 * * 1-5", | ||
| "probe_time": "35 9,15 * * 1-5", | ||
| "precheck_time": "45 9 * * 1-5" | ||
| }, | ||
| "hk_snapshot_month_start": { | ||
| "timezone": "Asia/Hong_Kong", | ||
|
|
@@ -501,6 +501,13 @@ | |
| "dry_run" | ||
| ], | ||
| "blocked_live_reason": "", | ||
| "runtime_artifacts": { | ||
| "feature_snapshot": { | ||
| "required": true, | ||
| "path": "gs://qsl-runtime-logs-shared/strategy-artifacts/us_equity/global_etf_rotation/global_etf_rotation_feature_snapshot_latest.csv", | ||
| "manifest_path": "gs://qsl-runtime-logs-shared/strategy-artifacts/us_equity/global_etf_rotation/global_etf_rotation_feature_snapshot_latest.csv.manifest.json" | ||
| } | ||
| }, | ||
| "features": { | ||
| "income_layer": true, | ||
| "option_overlay": true, | ||
|
|
@@ -541,6 +548,13 @@ | |
| "dry_run" | ||
| ], | ||
| "blocked_live_reason": "", | ||
| "runtime_artifacts": { | ||
| "feature_snapshot": { | ||
| "required": true, | ||
| "path": "gs://qsl-runtime-logs-shared/strategy-artifacts/us_equity/russell_top50_leader_rotation_staging/russell_top50_leader_rotation_feature_snapshot_latest.csv", | ||
| "manifest_path": "gs://qsl-runtime-logs-shared/strategy-artifacts/us_equity/russell_top50_leader_rotation_staging/russell_top50_leader_rotation_feature_snapshot_latest.csv.manifest.json" | ||
| } | ||
| }, | ||
| "features": { | ||
| "income_layer": true, | ||
| "option_overlay": true, | ||
|
|
@@ -691,13 +705,17 @@ | |
| "scheduler_profile": "hk_snapshot_month_start", | ||
| "runtime_enabled": true, | ||
| "lifecycle_stage": "runtime_enabled", | ||
| "can_switch_live": true, | ||
| "can_switch_live": false, | ||
| "allowed_execution_modes": [ | ||
| "live", | ||
| "paper", | ||
| "dry_run" | ||
|
Comment on lines
709
to
711
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The catalog exposes Useful? React with 👍 / 👎. |
||
| ], | ||
| "blocked_live_reason": "", | ||
| "blocked_live_reason": "production_snapshot_artifact_route_not_configured", | ||
| "runtime_artifacts": { | ||
| "feature_snapshot": { | ||
| "required": true | ||
| } | ||
| }, | ||
| "features": { | ||
| "income_layer": false, | ||
| "option_overlay": false, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
service_targets_mode=offis used against an IBKR repository that has no existingCLOUD_RUN_SERVICE_TARGETS_JSON, the earlier bypass guard permits the operation, but this condition skips the deployment planner entirely andapply=trueproceeds directly to GitHub variable writes. This leaves the supported single-service/no-inventory path outside the new fail-closed contract and can publish live settings that the IBKR planner would reject; either synthesize a candidate inventory for this path or reject IBKR writes when no planner can run.Useful? React with 👍 / 👎.