Investing involves risk. This project does not provide investment advice and is for education, research, and engineering review only.
QuantRuntimeSettings is a QuantStrategyLab runtime settings package. It defines schemas and tooling for versioned runtime settings shared across QuantStrategyLab platforms.
It supports the system but does not decide which strategy should be live. Strategy eligibility remains in the strategy and snapshot repositories; broker execution remains in the platform repositories.
- Keep contracts stable and versioned where downstream repositories depend on them.
- Prefer backward-compatible changes unless a coordinated migration is planned.
- Keep secrets and environment-specific settings outside the shared library code.
- Document changes that affect multiple platforms or strategy packages.
tests/: unit, contract, and regression tests..github/workflows/: CI, scheduled jobs, release, or deployment workflows.scripts/: operator scripts and local helpers.
python3 scripts/runtime_settings.py validate
python3 -m unittest discover -s tests -v.github/workflows/manual-strategy-switch.yml provides a central manual switch entrypoint. It builds a transient runtime target from workflow inputs, validates it with scripts/runtime_settings.py, and writes GitHub variables into the target platform repository. It currently supports longbridge, ibkr, schwab, and firstrade.
Recommended flow:
- Run once with
apply=falseto preview the assignments. - Check
repository,environment,strategy_profile,service_name,execution_mode, and plugin mounts. - Re-run with
apply=trueandconfirm_apply=APPLYto write variables. - Set
trigger_platform_sync=trueandconfirm_apply=APPLY_AND_SYNCwhen the target platform should dispatch its Cloud Run env sync workflow.
Example:
platform=longbridge
target_name=sg
strategy_profile=tqqq_growth_income
execution_mode=live
plugin_mode=auto
apply=true
trigger_platform_sync=true
confirm_apply=APPLY_AND_SYNC
Notes:
- This is a GitHub Actions
workflow_dispatchform, not a public web app. The defaultapply=falsemode only previews assignments and writes nothing remotely. - LongBridge defaults to environment-scoped variables;
target_name=sgresolves tolongbridge-sg. - Schwab defaults to repository-scoped variables.
- Firstrade defaults to repository-scoped variables;
target_name=liveusesfirstrade-quant-serviceandaccount_scope=US. - IBKR patches the selected service/account-scope entry inside
CLOUD_RUN_SERVICE_TARGETS_JSONwhen that variable exists, so other IBKR services are preserved. - Cross-repository variable writes and workflow dispatches require a
RUNTIME_SETTINGS_GH_TOKENsecret in this repository with sufficient target-repository variable/workflow permissions. The workflow does not fall back to the defaultgithub.tokenfor remote writes. - IBKR
service_targets_mode=automust read and patch the target repository'sCLOUD_RUN_SERVICE_TARGETS_JSON, so even preview mode requiresRUNTIME_SETTINGS_GH_TOKENfor IBKR. - The workflow is bound to the
runtime-strategy-switchGitHub Environment. For a personal system, required reviewers are optional; prefer storingRUNTIME_SETTINGS_GH_TOKENas an Environment secret and rely on preview, confirmation text, and a least-privilege token for day-to-day safety. - Follow the simplified permission-control plan before enabling real switches: docs/manual_strategy_switch_permission_control.zh-CN.md.
- Fork guide for the strategy switch console
- Strategy switch console Worker
- Strategy switch admin backend
- Manual strategy switch permission-control plan
- See CONTRIBUTING.md for pull request scope, local verification, and documentation expectations.
- Follow CODE_OF_CONDUCT.md for maintainer and contributor conduct.
- Report credential, automation, broker, exchange, or cloud-resource vulnerabilities through SECURITY.md; do not open public issues for secrets or live-execution risk.
See LICENSE.