Skip to content

Silence LongBridge checks and clarify buy note#68

Merged
Pigbibi merged 1 commit into
mainfrom
fix/precheck-silent-and-buy-note
May 18, 2026
Merged

Silence LongBridge checks and clarify buy note#68
Pigbibi merged 1 commit into
mainfrom
fix/precheck-silent-and-buy-note

Conversation

@Pigbibi
Copy link
Copy Markdown
Collaborator

@Pigbibi Pigbibi commented May 18, 2026

Summary

Silence successful detection-path notifications for LongBridge while keeping execution reports and logs intact, add the missing /probe endpoint used by Cloud Scheduler, and clarify the buy-skip reason when the target gap is below the minimum one-share order size.

Why

The scheduled /precheck endpoint is intended to detect startup/runtime problems and leave an audit trail, not send a normal successful rebalance notification every morning. Today it still used the real Telegram notification port during validation-only runs, so successful dry-run checks produced user-facing notifications.

The Cloud Scheduler post-open /probe jobs are also configured, but the LongBridge service currently has no /probe route, so those requests return 404 instead of checking broker/account availability.

Separately, buy orders that were skipped because the target allocation gap was smaller than one whole share could be reported as a cash shortage. In the SG example, available cash was enough for one share, but the target gap was intentionally below one-share price, so the message was misleading.

Changes

  • Add a silent notification port path for validation-only strategy runs.
  • Keep validation-only reports/logging behavior unchanged.
  • Add /probe as a dry-run report-scoped broker/account health check.
  • Keep successful probe checks silent and notify only when the probe fails.
  • Split the buy-skip notification into target-gap-below-one-share vs cash-below-one-share cases.
  • Add Chinese and English notification text for the target-gap case.

Validation

  • env PYTHONPATH=/home/ubuntu/Projects/QuantPlatformKit/src:/home/ubuntu/Projects/UsEquityStrategies/src python -m pytest tests/test_runtime_composer.py tests/test_request_handling.py::RequestHandlingTests::test_handle_probe_checks_account_snapshot_without_success_notification tests/test_request_handling.py::RequestHandlingTests::test_handle_probe_failure_sends_notification tests/test_request_handling.py::RequestHandlingTests::test_run_strategy_validation_only_uses_dry_run_composer -q
  • python -m unittest tests.test_rebalance_service
  • python -m py_compile main.py application/runtime_composer.py application/execution_service.py notifications/telegram.py tests/test_runtime_composer.py tests/test_request_handling.py tests/test_rebalance_service.py

@Pigbibi Pigbibi merged commit e15e507 into main May 18, 2026
1 check passed
@Pigbibi Pigbibi deleted the fix/precheck-silent-and-buy-note branch May 18, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant