PineForge unreleased
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
pine_cohort_exposure.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <cstdint>
5#include <unordered_map>
6
7namespace pineforge::source {
8class OriginRoster;
9
10namespace detail {
11
12constexpr std::size_t kCohortFoldStack = 128;
13
15 double total;
16 std::uint64_t steps;
17 std::uint8_t path; // 0: empty, 1: roster walk, 2: sort, 3: overflow fallback.
18};
19
20// Allocation-free, acceptance-ordered fold. Diagnostic work is returned to
21// the adapter wrapper so observations keep their adapter and run identity.
23 const OriginRoster& origins,
24 const std::unordered_map<std::uint64_t, double>& live_units_by_origin) noexcept;
25
26#ifdef PINEFORGE_COHORT_EXPOSURE_FIXTURES
27// Abort on any bit mismatch against the frozen position selector.
28void verify_cohort_exposure(
29 const OriginRoster& origins,
30 const std::unordered_map<std::uint64_t, double>& live_units_by_origin,
31 double actual) noexcept;
32#endif
33
34} // namespace detail
35} // namespace pineforge::source
constexpr std::size_t kCohortFoldStack
CohortExposureFold fold_cohort_exposure(const OriginRoster &origins, const std::unordered_map< std::uint64_t, double > &live_units_by_origin) noexcept