Skip to content

fix: persist strategy failure stops and unify multilingual notifications - #397

Merged
brokermr810 merged 74 commits into
mainfrom
test
Nov 21, 2026
Merged

brokermr810 merged 74 commits into
mainfrom
test

Conversation

@brokermr810

Copy link
Copy Markdown
Collaborator

Summary

  • Persist definitive live-order failure counts per strategy run and stop after five consecutive counted failures. Protective position-direction/ownership rejections and transient or unknown outcomes do not count.
  • Evaluate portfolio rebalances by batch, so partial success does not stop the whole portfolio and five failed orders in one batch do not count as five failed batches.
  • Consolidate batch notifications across selected channels and send a separate deduplicated automatic-stop alert.
  • Unify verification and trading emails with monochrome templates, 11 application languages, Arabic RTL support, and the configured application brand name.

Root cause and safeguards

Pending-order failures were outside the evaluator failure counter, while portfolio alerts were delivered per order. The updated accounting and notification claims are durable, transactionally deduplicated, tenant-scoped and run-scoped. Newly accepted exchange outcomes reset the counter; queueing and repeated reconciliation updates do not. Automatic stop does not liquidate existing positions, and submitted orders still need reconciliation.

Verification

  • 556 relevant tests passed, including isolated PostgreSQL concurrency, migration idempotency, batch outcomes, stop handling, notification deduplication, locale and branding coverage.
  • Full critical Ruff, backend structure, documentation, whitespace and local secret checks passed.
  • No live exchange orders or actual notifications were sent during verification.

Deployment and limitations

  • Apply registered migration 20261121_strategy_order_batches.sql before starting updated workers.
  • Restart independent notification/trading workers after changing the configured application name.
  • Previously queued orders without batch IDs retain their per-order notification behavior.
  • Notifications are best-effort: a claimed notice is not automatically resent after delivery errors or a crash during sending.
  • Backend only. Generated previews and reference templates are not included.

tianhe added 30 commits November 1, 2026 17:17
Signed-off-by: TIANHE <[email protected]>

# Conflicts:
#	backend_api_python/app/routes/community.py
brokermr810 and others added 26 commits November 15, 2026 21:44
Signed-off-by: TIANHE <[email protected]>

# Conflicts:
#	backend_api_python/tests/test_safe_exec.py
#	backend_api_python/tests/test_strategy_runtime_process_isolation.py
Signed-off-by: TIANHE <[email protected]>

# Conflicts:
#	backend_api_python/app/professional_report/features/equity.py
#	backend_api_python/app/research/workflows.py
#	backend_api_python/tests/test_professional_report_builder.py
…emails

Persist definitive order failure streaks and portfolio batch outcomes, send deduplicated alerts across opted-in channels, and render transactional emails using localized monochrome templates and configured branding.

Signed-off-by: TIANHE <[email protected]>
Signed-off-by: TIANHE <[email protected]>

# Conflicts:
#	backend_api_python/app/services/strategy_v2/live_execution.py
#	backend_api_python/app/services/trading_executor.py
#	backend_api_python/tests/test_strategy_v2_order_gateway.py
#	docs/trading/LIVE_TRADING_SAFETY.md
#	docs/trading/LIVE_TRADING_SAFETY_CN.md
@sonarqubecloud

Copy link
Copy Markdown

@brokermr810
brokermr810 merged commit 768da15 into main Nov 21, 2026
15 checks passed
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.

3 participants