23 std::optional<PositionCloseRequest>
take_at_open(
int bar, int64_t live_cycle) {
24 if (!due_ || bar <= due_->after_bar)
return std::nullopt;
25 auto request = std::exchange(due_, std::nullopt);
26 if (request->position_cycle != live_cycle)
return std::nullopt;