Section 073
Orphan Positions
Every 5 minutes, rule R7 closes any position the book holds that its leaders no longer hold.
An orphan is a position the strategy book holds without a leader position that justifies it. Orphans can appear in several ways: an exit missed during a long disconnection, a fill that arrived after its order was reported complete, a leader closing and reopening faster than the executor could follow, or a fill that could not be attributed.
Rule R7 of the Resilient model runs every 5 minutes:
- Rebuild every leader's current position from the venue.
- For each coin the book holds, compute the position the model would hold given the leaders' current positions.
- If the leaders that justified the position are now flat, or hold the opposite side, the position is an orphan.
- Close the orphan with reduce-only IOC orders and record the cause.
Fills whose oid does not belong to any order the executor sent are flagged as foreign fills and alerted. They are never booked as the strategy's profit or loss without review.
R7 deliberately acts only when the leader side is flat or reversed. When a leader still holds the position at a different size, the normal proportional exit logic handles the difference on the next leader event, which avoids fighting the model with constant small adjustments.