Skip to content

[codex] Retry LongBridge refresh after sells#18

Merged
Pigbibi merged 1 commit into
mainfrom
codex/longbridge-post-sell-refresh-retry
Apr 15, 2026
Merged

[codex] Retry LongBridge refresh after sells#18
Pigbibi merged 1 commit into
mainfrom
codex/longbridge-post-sell-refresh-retry

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add a bounded post-sell account refresh retry loop for LongBridge rebalancing.
  • Use the best refreshed plan before submitting follow-up buys, instead of relying on the first immediate account read.
  • Wire the retry loop to the existing order poll interval/attempt constants.

Root cause

LongBridge already refreshed the account state after submitted sells, but it did so immediately after order monitoring. In live runs the broker can still return stale buying power for the first refresh, so follow-up buys may still be sized from the pre-sale cash.

Validation

  • PYTHONPATH=.:../QuantPlatformKit/src:../UsEquityStrategies/src uv run --with pytest --with pandas --with numpy --with pytz --with requests --with flask --with pandas-market-calendars --with longport python -m pytest tests/test_rebalance_service.py tests/test_decision_mapper.py tests/test_strategy_runtime.py -q
  • PYTHONPATH=.:../QuantPlatformKit/src:../UsEquityStrategies/src uv run --with ruff --with requests ruff check application/rebalance_service.py main.py tests/test_rebalance_service.py
  • git diff --check

@Pigbibi Pigbibi merged commit 790ef32 into main Apr 15, 2026
1 check passed
@Pigbibi Pigbibi deleted the codex/longbridge-post-sell-refresh-retry branch April 15, 2026 20:36
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