Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/runtime-guard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ jobs:
RUNTIME_GUARD_FAIL_WORKFLOW_ON_ALERT: ${{ inputs.fail_workflow_on_alert || vars.RUNTIME_GUARD_FAIL_WORKFLOW_ON_ALERT || 'true' }}
RUNTIME_GUARD_SCHEDULER_JOB_PATTERN: ${{ vars.RUNTIME_GUARD_SCHEDULER_JOB_PATTERN || vars.CLOUD_RUN_SERVICE }}
CLOUD_RUN_SERVICE: ${{ vars.CLOUD_RUN_SERVICE }}
CLOUD_RUN_SERVICES: ${{ vars.CLOUD_RUN_SERVICES }}
CLOUD_RUN_SERVICE_TARGETS_JSON: ${{ vars.CLOUD_RUN_SERVICE_TARGETS_JSON }}
GLOBAL_TELEGRAM_CHAT_ID: ${{ vars.GLOBAL_TELEGRAM_CHAT_ID }}
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
TELEGRAM_TOKEN_SECRET_NAME: ${{ vars.TELEGRAM_TOKEN_SECRET_NAME }}
Expand Down
6 changes: 3 additions & 3 deletions constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# Generated: 2026-07-01
# Auto-updated by update-qpk-pin.yml on every push to QPK main.

quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@a9085d6d46147f62b80bbd441d19d85acaa3dda6
us-equity-strategies @ git+https://github.com/QuantStrategyLab/UsEquityStrategies.git@635f64207a9db8dc7af51e7ad496557a57be5579
hk-equity-strategies @ git+https://github.com/QuantStrategyLab/HkEquityStrategies.git@5fb48ea102c28deb6dd1c9674553f3c77aba4f2c
quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@d786c1140967f0e96e35599d057f0655e5a9ba25
us-equity-strategies @ git+https://github.com/QuantStrategyLab/UsEquityStrategies.git@c8df5f9659340965bd7f53998892ed1018ed4254
hk-equity-strategies @ git+https://github.com/QuantStrategyLab/HkEquityStrategies.git@700c8b19c46336d3d8fcba687e58553afcf0235f
cn-equity-strategies @ git+https://github.com/QuantStrategyLab/CnEquityStrategies.git@e09fd557c2bd9ae5f4d44228915c4e52c4b0dd21
crypto-strategies @ git+https://github.com/QuantStrategyLab/CryptoStrategies.git@565be005e4186fd6d750884e7b0bc59f779f9549
4 changes: 3 additions & 1 deletion scripts/cloud_run_runtime_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def main() -> int:
f"no successful Cloud Run request found for {', '.join(services)} in the last {lookback_minutes} minutes"
)

if check_scheduler:
if check_scheduler and scheduler_pattern:
log_filter = f'resource.type="cloud_scheduler_job" AND timestamp >= "{since_text}"'
try:
entries = _run_gcloud_logging(project, log_filter, limit)
Expand All @@ -326,6 +326,8 @@ def main() -> int:
details.extend(_summarize(entry) for entry in failures[:5])
except RuntimeError as exc:
issues.append(f"Cloud Scheduler log query failed: {exc}")
elif check_scheduler:
print("Skipping Cloud Scheduler check because no scheduler job pattern could be derived.", file=sys.stderr)

if not issues:
service_text = ", ".join(services) if services else "<none configured>"
Expand Down
23 changes: 3 additions & 20 deletions strategy_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
from hk_equity_strategies.runtime_adapters import (
describe_platform_runtime_requirements as describe_hk_platform_runtime_requirements,
)
from quant_us_combo_strategies import (
get_platform_runtime_adapter as get_combo_runtime_adapter,
get_runtime_enabled_profiles as get_combo_runtime_enabled_profiles,
get_strategy_catalog as get_combo_strategy_catalog,
)
from quant_us_combo_strategies.runtime_adapters import (
describe_platform_runtime_requirements as describe_combo_platform_runtime_requirements,
)

from quant_platform_kit.common.strategies import (
PlatformCapabilityMatrix,
Expand All @@ -43,12 +35,11 @@

LONGBRIDGE_PLATFORM = "longbridge"
HK_EQUITY_DOMAIN = "hk_equity"
COMBOS_DOMAIN = "quant_combo"
TECH_COMMUNICATION_PULLBACK_PROFILE = "tech_communication_pullback_enhancement"
HK_DIVIDEND_GOLD_DEFENSIVE_ROTATION_PROFILE = "hk_dividend_gold_defensive_rotation"

PLATFORM_SUPPORTED_DOMAINS: dict[str, frozenset[str]] = {
LONGBRIDGE_PLATFORM: frozenset({US_EQUITY_DOMAIN, HK_EQUITY_DOMAIN, COMBOS_DOMAIN}),
LONGBRIDGE_PLATFORM: frozenset({US_EQUITY_DOMAIN, HK_EQUITY_DOMAIN}),
}


Expand Down Expand Up @@ -87,31 +78,23 @@ def _canonical_profile(profile: str | None) -> str:
return STRATEGY_CATALOG.profile_aliases.get(normalized, normalized)


COMBO_STRATEGY_PROFILES = frozenset(get_combo_strategy_catalog().definitions)


def get_platform_runtime_adapter(profile: str | None, *, platform_id: str):
canonical_profile = _canonical_profile(profile)
if canonical_profile in HK_STRATEGY_PROFILES:
return get_hk_platform_runtime_adapter(canonical_profile, platform_id=platform_id)
if canonical_profile in COMBO_STRATEGY_PROFILES:
return get_combo_runtime_adapter(canonical_profile, platform_id=platform_id)
return get_us_platform_runtime_adapter(canonical_profile, platform_id=platform_id)


def describe_platform_runtime_requirements(profile: str | None, *, platform_id: str) -> dict[str, object]:
canonical_profile = _canonical_profile(profile)
if canonical_profile in HK_STRATEGY_PROFILES:
return describe_hk_platform_runtime_requirements(canonical_profile, platform_id=platform_id)
if canonical_profile in COMBO_STRATEGY_PROFILES:
return describe_combo_platform_runtime_requirements(canonical_profile, platform_id=platform_id)
return describe_us_platform_runtime_requirements(canonical_profile, platform_id=platform_id)


US_STRATEGY_CATALOG = get_us_strategy_catalog()
HK_STRATEGY_CATALOG = get_hk_strategy_catalog()
COMBO_STRATEGY_CATALOG = get_combo_strategy_catalog()
STRATEGY_CATALOG = _merge_strategy_catalogs(US_STRATEGY_CATALOG, HK_STRATEGY_CATALOG, COMBO_STRATEGY_CATALOG)
STRATEGY_CATALOG = _merge_strategy_catalogs(US_STRATEGY_CATALOG, HK_STRATEGY_CATALOG)
US_STRATEGY_PROFILES = frozenset(US_STRATEGY_CATALOG.definitions)
HK_STRATEGY_PROFILES = frozenset(HK_STRATEGY_CATALOG.definitions)
LONGBRIDGE_EXCLUDED_LIVE_PROFILES = frozenset(
Expand All @@ -121,7 +104,7 @@ def describe_platform_runtime_requirements(profile: str | None, *, platform_id:
}
)
LONGBRIDGE_ROLLOUT_ALLOWLIST = (
get_us_runtime_enabled_profiles() | get_hk_runtime_enabled_profiles() | get_combo_runtime_enabled_profiles()
get_us_runtime_enabled_profiles() | get_hk_runtime_enabled_profiles()
) - LONGBRIDGE_EXCLUDED_LIVE_PROFILES
PLATFORM_CAPABILITY_MATRIX = PlatformCapabilityMatrix(
platform_id=LONGBRIDGE_PLATFORM,
Expand Down
Loading