317 hash_exit_scratch(f, exit_scratch_.get());
318 f.
u(source_sequence_); f.
u(command_ordinal_); f.
u(broker_open_epoch_);
319 f.
i(last_broker_open_ms_); f.
u(source_command_sequence_); f.
b(host_ !=
nullptr);
320 f.
b(config_.process_orders_on_close); f.
b(config_.calc_on_order_fills);
321 f.
d(config_.initial_capital); f.
i(config_.default_qty_type); f.
d(config_.default_qty_value);
322 f.
i(config_.pyramiding); f.
d(config_.commission_value); f.
i(config_.commission_type);
323 f.
i(config_.slippage); f.
d(config_.margin_long); f.
d(config_.margin_short);
324 f.
b(config_.close_entries_rule_any); f.
b(config_.src_series_active);
325 f.
s(staged_.syminfo.ticker); f.
s(staged_.syminfo.tickerid); f.
s(staged_.syminfo.currency);
326 f.
s(staged_.syminfo.basecurrency); f.
s(staged_.syminfo.type); f.
s(staged_.syminfo.timezone);
327 f.
s(staged_.syminfo.session); f.
s(staged_.syminfo.volumetype); f.
s(staged_.syminfo.description);
328 f.
d(staged_.syminfo.mintick); f.
d(staged_.syminfo.pointvalue); f.
d(staged_.syminfo.qty_step);
329 f.
s(staged_.chart_timezone); f.
d(staged_.account_fx);
330 f.
u(staged_.account_fx_effective_from_ms.size());
331 for (
const auto timestamp : staged_.account_fx_effective_from_ms) f.
i(timestamp);
332 f.
u(staged_.account_fx_per_quote.size());
333 for (
const auto rate : staged_.account_fx_per_quote) f.
d(rate);
334 f.
b(staged_.quantity_grid.has_value());
if (staged_.quantity_grid) f.
d(*staged_.quantity_grid);
338 if (!staged_.instrument_feeds.empty()) {
339 f.
u(staged_.instrument_feeds.size());
340 for (
const auto& feed : staged_.instrument_feeds) {
341 f.
s(feed.instrument);
347 std::vector<std::string> input_keys;
348 for (
const auto& pair : staged_.inputs) input_keys.push_back(pair.first);
349 std::sort(input_keys.begin(), input_keys.end()); f.
u(input_keys.size());
350 for (
const auto& key : input_keys) { f.
s(key); f.
s(staged_.inputs.at(key)); }
353 f.
u(cohorts_by_id_.size());
354 for (
const auto& row : cohorts_by_id_.all_sorted()) {
355 const auto& key = row.first;
const auto& cohort = row.second;
356 f.
s(key); f.
u(cohort.handle.value); f.
i(cohort.cycle);
359 f.
u(cohort.origins.size()); f.
u(cohort.origins.digest());
360 hash_native_handle_vector(f, cohort.opened);
361 f.
u(cohort.erased_opening_sides);
362 std::vector<std::uint64_t> live_origin_keys;
363 live_origin_keys.reserve(cohort.live_units_by_origin.size());
364 for (
const auto& row : cohort.live_units_by_origin) live_origin_keys.push_back(row.first);
365 std::sort(live_origin_keys.begin(), live_origin_keys.end());
366 f.
u(live_origin_keys.size());
367 for (
const auto incarnation : live_origin_keys) {
368 f.
u(incarnation); f.
d(cohort.live_units_by_origin.at(incarnation));
371 f.
u(cohorts_by_id_.size());
372 cohorts_by_id_.for_each_id([&](
const auto& key) { f.
s(key); });
380 settled_bracket_families_, settled_bracket_digest_);
381 f.
u(placement_.high_water()); f.
u(placement_.erased_rows()); f.
u(placement_.erased_digest());
382 f.
u(placement_.size());
383 for (
const auto& row : placement_) {
385 f.
u(row.first); hash_placement(f, row.second);
387 std::vector<std::uint64_t> live_keys;
388 for (
const auto& pair : live_by_source_key_) live_keys.push_back(pair.first);
389 std::sort(live_keys.begin(), live_keys.end()); f.
u(live_keys.size());
390 for (
const auto key : live_keys) { f.
u(key); hash_native_handle(f, live_by_source_key_.at(key)); }
391 std::vector<std::uint64_t> bracket_keys;
392 for (
const auto& pair : bracket_families_) bracket_keys.push_back(pair.first);
393 std::sort(bracket_keys.begin(), bracket_keys.end()); f.
u(bracket_keys.size());
394 for (
const auto key : bracket_keys) {
397 const auto& family = bracket_families_.at(key);
399 f.
u(key); f.
u(family.settled_count()); f.
u(family.settled_digest());
400 hash_native_handle_vector(f, family.working_tail());
401 f.
u(family.consumed_facts().size());
402 for (
const auto& fact : family.consumed_facts()) { f.
u(fact.first); f.
u(fact.second); }
409 if (!settled_bracket_families_.empty()) {
410 f.
s(
"pineforge-settled-bracket-families/v1");
411 f.
u(settled_bracket_families_.size()); f.
u(settled_bracket_digest_);
413 f.
u(pending_bracket_legs_.size());
414 for (
const auto& leg : pending_bracket_legs_) {
415 hash_native_request(f, leg.request); hash_placement(f, leg.snapshot);
416 f.
s(leg.replacement_key); f.
u(leg.family_key);
418 f.
u(pending_entries_.size());
419 for (
const auto&
entry : pending_entries_) {
420 hash_native_request(f,
entry.request); hash_placement(f,
entry.snapshot);
421 f.
s(
entry.replacement_key);
423 f.
u(delayed_market_orders_.size());
424 for (
const auto&
order : delayed_market_orders_) {
425 hash_native_request(f,
order.request); hash_placement(f,
order.snapshot);
426 f.
s(
order.replacement_key); f.
u(
order.release_open_epoch);
427 f.
b(
order.execute_at_open);
429 f.
u(deferred_open_marketable_sells_.size());
430 for (
const auto& sell : deferred_open_marketable_sells_) {
431 hash_placement(f, sell.snapshot); f.
s(sell.replacement_key); f.
d(sell.fill_price);
432 f.
d(sell.path_position); f.
b(sell.open_marketable);
434 f.
u(throttled_reopen_rearm_.size());
435 for (
const auto& snapshot : throttled_reopen_rearm_) hash_placement(f, snapshot);
436 f.
i(entry_openings_interval_index_); f.
i(entry_openings_this_interval_);
437 f.
u(pending_same_bar_commands_.size());
438 for (
const auto& command : pending_same_bar_commands_) {
439 hash_native_request(f, command.request); hash_placement(f, command.snapshot);
440 f.
s(command.replacement_key); f.
b(command.opening);
441 if (command.unbatched_request && command.unbatched_snapshot) {
442 f.
u(0x756e626174636865ULL);
443 hash_native_request(f, *command.unbatched_request);
444 hash_placement(f, *command.unbatched_snapshot);
445 const auto& context = command.unbatched_context;
446 f.
d(context.current); f.
d(context.limit_price); f.
d(context.stop_price);
447 f.
b(context.default_sized); f.
b(context.priced); f.
b(context.reverses);
448 f.
b(context.opposite_opening_pending); f.
b(context.pure_stop_entry);
449 f.
b(context.coof_market_next_open); f.
b(context.coof_priced_next_open);
450 f.
b(context.coof_market_at_second_extreme); f.
b(context.paired_all_in_reentry);
453 if (command.staged_reversal) {
454 f.
b(command.staged_reversal); f.
d(command.staged_reversal_held_units);
457 f.
u(source_shadow_pending_.size());
458 for (
const auto& shadow : source_shadow_pending_) {
459 hash_placement(f, shadow.snapshot); f.
s(shadow.label);
461 f.
d(pending_same_bar_close_qty_);
462 f.
u(pending_relative_exits_.size());
463 for (
const auto&
exit : pending_relative_exits_) {
468 if (
exit.void_global) f.
u(0x766f6964676cULL);
472 if (!anchored_relative_legs_.empty() || anchored_relative_stats_.anchored != 0
473 || materializing_parent_.incarnation != 0) {
474 f.
s(
"pineforge-source-anchored-legs/v1");
475 f.
u(anchored_relative_stats_.anchored); f.
u(anchored_relative_stats_.adopted);
476 f.
u(anchored_relative_stats_.withdrawn); f.
u(materializing_parent_.incarnation);
477 f.
i(anchored_cohort_sequence_);
478 f.
u(anchored_relative_legs_.size());
479 for (
const auto& leg : anchored_relative_legs_) {
480 f.
s(leg.exit_id); f.
s(leg.from_entry); f.
u(
static_cast<std::uint64_t
>(leg.family));
481 f.
u(leg.handle.incarnation); f.
u(leg.parent.incarnation); f.
b(leg.parent_long);
482 f.
d(leg.operand_ticks); f.
d(leg.trail_offset);
483 hash_native_request(f, leg.request);
486 if (
const auto* anchor = std::get_if<native_order::FromOwnerFill>(
487 &leg.request.anchor)) {
488 f.
d(anchor->offset); f.
b(anchor->ticks);
489 f.
u(
static_cast<std::uint64_t
>(anchor->rounding));
491 f.
b(leg.armed); f.
d(leg.installed_level);
497 if (!per_entry_exits_.empty()) {
498 f.
s(
"pineforge-source-per-entry-exits/v1");
499 f.
u(per_entry_exits_.size());
500 for (
const auto&
exit : per_entry_exits_) {
503 f.
u(
exit.children.size());
504 for (
const auto& child :
exit.children) {
505 f.
u(child.origin); f.
d(child.fill_price); f.
d(child.units); f.
b(child.consumed);
509 f.
u(pending_coof_requests_.size());
510 for (
const auto& pending : pending_coof_requests_) {
511 hash_native_request(f, pending.request); hash_placement(f, pending.snapshot);
512 f.
s(pending.replacement_key); f.
b(pending.opening); f.
u(pending.family_key);
513 f.
b(pending.next_open);
515 f.
u(pending_margin_revivals_.size());
516 for (
const auto& pending : pending_margin_revivals_) {
517 hash_placement(f, pending.snapshot); f.
i(pending.decline_bar);
519 hash_native_handle_vector(f, live_handles_); hash_native_handle_vector(f, first_open_newborns_);
523 hash_native_handle_vector(f, live_handles_);
525 f.
u(dropped_close_count_); f.
u(dropped_close_digest_);
526 f.
u(open_entry_fees_.size());
527 for (
const auto& fee : open_entry_fees_) {
528 hash_native_handle(f, fee.opening); f.
s(fee.source_id); f.
d(fee.units);
529 f.
d(fee.nonpercent_fee);
532 const auto trade_prefix = host_
533 ? NativeExecutionConsumer::bound(*host_).closed_trade_prefix()
534 : NativeExecutionConsumer::ClosedTradePrefix{};
535 const std::size_t phase_end = trade_prefix.base + trade_exit_phase_.size();
536 const auto* phase_consumer = host_ ? &NativeExecutionConsumer::bound(*host_) :
nullptr;
538 if (phase_consumer && phase_consumer->exit_phases_restarted()) {
543 f.
h = phase_consumer->replay_sealed_exit_phases(f.
h);
544 for (
const auto phase : trade_exit_phase_) f.
u(phase);
546 if (exit_phase_final_ < trade_prefix.base)
548 "hashed exit-phase fold precedes the sealed prefix");
549 f.
u(exit_phase_final_); f.
u(exit_phase_digest_);
550 for (std::size_t index = exit_phase_final_; index < phase_end; ++index)
551 f.
u(trade_exit_phase_.at(index - trade_prefix.base));
555 if (exit_rank_keys_.size() >= 2 || exit_rank_peak_ > 13 || exit_rank_alt_peak_ > 13) {
556 f.
u(exit_rank_keys_.size()); f.
u(exit_rank_keys_digest_);
557 f.
u(exit_rank_peak_); f.
u(exit_rank_alt_peak_);
559 std::vector<std::uint64_t> current_debit_ordinals;
560 current_debit_ordinals.reserve(current_debited_applied_ordinals_.size());
561 for (
const auto ordinal : current_debited_applied_ordinals_) current_debit_ordinals.push_back(ordinal);
562 std::sort(current_debit_ordinals.begin(), current_debit_ordinals.end());
563 f.
u(current_debit_ordinals.size());
564 for (
const auto ordinal : current_debit_ordinals) f.
u(ordinal);
565 std::vector<std::uint64_t> intraday_relabel_ordinals;
566 intraday_relabel_ordinals.reserve(intraday_loss_relabel_ordinals_.size());
567 for (
const auto ordinal : intraday_loss_relabel_ordinals_)
568 intraday_relabel_ordinals.push_back(ordinal);
569 std::sort(intraday_relabel_ordinals.begin(), intraday_relabel_ordinals.end());
570 f.
u(intraday_relabel_ordinals.size());
571 for (
const auto ordinal : intraday_relabel_ordinals) f.
u(ordinal);
572 consumed_partial_exit_cycles_.fold_sorted(f);
573 std::vector<std::uint64_t> shadowed_openings(
574 bracket_shadowed_openings_.begin(), bracket_shadowed_openings_.end());
575 std::sort(shadowed_openings.begin(), shadowed_openings.end());
576 f.
u(shadowed_openings.size());
577 for (
const auto opening : shadowed_openings) f.
u(opening);
578 std::vector<std::string> named_cancel_keys;
579 named_cancel_keys.reserve(named_entry_cancel_tokens_.size());
580 for (
const auto& row : named_entry_cancel_tokens_) named_cancel_keys.push_back(row.first);
581 std::sort(named_cancel_keys.begin(), named_cancel_keys.end());
582 f.
u(named_cancel_keys.size());
583 for (
const auto& key : named_cancel_keys) {
584 const auto& token = named_entry_cancel_tokens_.at(key);
585 f.
s(key); f.
u(token.entry_incarnation); f.
u(token.surviving_exit_incarnation);
589 if (!id_bound_exits_.empty()) {
591 f.
u(id_bound_exits_.size());
592 for (
const auto& row : id_bound_exits_) {
593 f.
s(row.exit_id); f.
s(row.from_entry);
594 f.
d(row.levels.limit); f.
d(row.levels.stop); f.
d(row.levels.trail_points);
595 f.
d(row.levels.trail_offset); f.
d(row.levels.trail_price);
596 f.
d(row.levels.profit_ticks); f.
d(row.levels.loss_ticks);
597 f.
d(row.qty_percent); f.
d(row.qty); f.
s(row.comment); f.
s(row.oca_name);
600 f.
u(close_logical_units_.size());
601 for (
const auto& row : close_logical_units_) { f.
s(row.first); f.
d(row.second); }
605 if (close_ledger_records_.size() > 1) {
606 f.
u(close_ledger_records_.size());
607 for (
const auto& record : close_ledger_records_) { f.
s(record.id); f.
d(record.units); }
611 if (!pyramiding_records_.empty()) {
612 f.
s(
"pineforge-pyramiding-records/v1");
613 f.
u(pyramiding_records_.size());
614 for (
const auto& record : pyramiding_records_) {
615 f.
s(record.id); f.
u(record.incarnation); f.
d(record.units);
619 if (!exit_tombstones_.empty()) {
620 std::vector<SourceId> keys;
621 keys.reserve(exit_tombstones_.size());
622 for (
const auto& row : exit_tombstones_) keys.push_back(row.first);
623 std::sort(keys.begin(), keys.end());
624 f.
s(
"pineforge-exit-tombstones/v1");
626 for (
const auto& key : keys) { f.
s(key); f.
u(exit_tombstones_.at(key)); }
630 f.
u(0); f.
u(0); f.
u(0); f.
u(0);
631 f.
u(close_batch_callsites_.size());
632 for (
const auto& row : close_batch_callsites_) {
633 const auto& site = row.second;
634 f.
u(row.first); f.
b(site.active); f.
u(site.token); f.
i(site.calls);
635 f.
s(site.first_id); f.
s(site.id); f.
s(site.comment);
636 f.
d(site.target); f.
u(site.queue_sequence);
638 f.
i(close_batch_bar_); f.
u(close_batch_queue_sequence_);
639 f.
d(close_batch_pending_debt_); f.
d(close_batch_admitted_total_);
640 f.
u(receipt_cursor_);
641 f.
u(last_applied_ordinal_);
642 f.
u(terminal_receipt_cursor_);
643 f.
i(entry_attempt_bar_); f.
u(entry_attempts_on_bar_);
644 f.
b(materializing_relative_);
645 f.
i(current_position_cycle_);
646 f.
i(current_position_sign_);
647 f.
u(next_sequential_group_);
648 f.
b(source_batch_mutated_);
649 f.
b(coof_recalc_active_); f.
b(coof_first_open_);
650 if (coof_open_stop_next_waypoint_) f.
u(0x6f70656e6e657874ULL);
651 f.
u(coof_market_entry_recalc_incarnation_);
652 f.
u(coof_market_entry_recalc_fill_seq_); f.
u(coof_current_fill_seq_);
655 if (coof_recalc_active_) f.
d(coof_fill_cursor_t_);
656 if (coof_recalc_active_ && !std::isnan(coof_fill_target_print_)) {
657 f.
u(0x7761797466ULL); f.
d(coof_fill_target_print_);
659 if (coof_recalc_active_) f.
b(coof_fill_forced_);
660 const auto& coof_coord = coof_context_.coordinate;
661 f.
u(coof_coord.ordinal); f.
i(coof_coord.interval_index); f.
i(coof_coord.open_ms);
662 f.
i(coof_coord.eligible_open_ms); f.
i(coof_coord.last_traded_close_ms);
663 f.
i(coof_coord.next_period_open_ms); f.
i(coof_coord.next_input_open_ms);
664 f.
i(coof_coord.effective_time_ms); f.
i(coof_coord.source_price_time_ms);
665 f.
i(
static_cast<std::int64_t
>(coof_coord.provenance));
666 f.
i(
static_cast<std::int64_t
>(coof_coord.path_phase));
667 f.
i(
static_cast<std::int64_t
>(coof_coord.completion)); f.
i(coof_context_.decision_floor_ms);
669 f.
i(interval.open_ms); f.
i(interval.eligible_open_ms); f.
i(interval.last_traded_close_ms);
670 f.
i(interval.next_period_open_ms); f.
i(interval.next_input_open_ms);
672 hash_coof_interval(coof_context_.input_interval);
673 hash_coof_interval(coof_context_.script_interval);
674 f.
i(coof_context_.sub_index); f.
i(coof_context_.sub_count);
675 f.
b(coof_context_.is_terminal_sub_bar); f.
i(coof_context_.sub_bar_open_ms);
676 f.
i(coof_context_.script_bar_open_ms);
677 f.
b(coof_context_.driver_statistics.intrabar_path_enabled);
678 f.
i(coof_context_.driver_statistics.sub_bars_per_script_bar);
679 f.
i(coof_context_.driver_statistics.samples_per_sub_bar);
680 f.
u(coof_context_.driver_statistics.sub_bars_processed);
681 f.
u(coof_context_.driver_statistics.sample_ticks_processed);
682 f.
d(coof_script_bar_.open); f.
d(coof_script_bar_.high); f.
d(coof_script_bar_.low);
683 f.
d(coof_script_bar_.close); f.
d(coof_script_bar_.volume); f.
i(coof_script_bar_.timestamp);
684 f.
b(coof_script_bar_valid_);
686 f.
u(pooc_close_basis_count_); f.
i(pooc_close_basis_last_bar_); f.
u(pooc_close_basis_digest_);
687 f.
d(pooc_open_basis_); f.
i(pooc_open_script_bar_); f.
i(close_all_pending_script_bar_);
688 f.
d(last_fx_rate_); f.
i(position_open_script_bar_); f.
u(position_open_epoch_); f.
i(position_open_bar_index_);
689 f.
u(
static_cast<std::uint64_t
>(position_open_phase_));
690 f.
b(position_open_priced_);
691 f.
i(last_margin_call_script_bar_); f.
i(pooc_close_checkpoint_deferred_ms_);
694 if (close_margin_open_bar_ != std::numeric_limits<std::int64_t>::min())
695 f.
i(close_margin_open_bar_);
700 if (owed_follow_up_bar_ != std::numeric_limits<std::int64_t>::min()) {
701 f.
s(
"pineforge-owed-follow-up/v1");
702 f.
i(owed_follow_up_bar_); f.
i(owed_follow_up_point_); f.
d(owed_follow_up_units_);
704 if (close_call_after_script_bar_ != std::numeric_limits<std::int64_t>::min()) {
705 f.
s(
"pineforge-close-call-after-script/v1");
706 f.
i(close_call_after_script_bar_); f.
d(close_call_after_script_book_);
707 f.
d(close_call_after_script_units_);
712 if (open_exit_first_bar_ != std::numeric_limits<std::int64_t>::min()) {
713 f.
s(
"pineforge-open-exit-first/v1");
714 f.
i(open_exit_first_bar_); f.
u(open_exit_first_origin_); f.
s(open_exit_first_id_);
715 f.
d(open_exit_first_fill_);
720 if (close_first_script_bar_ != std::numeric_limits<std::int64_t>::min()) {
721 f.
s(
"pineforge-close-first/v1");
722 f.
i(close_first_script_bar_); f.
i(close_first_side_);
724 f.
u(last_margin_call_event_ordinal_);
725 f.
u(last_margin_call_entry_incarnation_); f.
i(last_margin_call_position_cycle_);
726 f.
b(last_margin_call_at_script_close_);
727 f.
d(last_margin_call_closed_units_); f.
d(last_margin_call_remaining_units_);
735 if (
const auto* pine = pine_view_of(host_)) {
738 const std::uint64_t count = pine->closed_trade_count();
739 const bool restart = count < source_money_folded_;
740 if (count < trade_prefix.base)
742 "hashed source-money rewind precedes the sealed prefix");
743 double gains = restart ? trade_prefix.source_gains : source_gains_;
744 double losses = restart ? trade_prefix.source_losses : source_losses_;
745 for (std::uint64_t index = restart ? trade_prefix.base : source_money_folded_;
746 index < count; ++index) {
747 const double profit = pine->closed_trade(index).pnl;
748 if (profit > 0.0) gains += profit;
749 else losses += profit;
751 const double mirrored = gains + losses;
752 const double engine_net = pine->net_profit_sum_;
753 if (count != 0 && std::memcmp(&mirrored, &engine_net,
sizeof(
double)) != 0) {
754 f.
d(gains); f.
d(losses); f.
u(count);
758 f.
i(signal_close_mc_event_bar_);
759 f.
i(signal_close_mc_position_cycle_); f.
u(signal_close_mc_entry_incarnation_);
760 f.
u(signal_close_mc_fill_seq_); f.
d(signal_close_mc_before_qty_);
761 f.
d(signal_close_mc_remaining_qty_); f.
i(risk_coof_direct_script_bar_);
762 f.
u(cap_latest_fill_);
763 f.
b(source_margin_call_enabled_);
764 f.
d(policy_script_bar_.open); f.
d(policy_script_bar_.high);
765 f.
d(policy_script_bar_.low); f.
d(policy_script_bar_.close);
766 f.
d(policy_script_bar_.volume); f.
i(policy_script_bar_.timestamp);
767 f.
b(policy_script_bar_valid_);
772 std::vector<std::uint64_t> market_add_keys(market_pyramid_adds_.begin(),
773 market_pyramid_adds_.end());
774 std::sort(market_add_keys.begin(), market_add_keys.end());
775 f.
u(market_add_keys.size());
776 for (
const auto key : market_add_keys) f.
u(key);
777 std::vector<std::uint64_t> trail_open_keys;
778 trail_open_keys.reserve(trail_state_at_open_.size());
779 for (
const auto& row : trail_state_at_open_) trail_open_keys.push_back(row.first);
780 std::sort(trail_open_keys.begin(), trail_open_keys.end());
781 f.
u(trail_open_keys.size());
782 for (
const auto key : trail_open_keys) {
783 const auto& state = trail_state_at_open_.at(key);
784 f.
u(key); f.
b(state.activated); f.
d(state.best_price);
785 f.
d(state.current_level); f.
u(state.activation_ordinal);
790 if (!carried_trail_retunes_.empty()) {
791 f.
u(carried_trail_retunes_.size());
792 for (
const auto& [handle, distance] : carried_trail_retunes_) {
793 f.
u(handle.incarnation); f.
d(distance);
797 f.
i(day_ledger_.current_day); f.
i(day_ledger_.last_loss_day); f.
i(day_ledger_.consecutive_loss_days);
798 f.
i(day_ledger_.intraday_loss_day); f.
d(day_ledger_.intraday_start_equity);
799 f.
d(day_ledger_.intraday_realized); f.
u(day_ledger_.observed_applied_ordinal);
802 if (risk_.max_intraday_loss > 0.0) f.
i(day_ledger_.intraday_start_script_bar);
803 f.
i(risk_.direction); f.
i(risk_.max_cons_loss_days); f.
d(risk_.max_drawdown);
804 f.
b(risk_.max_drawdown_percent); f.
d(risk_.max_intraday_loss);
805 f.
b(risk_.max_intraday_loss_percent); f.
d(risk_.max_position_size); f.
b(risk_.halted);
806 f.
d(risk_.observed_peak_equity); f.
d(risk_.observed_max_drawdown);
807 f.
i(risk_.intraday_block_day); f.
b(risk_.intraday_cancel_pending);
808 hash_short_seed_plan(f, short_seed_);
809 hash_short_seed_plan(f, pending_short_seed_.plan);
810 f.
u(pending_short_seed_.expected_open_epoch); f.
b(pending_short_seed_.ready);
811 hash_native_handle(f, short_seed_long_candidate_);
812 f.
i(last_bar_dual_entry_path_); f.
i(last_bar_dual_entry_script_open_ms_);
813 f.
b(pending_view_.owner_ !=
nullptr);
814 f.
i(
static_cast<std::int64_t
>(
cap.attachment())); f.
i(
cap.configuration().limit);
815 f.
b(
cap.configuration().skip_noop_market); f.
b(
cap.configuration().defer_pooc_close);
816 f.
b(
cap.configuration().count_pooc_full_close);
819 if (
cap.active()) f.
u(
cap.declared());
820 const auto& cap_budget =
cap.budget();
821 f.
b(cap_budget.day().has_value());
822 if (cap_budget.day()) f.
i(cap_budget.day()->key);
823 f.
i(cap_budget.charged_slots()); f.
b(cap_budget.latched());
824 f.
b(cap_budget.transfer().has_value());
825 if (
const auto& transfer = cap_budget.transfer()) {
826 f.
i(transfer->day.key); f.
u(transfer->close_fill);
827 f.
i(transfer->source_bar); f.
u(transfer->inheritor);
829 f.
b(
cap.due_cause().has_value());
830 if (
const auto& due =
cap.due_cause()) {
831 f.
u(due->action_id); f.
i(due->charged_day.key); f.
i(due->charged_slots);
832 f.
i(due->trigger_bar); f.
u(due->trigger_order);
838 fold_admission_events();
840 f.
u(admission_events_folded_); f.
u(admission_events_digest_);
924 fold_consumed_digests();
927 const std::size_t consumed = std::min(
928 retained_n_,
static_cast<std::size_t
>(std::max(source_bar_count_, 0)));
929 f.
s(
"pineforge-pine-scheduler/v3");
930 f.
u(consumed); f.
u(consumed_bars_digest_);
931 f.
s(retained_.input_tf); f.
s(retained_.script_tf); f.
b(retained_.bar_magnifier);
932 f.
i(retained_.magnifier_samples); f.
i(
static_cast<std::int64_t
>(retained_.distribution));
933 f.
b(retained_.volume_weighted); f.
i(retained_.volume_weighted_min_samples);
934 f.
i(retained_.volume_weighted_max_samples); f.
b(retained_.is_stream); f.
i(retained_.warmup_n);
935 f.
b(retained_.simple_run);
936 f.
i(language_.pos_view_freeze_bar_); f.
i(
static_cast<std::int64_t
>(language_.pos_view_frozen_side_));
937 f.
d(language_.pos_view_frozen_qty_); hash_str_double_map(f, language_.pos_view_frozen_entry_qty_);
938 f.
b(language_._src_series_active_); hash_source_series(f, language_._src_open_);
939 hash_source_series(f, language_._src_high_); hash_source_series(f, language_._src_low_);
940 hash_source_series(f, language_._src_close_); hash_source_series(f, language_._src_volume_);
941 hash_source_series(f, language_._src_hl2_); hash_source_series(f, language_._src_hlc3_);
942 hash_source_series(f, language_._src_ohlc4_); hash_source_series(f, language_._src_hlcc4_);
943 f.
d(language_.prev_chart_close_); f.
d(language_.last_chart_close_); f.
i(language_.bar_index_offset_);
944 f.
b(language_.is_first_tick_); f.
b(language_.is_last_tick_); f.
b(language_.history_slot_is_new_);
945 f.
b(language_.coof_checkpoint_contains_current_bar_);
946 hash_source_series(f, language_.coof_checkpoint_src_open_);
947 hash_source_series(f, language_.coof_checkpoint_src_high_);
948 hash_source_series(f, language_.coof_checkpoint_src_low_);
949 hash_source_series(f, language_.coof_checkpoint_src_close_);
950 hash_source_series(f, language_.coof_checkpoint_src_volume_);
951 hash_source_series(f, language_.coof_checkpoint_src_hl2_);
952 hash_source_series(f, language_.coof_checkpoint_src_hlc3_);
953 hash_source_series(f, language_.coof_checkpoint_src_ohlc4_);
954 hash_source_series(f, language_.coof_checkpoint_src_hlcc4_);
955 f.
d(language_.coof_checkpoint_prev_chart_close_); f.
d(language_.coof_checkpoint_last_chart_close_);
956 f.
i(current_script_open_ms_);
957 f.
d(current_script_bar_.open); f.
d(current_script_bar_.high); f.
d(current_script_bar_.low);
958 f.
d(current_script_bar_.close); f.
d(current_script_bar_.volume); f.
i(current_script_bar_.timestamp);
959 f.
b(current_script_bar_valid_); f.
b(saw_open_fill_); f.
i(open_point_fills_); f.
i(source_bar_count_);
960 f.
b(expected_source_bars_ >= source_bar_count_);
961 f.
u(applied_cursor_); f.
i(coof_callback_script_open_);
962 f.
i(last_published_script_open_ms_);
963 f.
i(prior_input_script_open_ms_);
964 f.
i(awaiting_legacy_script_open_ms_);
965 f.
i(last_stream_input_open_ms_);
966 const std::size_t completion_prefix = std::min(input_script_size_, consumed);
967 f.
u(completion_prefix); f.
u(consumed_completes_digest_);
968 const std::size_t boundary_prefix = std::min(input_script_size_, consumed);
969 f.
u(boundary_prefix); f.
u(consumed_boundaries_digest_);
970 f.
b(uses_aux_security_feed_);
971 if (retained_.is_stream) f.
b(input_is_observed_ticks_);
972 if (retained_.is_stream) {
973 f.
u(confirmed_input_next_);
974 f.
u(confirmed_input_count_);
975 for (
const auto&
bar : confirmed_input_bars_) {
979 f.
u(confirmed_open_input_next_);
980 f.
u(confirmed_open_input_count_);
981 for (
const auto&
bar : confirmed_open_input_bars_) {
986 f.
d(deferred_boundary_input_.bar.open); f.
d(deferred_boundary_input_.bar.high);
987 f.
d(deferred_boundary_input_.bar.low); f.
d(deferred_boundary_input_.bar.close);
988 f.
d(deferred_boundary_input_.bar.volume); f.
i(deferred_boundary_input_.bar.timestamp);
989 f.
i(deferred_boundary_input_.next_input_ms);
990 f.
i(deferred_boundary_input_.prior_script_open_ms);
991 f.
b(deferred_boundary_input_.calling_bar_complete);
992 f.
b(deferred_boundary_input_.all_security_states);
993 f.
b(deferred_boundary_input_.active);