Skip to content

Commit f5deaf8

Browse files
luisleo526claude
andcommitted
source: erase_retired_rows keeps a dormant askable-origin exit leg pinned for its cycle, as v1.6.3's K1 pinned it (R6a-F1)
The retirement sweep released a dormant askable-origin exit leg A when a later same-family, same-source, same-from_entry exit with different stop bits existed (release_superseded), dropped it from the K2/K3 candidates, and let K3 keep it anyway as the first witness of a live exit Y. A's own supersessor B (released by a later C, nobody's witness, no projection_predecessor link) was then erased. revive_brackets_after_margin decides "superseded" only over retained rows, so with B gone and C's stop bits equal to A's, a margin call restored A as a marketable flatten at the margin price under A's exit id: an extra trade that v1.6.3 never books (v1.6.3 pinned every unwithdrawn lifecycle row for the cycle). held_by_cycle and the matching collection of held legs in the unpinned pre-pass now require the leg's origin NOT to be askable, dormant or not: a dormant askable-origin leg is pinned by pinned_by_itself exactly as in v1.6.3 and is never released. Withdrawn legs, non-askable origins and everything else are unchanged. The cost: a script that keeps re-issuing strategy.exit(qty=) over a dormant askable leg without cancelling retains its rows while the origin stays open, as v1.6.3 did. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
1 parent cad8b4b commit f5deaf8

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎src/source/pine_adapter.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3914,14 +3914,15 @@ void PineExecutionAdapter::erase_retired_rows(const NativeDecisionContext& conte
39143914
return (value.family == PineOrderFamily::Entry || value.family == PineOrderFamily::Order)
39153915
&& value.placement_script_open_ms >= last_broker_open_ms_;
39163916
};
3917-
// Dormant askable-origin legs can be superseded too. A non-dormant
3918-
// askable-origin leg still answers the consumed-leg question and stays.
3917+
// An askable-origin leg, dormant or not, stays pinned for its cycle as
3918+
// v1.6.3's K1 pinned it: releasing a dormant one let the sweep erase its
3919+
// supersessor while K3 kept the released leg as a witness, and the margin
3920+
// revival then restored the superseded leg.
39193921
const auto held_by_cycle = [&](const PlacementSnapshot& value) {
39203922
return pinned_by_itself(value) && value.placement_cycle == cycle
39213923
&& exit_family(value.family) && !value.from_entry.empty()
39223924
&& !withdrawn(value.legs)
3923-
&& (value.legs.dormant()
3924-
|| !contains(askable_origins, value.bracket_origin.incarnation));
3925+
&& !contains(askable_origins, value.bracket_origin.incarnation);
39253926
};
39263927
auto& held = sweep.held;
39273928
bool unpinned = false;
@@ -4150,8 +4151,7 @@ void PineExecutionAdapter::erase_retired_rows(const NativeDecisionContext& conte
41504151
&& *candidate_origin_cursor < incarnation) ++candidate_origin_cursor;
41514152
const bool askable = candidate_origin_cursor != askable_origins.end()
41524153
&& *candidate_origin_cursor == incarnation;
4153-
if (!askable && (value.legs.dormant()
4154-
|| !contains(askable_origins, value.bracket_origin.incarnation)))
4154+
if (!askable && !contains(askable_origins, value.bracket_origin.incarnation))
41554155
held.push_back({incarnation, &value});
41564156
}
41574157
candidates.emplace_back(incarnation, &value);

0 commit comments

Comments
 (0)