rebalance used to sleep 3 s and record whatever status TWS had sent; on 2026-09-29 every order was still PendingSubmit with permId 0. Now it waits up to 30 s for PreSubmitted/Submitted/Filled, records the final statuses in orders.csv either way, and exits non-zero naming any rejected or unacknowledged order so the systemd unit's failure is visible. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>