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_) {
470 if (!anchored_relative_legs_.empty() || anchored_relative_stats_.anchored != 0
471 || materializing_parent_.incarnation != 0) {
472 f.
s(
"pineforge-source-anchored-legs/v1");
473 f.
u(anchored_relative_stats_.anchored); f.
u(anchored_relative_stats_.adopted);
474 f.
u(anchored_relative_stats_.withdrawn); f.
u(materializing_parent_.incarnation);
475 f.
i(anchored_cohort_sequence_);
476 f.
u(anchored_relative_legs_.size());
477 for (
const auto& leg : anchored_relative_legs_) {
478 f.
s(leg.exit_id); f.
s(leg.from_entry); f.
u(
static_cast<std::uint64_t
>(leg.family));
479 f.
u(leg.handle.incarnation); f.
u(leg.parent.incarnation); f.
b(leg.parent_long);
480 f.
d(leg.operand_ticks); f.
d(leg.trail_offset);
481 hash_native_request(f, leg.request);
484 if (
const auto* anchor = std::get_if<native_order::FromOwnerFill>(
485 &leg.request.anchor)) {
486 f.
d(anchor->offset); f.
b(anchor->ticks);
487 f.
u(
static_cast<std::uint64_t
>(anchor->rounding));
489 f.
b(leg.armed); f.
d(leg.installed_level);
495 if (!per_entry_exits_.empty()) {
496 f.
s(
"pineforge-source-per-entry-exits/v1");
497 f.
u(per_entry_exits_.size());
498 for (
const auto&
exit : per_entry_exits_) {
501 f.
u(
exit.children.size());
502 for (
const auto& child :
exit.children) {
503 f.
u(child.origin); f.
d(child.fill_price); f.
d(child.units); f.
b(child.consumed);
507 f.
u(pending_coof_requests_.size());
508 for (
const auto& pending : pending_coof_requests_) {
509 hash_native_request(f, pending.request); hash_placement(f, pending.snapshot);
510 f.
s(pending.replacement_key); f.
b(pending.opening); f.
u(pending.family_key);
511 f.
b(pending.next_open);
513 f.
u(pending_margin_revivals_.size());
514 for (
const auto& pending : pending_margin_revivals_) {
515 hash_placement(f, pending.snapshot); f.
i(pending.decline_bar);
517 hash_native_handle_vector(f, live_handles_); hash_native_handle_vector(f, first_open_newborns_);
521 hash_native_handle_vector(f, live_handles_);
523 f.
u(dropped_close_count_); f.
u(dropped_close_digest_);
524 f.
u(open_entry_fees_.size());
525 for (
const auto& fee : open_entry_fees_) {
526 hash_native_handle(f, fee.opening); f.
s(fee.source_id); f.
d(fee.units);
527 f.
d(fee.nonpercent_fee);
530 const auto trade_prefix = host_
531 ? NativeExecutionConsumer::bound(*host_).closed_trade_prefix()
532 : NativeExecutionConsumer::ClosedTradePrefix{};
533 const std::size_t phase_end = trade_prefix.base + trade_exit_phase_.size();
534 const auto* phase_consumer = host_ ? &NativeExecutionConsumer::bound(*host_) :
nullptr;
536 if (phase_consumer && phase_consumer->exit_phases_restarted()) {
541 f.
h = phase_consumer->replay_sealed_exit_phases(f.
h);
542 for (
const auto phase : trade_exit_phase_) f.
u(phase);
544 if (exit_phase_final_ < trade_prefix.base)
546 "hashed exit-phase fold precedes the sealed prefix");
547 f.
u(exit_phase_final_); f.
u(exit_phase_digest_);
548 for (std::size_t index = exit_phase_final_; index < phase_end; ++index)
549 f.
u(trade_exit_phase_.at(index - trade_prefix.base));
553 if (exit_rank_keys_.size() >= 2 || exit_rank_peak_ > 13 || exit_rank_alt_peak_ > 13) {
554 f.
u(exit_rank_keys_.size()); f.
u(exit_rank_keys_digest_);
555 f.
u(exit_rank_peak_); f.
u(exit_rank_alt_peak_);
557 std::vector<std::uint64_t> current_debit_ordinals;
558 current_debit_ordinals.reserve(current_debited_applied_ordinals_.size());
559 for (
const auto ordinal : current_debited_applied_ordinals_) current_debit_ordinals.push_back(ordinal);
560 std::sort(current_debit_ordinals.begin(), current_debit_ordinals.end());
561 f.
u(current_debit_ordinals.size());
562 for (
const auto ordinal : current_debit_ordinals) f.
u(ordinal);
563 std::vector<std::uint64_t> intraday_relabel_ordinals;
564 intraday_relabel_ordinals.reserve(intraday_loss_relabel_ordinals_.size());
565 for (
const auto ordinal : intraday_loss_relabel_ordinals_)
566 intraday_relabel_ordinals.push_back(ordinal);
567 std::sort(intraday_relabel_ordinals.begin(), intraday_relabel_ordinals.end());
568 f.
u(intraday_relabel_ordinals.size());
569 for (
const auto ordinal : intraday_relabel_ordinals) f.
u(ordinal);
570 consumed_partial_exit_cycles_.fold_sorted(f);
571 std::vector<std::uint64_t> shadowed_openings(
572 bracket_shadowed_openings_.begin(), bracket_shadowed_openings_.end());
573 std::sort(shadowed_openings.begin(), shadowed_openings.end());
574 f.
u(shadowed_openings.size());
575 for (
const auto opening : shadowed_openings) f.
u(opening);
576 std::vector<std::string> named_cancel_keys;
577 named_cancel_keys.reserve(named_entry_cancel_tokens_.size());
578 for (
const auto& row : named_entry_cancel_tokens_) named_cancel_keys.push_back(row.first);
579 std::sort(named_cancel_keys.begin(), named_cancel_keys.end());
580 f.
u(named_cancel_keys.size());
581 for (
const auto& key : named_cancel_keys) {
582 const auto& token = named_entry_cancel_tokens_.at(key);
583 f.
s(key); f.
u(token.entry_incarnation); f.
u(token.surviving_exit_incarnation);
587 if (!id_bound_exits_.empty()) {
589 f.
u(id_bound_exits_.size());
590 for (
const auto& row : id_bound_exits_) {
591 f.
s(row.exit_id); f.
s(row.from_entry);
592 f.
d(row.levels.limit); f.
d(row.levels.stop); f.
d(row.levels.trail_points);
593 f.
d(row.levels.trail_offset); f.
d(row.levels.trail_price);
594 f.
d(row.levels.profit_ticks); f.
d(row.levels.loss_ticks);
595 f.
d(row.qty_percent); f.
d(row.qty); f.
s(row.comment); f.
s(row.oca_name);
598 f.
u(close_logical_units_.size());
599 for (
const auto& row : close_logical_units_) { f.
s(row.first); f.
d(row.second); }
603 if (close_ledger_records_.size() > 1) {
604 f.
u(close_ledger_records_.size());
605 for (
const auto& record : close_ledger_records_) { f.
s(record.id); f.
d(record.units); }
609 if (!pyramiding_records_.empty()) {
610 f.
s(
"pineforge-pyramiding-records/v1");
611 f.
u(pyramiding_records_.size());
612 for (
const auto& record : pyramiding_records_) {
613 f.
s(record.id); f.
u(record.incarnation); f.
d(record.units);
617 if (!exit_tombstones_.empty()) {
618 std::vector<SourceId> keys;
619 keys.reserve(exit_tombstones_.size());
620 for (
const auto& row : exit_tombstones_) keys.push_back(row.first);
621 std::sort(keys.begin(), keys.end());
622 f.
s(
"pineforge-exit-tombstones/v1");
624 for (
const auto& key : keys) { f.
s(key); f.
u(exit_tombstones_.at(key)); }
628 f.
u(0); f.
u(0); f.
u(0); f.
u(0);
629 f.
u(close_batch_callsites_.size());
630 for (
const auto& row : close_batch_callsites_) {
631 const auto& site = row.second;
632 f.
u(row.first); f.
b(site.active); f.
u(site.token); f.
i(site.calls);
633 f.
s(site.first_id); f.
s(site.id); f.
s(site.comment);
634 f.
d(site.target); f.
u(site.queue_sequence);
636 f.
i(close_batch_bar_); f.
u(close_batch_queue_sequence_);
637 f.
d(close_batch_pending_debt_); f.
d(close_batch_admitted_total_);
638 f.
u(receipt_cursor_);
639 f.
u(last_applied_ordinal_);
640 f.
u(terminal_receipt_cursor_);
641 f.
i(entry_attempt_bar_); f.
u(entry_attempts_on_bar_);
642 f.
b(materializing_relative_);
643 f.
i(current_position_cycle_);
644 f.
i(current_position_sign_);
645 f.
u(next_sequential_group_);
646 f.
b(source_batch_mutated_);
647 f.
b(coof_recalc_active_); f.
b(coof_first_open_);
648 if (coof_open_stop_next_waypoint_) f.
u(0x6f70656e6e657874ULL);
649 f.
u(coof_market_entry_recalc_incarnation_);
650 f.
u(coof_market_entry_recalc_fill_seq_); f.
u(coof_current_fill_seq_);
653 if (coof_recalc_active_) f.
d(coof_fill_cursor_t_);
654 if (coof_recalc_active_ && !std::isnan(coof_fill_target_print_)) {
655 f.
u(0x7761797466ULL); f.
d(coof_fill_target_print_);
657 if (coof_recalc_active_) f.
b(coof_fill_forced_);
658 const auto& coof_coord = coof_context_.coordinate;
659 f.
u(coof_coord.ordinal); f.
i(coof_coord.interval_index); f.
i(coof_coord.open_ms);
660 f.
i(coof_coord.eligible_open_ms); f.
i(coof_coord.last_traded_close_ms);
661 f.
i(coof_coord.next_period_open_ms); f.
i(coof_coord.next_input_open_ms);
662 f.
i(coof_coord.effective_time_ms); f.
i(coof_coord.source_price_time_ms);
663 f.
i(
static_cast<std::int64_t
>(coof_coord.provenance));
664 f.
i(
static_cast<std::int64_t
>(coof_coord.path_phase));
665 f.
i(
static_cast<std::int64_t
>(coof_coord.completion)); f.
i(coof_context_.decision_floor_ms);
667 f.
i(interval.open_ms); f.
i(interval.eligible_open_ms); f.
i(interval.last_traded_close_ms);
668 f.
i(interval.next_period_open_ms); f.
i(interval.next_input_open_ms);
670 hash_coof_interval(coof_context_.input_interval);
671 hash_coof_interval(coof_context_.script_interval);
672 f.
i(coof_context_.sub_index); f.
i(coof_context_.sub_count);
673 f.
b(coof_context_.is_terminal_sub_bar); f.
i(coof_context_.sub_bar_open_ms);
674 f.
i(coof_context_.script_bar_open_ms);
675 f.
b(coof_context_.driver_statistics.intrabar_path_enabled);
676 f.
i(coof_context_.driver_statistics.sub_bars_per_script_bar);
677 f.
i(coof_context_.driver_statistics.samples_per_sub_bar);
678 f.
u(coof_context_.driver_statistics.sub_bars_processed);
679 f.
u(coof_context_.driver_statistics.sample_ticks_processed);
680 f.
d(coof_script_bar_.open); f.
d(coof_script_bar_.high); f.
d(coof_script_bar_.low);
681 f.
d(coof_script_bar_.close); f.
d(coof_script_bar_.volume); f.
i(coof_script_bar_.timestamp);
682 f.
b(coof_script_bar_valid_);
684 f.
u(pooc_close_basis_count_); f.
i(pooc_close_basis_last_bar_); f.
u(pooc_close_basis_digest_);
685 f.
d(pooc_open_basis_); f.
i(pooc_open_script_bar_); f.
i(close_all_pending_script_bar_);
686 f.
d(last_fx_rate_); f.
i(position_open_script_bar_); f.
u(position_open_epoch_); f.
i(position_open_bar_index_);
687 f.
u(
static_cast<std::uint64_t
>(position_open_phase_));
688 f.
b(position_open_priced_);
689 f.
i(last_margin_call_script_bar_); f.
i(pooc_close_checkpoint_deferred_ms_);
692 if (close_margin_open_bar_ != std::numeric_limits<std::int64_t>::min())
693 f.
i(close_margin_open_bar_);
698 if (owed_follow_up_bar_ != std::numeric_limits<std::int64_t>::min()) {
699 f.
s(
"pineforge-owed-follow-up/v1");
700 f.
i(owed_follow_up_bar_); f.
i(owed_follow_up_point_); f.
d(owed_follow_up_units_);
702 if (close_call_after_script_bar_ != std::numeric_limits<std::int64_t>::min()) {
703 f.
s(
"pineforge-close-call-after-script/v1");
704 f.
i(close_call_after_script_bar_); f.
d(close_call_after_script_book_);
705 f.
d(close_call_after_script_units_);
710 if (open_exit_first_bar_ != std::numeric_limits<std::int64_t>::min()) {
711 f.
s(
"pineforge-open-exit-first/v1");
712 f.
i(open_exit_first_bar_); f.
u(open_exit_first_origin_); f.
s(open_exit_first_id_);
713 f.
d(open_exit_first_fill_);
718 if (close_first_script_bar_ != std::numeric_limits<std::int64_t>::min()) {
719 f.
s(
"pineforge-close-first/v1");
720 f.
i(close_first_script_bar_); f.
i(close_first_side_);
722 f.
u(last_margin_call_event_ordinal_);
723 f.
u(last_margin_call_entry_incarnation_); f.
i(last_margin_call_position_cycle_);
724 f.
b(last_margin_call_at_script_close_);
725 f.
d(last_margin_call_closed_units_); f.
d(last_margin_call_remaining_units_);
733 if (
const auto* pine = pine_view_of(host_)) {
736 const std::uint64_t count = pine->closed_trade_count();
737 const bool restart = count < source_money_folded_;
738 if (count < trade_prefix.base)
740 "hashed source-money rewind precedes the sealed prefix");
741 double gains = restart ? trade_prefix.source_gains : source_gains_;
742 double losses = restart ? trade_prefix.source_losses : source_losses_;
743 for (std::uint64_t index = restart ? trade_prefix.base : source_money_folded_;
744 index < count; ++index) {
745 const double profit = pine->closed_trade(index).pnl;
746 if (profit > 0.0) gains += profit;
747 else losses += profit;
749 const double mirrored = gains + losses;
750 const double engine_net = pine->net_profit_sum_;
751 if (count != 0 && std::memcmp(&mirrored, &engine_net,
sizeof(
double)) != 0) {
752 f.
d(gains); f.
d(losses); f.
u(count);
756 f.
i(signal_close_mc_event_bar_);
757 f.
i(signal_close_mc_position_cycle_); f.
u(signal_close_mc_entry_incarnation_);
758 f.
u(signal_close_mc_fill_seq_); f.
d(signal_close_mc_before_qty_);
759 f.
d(signal_close_mc_remaining_qty_); f.
i(risk_coof_direct_script_bar_);
760 f.
u(cap_latest_fill_);
761 f.
b(source_margin_call_enabled_);
762 f.
d(policy_script_bar_.open); f.
d(policy_script_bar_.high);
763 f.
d(policy_script_bar_.low); f.
d(policy_script_bar_.close);
764 f.
d(policy_script_bar_.volume); f.
i(policy_script_bar_.timestamp);
765 f.
b(policy_script_bar_valid_);
770 std::vector<std::uint64_t> market_add_keys(market_pyramid_adds_.begin(),
771 market_pyramid_adds_.end());
772 std::sort(market_add_keys.begin(), market_add_keys.end());
773 f.
u(market_add_keys.size());
774 for (
const auto key : market_add_keys) f.
u(key);
775 std::vector<std::uint64_t> trail_open_keys;
776 trail_open_keys.reserve(trail_state_at_open_.size());
777 for (
const auto& row : trail_state_at_open_) trail_open_keys.push_back(row.first);
778 std::sort(trail_open_keys.begin(), trail_open_keys.end());
779 f.
u(trail_open_keys.size());
780 for (
const auto key : trail_open_keys) {
781 const auto& state = trail_state_at_open_.at(key);
782 f.
u(key); f.
b(state.activated); f.
d(state.best_price);
783 f.
d(state.current_level); f.
u(state.activation_ordinal);
788 if (!carried_trail_retunes_.empty()) {
789 f.
u(carried_trail_retunes_.size());
790 for (
const auto& [handle, distance] : carried_trail_retunes_) {
791 f.
u(handle.incarnation); f.
d(distance);
795 f.
i(day_ledger_.current_day); f.
i(day_ledger_.last_loss_day); f.
i(day_ledger_.consecutive_loss_days);
796 f.
i(day_ledger_.intraday_loss_day); f.
d(day_ledger_.intraday_start_equity);
797 f.
d(day_ledger_.intraday_realized); f.
u(day_ledger_.observed_applied_ordinal);
800 if (risk_.max_intraday_loss > 0.0) f.
i(day_ledger_.intraday_start_script_bar);
801 f.
i(risk_.direction); f.
i(risk_.max_cons_loss_days); f.
d(risk_.max_drawdown);
802 f.
b(risk_.max_drawdown_percent); f.
d(risk_.max_intraday_loss);
803 f.
b(risk_.max_intraday_loss_percent); f.
d(risk_.max_position_size); f.
b(risk_.halted);
804 f.
d(risk_.observed_peak_equity); f.
d(risk_.observed_max_drawdown);
805 f.
i(risk_.intraday_block_day); f.
b(risk_.intraday_cancel_pending);
806 hash_short_seed_plan(f, short_seed_);
807 hash_short_seed_plan(f, pending_short_seed_.plan);
808 f.
u(pending_short_seed_.expected_open_epoch); f.
b(pending_short_seed_.ready);
809 hash_native_handle(f, short_seed_long_candidate_);
810 f.
i(last_bar_dual_entry_path_); f.
i(last_bar_dual_entry_script_open_ms_);
811 f.
b(pending_view_.owner_ !=
nullptr);
812 f.
i(
static_cast<std::int64_t
>(
cap.attachment())); f.
i(
cap.configuration().limit);
813 f.
b(
cap.configuration().skip_noop_market); f.
b(
cap.configuration().defer_pooc_close);
814 f.
b(
cap.configuration().count_pooc_full_close);
817 if (
cap.active()) f.
u(
cap.declared());
818 const auto& cap_budget =
cap.budget();
819 f.
b(cap_budget.day().has_value());
820 if (cap_budget.day()) f.
i(cap_budget.day()->key);
821 f.
i(cap_budget.charged_slots()); f.
b(cap_budget.latched());
822 f.
b(cap_budget.transfer().has_value());
823 if (
const auto& transfer = cap_budget.transfer()) {
824 f.
i(transfer->day.key); f.
u(transfer->close_fill);
825 f.
i(transfer->source_bar); f.
u(transfer->inheritor);
827 f.
b(
cap.due_cause().has_value());
828 if (
const auto& due =
cap.due_cause()) {
829 f.
u(due->action_id); f.
i(due->charged_day.key); f.
i(due->charged_slots);
830 f.
i(due->trigger_bar); f.
u(due->trigger_order);
836 fold_admission_events();
838 f.
u(admission_events_folded_); f.
u(admission_events_digest_);
922 fold_consumed_digests();
925 const std::size_t consumed = std::min(
926 retained_n_,
static_cast<std::size_t
>(std::max(source_bar_count_, 0)));
927 f.
s(
"pineforge-pine-scheduler/v3");
928 f.
u(consumed); f.
u(consumed_bars_digest_);
929 f.
s(retained_.input_tf); f.
s(retained_.script_tf); f.
b(retained_.bar_magnifier);
930 f.
i(retained_.magnifier_samples); f.
i(
static_cast<std::int64_t
>(retained_.distribution));
931 f.
b(retained_.volume_weighted); f.
i(retained_.volume_weighted_min_samples);
932 f.
i(retained_.volume_weighted_max_samples); f.
b(retained_.is_stream); f.
i(retained_.warmup_n);
933 f.
b(retained_.simple_run);
934 f.
i(language_.pos_view_freeze_bar_); f.
i(
static_cast<std::int64_t
>(language_.pos_view_frozen_side_));
935 f.
d(language_.pos_view_frozen_qty_); hash_str_double_map(f, language_.pos_view_frozen_entry_qty_);
936 f.
b(language_._src_series_active_); hash_source_series(f, language_._src_open_);
937 hash_source_series(f, language_._src_high_); hash_source_series(f, language_._src_low_);
938 hash_source_series(f, language_._src_close_); hash_source_series(f, language_._src_volume_);
939 hash_source_series(f, language_._src_hl2_); hash_source_series(f, language_._src_hlc3_);
940 hash_source_series(f, language_._src_ohlc4_); hash_source_series(f, language_._src_hlcc4_);
941 f.
d(language_.prev_chart_close_); f.
d(language_.last_chart_close_); f.
i(language_.bar_index_offset_);
942 f.
b(language_.is_first_tick_); f.
b(language_.is_last_tick_); f.
b(language_.history_slot_is_new_);
943 f.
b(language_.coof_checkpoint_contains_current_bar_);
944 hash_source_series(f, language_.coof_checkpoint_src_open_);
945 hash_source_series(f, language_.coof_checkpoint_src_high_);
946 hash_source_series(f, language_.coof_checkpoint_src_low_);
947 hash_source_series(f, language_.coof_checkpoint_src_close_);
948 hash_source_series(f, language_.coof_checkpoint_src_volume_);
949 hash_source_series(f, language_.coof_checkpoint_src_hl2_);
950 hash_source_series(f, language_.coof_checkpoint_src_hlc3_);
951 hash_source_series(f, language_.coof_checkpoint_src_ohlc4_);
952 hash_source_series(f, language_.coof_checkpoint_src_hlcc4_);
953 f.
d(language_.coof_checkpoint_prev_chart_close_); f.
d(language_.coof_checkpoint_last_chart_close_);
954 f.
i(current_script_open_ms_);
955 f.
d(current_script_bar_.open); f.
d(current_script_bar_.high); f.
d(current_script_bar_.low);
956 f.
d(current_script_bar_.close); f.
d(current_script_bar_.volume); f.
i(current_script_bar_.timestamp);
957 f.
b(current_script_bar_valid_); f.
b(saw_open_fill_); f.
i(open_point_fills_); f.
i(source_bar_count_);
958 f.
b(expected_source_bars_ >= source_bar_count_);
959 f.
u(applied_cursor_); f.
i(coof_callback_script_open_);
960 f.
i(last_published_script_open_ms_);
961 f.
i(prior_input_script_open_ms_);
962 f.
i(awaiting_legacy_script_open_ms_);
963 f.
i(last_stream_input_open_ms_);
964 const std::size_t completion_prefix = std::min(input_script_size_, consumed);
965 f.
u(completion_prefix); f.
u(consumed_completes_digest_);
966 const std::size_t boundary_prefix = std::min(input_script_size_, consumed);
967 f.
u(boundary_prefix); f.
u(consumed_boundaries_digest_);
968 f.
b(uses_aux_security_feed_);
969 if (retained_.is_stream) f.
b(input_is_observed_ticks_);
970 if (retained_.is_stream) {
971 f.
u(confirmed_input_next_);
972 f.
u(confirmed_input_count_);
973 for (
const auto&
bar : confirmed_input_bars_) {
977 f.
u(confirmed_open_input_next_);
978 f.
u(confirmed_open_input_count_);
979 for (
const auto&
bar : confirmed_open_input_bars_) {
984 f.
d(deferred_boundary_input_.bar.open); f.
d(deferred_boundary_input_.bar.high);
985 f.
d(deferred_boundary_input_.bar.low); f.
d(deferred_boundary_input_.bar.close);
986 f.
d(deferred_boundary_input_.bar.volume); f.
i(deferred_boundary_input_.bar.timestamp);
987 f.
i(deferred_boundary_input_.next_input_ms);
988 f.
i(deferred_boundary_input_.prior_script_open_ms);
989 f.
b(deferred_boundary_input_.calling_bar_complete);
990 f.
b(deferred_boundary_input_.all_security_states);
991 f.
b(deferred_boundary_input_.active);