Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
5928e32
Freeze the v16 providers and capture the legacy-route oracle tests fo…
luisleo526 Sep 14, 2026
e5f5e20
Add the generic cohort owner, intrabar path, pre-open hook and pre-be…
luisleo526 Sep 14, 2026
bd90407
Represent undetected timeframes explicitly in the native run spec for…
luisleo526 Sep 14, 2026
ab7f13f
Carry the rich SymInfo and every legacy-consumed begin argument into …
luisleo526 Sep 14, 2026
f2ca059
Add the Pine execution adapter and native-hook scheduler on a fixture…
luisleo526 Sep 14, 2026
a29b6ae
Add a legacy-tolerant slot-label policy to the native begin preflight…
luisleo526 Sep 14, 2026
8024df5
Add the Pine execution adapter and native-hook scheduler on a fixture…
luisleo526 Sep 14, 2026
8db0f76
Add the Pine execution adapter and native-hook scheduler on a fixture…
luisleo526 Sep 14, 2026
4dcd792
Add the Pine execution adapter and native-hook scheduler on a fixture…
luisleo526 Sep 14, 2026
f17f77e
Add the Pine execution adapter and native-hook scheduler on a fixture…
luisleo526 Sep 14, 2026
3b73e6e
Allow staged configuration between runs and add distribution-sampled …
luisleo526 Sep 14, 2026
a1dc251
Add the Pine execution adapter and native-hook scheduler on a fixture…
luisleo526 Sep 14, 2026
5bbf841
Add the Pine execution adapter and native-hook scheduler on a fixture…
luisleo526 Sep 14, 2026
6d09ef7
Add the Pine execution adapter and native-hook scheduler on a fixture…
luisleo526 Sep 14, 2026
8eb4212
Add the Pine execution adapter and native-hook scheduler on a fixture…
luisleo526 Sep 14, 2026
b2b2244
Add the Pine execution adapter and native-hook scheduler on a fixture…
luisleo526 Sep 14, 2026
059ddbe
Add the Pine execution adapter and native-hook scheduler on a fixture…
luisleo526 Sep 14, 2026
0409468
Add the Pine execution adapter and native-hook scheduler on a fixture…
luisleo526 Sep 14, 2026
fcd7a3b
Synthesize the intrabar sample path from each script bar when no lowe…
luisleo526 Sep 15, 2026
4ad7b4b
Add the Pine execution adapter and native-hook scheduler on a fixture…
luisleo526 Sep 15, 2026
2281ee9
Activate resting requests at sampled points that cross their level an…
luisleo526 Sep 15, 2026
7024f0a
Switch the Pine strategy host onto the native execution kernel throug…
luisleo526 Sep 15, 2026
a980f70
WIP: copy request handles before retiring adapter placements and re-r…
luisleo526 Sep 15, 2026
d23f50d
Feed the generic security, timeframe and index sequence from the nati…
luisleo526 Sep 15, 2026
d1a0862
Delete the legacy Pine execution loop, pending book and seams now unr…
luisleo526 Sep 15, 2026
c71699f
Expose the generated source-series surface from the scheduler-owned l…
luisleo526 Sep 15, 2026
9ac8ed9
WIP: L4a risk/cap/margin/day-key policies and native twins (R4-D L4a)
luisleo526 Sep 15, 2026
3ab7a1f
Restore the executing ABI rejection pairs, the oracle carriers and th…
luisleo526 Sep 15, 2026
ef10025
Drive the order-priority, exit-leg lifecycle, order-birth and reserva…
luisleo526 Sep 15, 2026
a014f90
WIP: materialize the 39 ab9714be L4c twins (R4-D L4c-fix)
luisleo526 Sep 15, 2026
a681d2c
Lower the ShortSeed qualification, affordability, direction, sizing a…
luisleo526 Sep 15, 2026
c750d6a
Lower the Pine risk, intraday-cap, margin-call and chart-day policies…
luisleo526 Sep 15, 2026
abe6a05
Route auxiliary request.security feeds and reproduce the legacy magni…
luisleo526 Sep 15, 2026
b9e0f5c
Restore the legacy trade-export provenance and repair the native sett…
luisleo526 Sep 15, 2026
35727cc
Restore the removed mirror, hash, admission and state tests as CHECK-…
luisleo526 Sep 15, 2026
96176c3
Restore the removed ShortSeed, affordability, sizing and deferred-clo…
luisleo526 Sep 15, 2026
b404dd1
Restore the removed order, lifecycle, trail and COOF tests as CHECK-p…
luisleo526 Sep 15, 2026
d6b38ad
Merge branch 'refactor/adapter-lowering-20260914-fix' into refactor/a…
luisleo526 Sep 15, 2026
a4708cf
Merge branch 'refactor/adapter-lowering-20260914-l4b' into refactor/a…
luisleo526 Sep 15, 2026
33116e1
Merge branch 'refactor/adapter-lowering-20260914-l4c' into refactor/a…
luisleo526 Sep 15, 2026
67d2774
Merge branch 'refactor/adapter-lowering-20260914-l4e' into refactor/a…
luisleo526 Sep 15, 2026
c814e99
Merge branch 'refactor/adapter-lowering-20260914-l4f' into refactor/a…
luisleo526 Sep 15, 2026
d2e4a9b
Carry the inspected commission ticket into settlement install and set…
luisleo526 Sep 15, 2026
c1beecb
Remove the per-bar overhead of the switched Pine route so corpus runs…
luisleo526 Sep 15, 2026
a2da477
Merge commit 'd2e4a9b638ed09bf085dafd50ddfcacc0551e27d' into refactor…
luisleo526 Sep 15, 2026
a227963
Complete the magnifier sampled-path and tick price policies on the na…
luisleo526 Sep 15, 2026
064dde5
Merge branch 'refactor/adapter-lowering-20260914-l4g' into refactor/a…
luisleo526 Sep 15, 2026
9e059b3
Merge branch 'refactor/adapter-lowering-20260914-l4h' into refactor/a…
luisleo526 Sep 15, 2026
77a4e7e
Let within-bar births match the remaining bar path and expose generic…
luisleo526 Sep 15, 2026
f67c991
Complete the risk, intraday-cap, margin-call and chart-day policies o…
luisleo526 Sep 15, 2026
e2ac4ed
Merge branch 'refactor/adapter-lowering-20260914-l5k' into refactor/a…
luisleo526 Sep 15, 2026
2fc3a98
Merge branch 'refactor/adapter-lowering-20260914-l5f' into refactor/a…
luisleo526 Sep 15, 2026
f075cbc
Consult the host precommit before generic margin admission and tolera…
luisleo526 Sep 15, 2026
139b031
Complete the order-priority, exit-leg lifecycle, trail, COOF and OCA …
luisleo526 Sep 15, 2026
bdfe319
Merge branch 'refactor/adapter-lowering-20260914-l5m' into refactor/a…
luisleo526 Sep 15, 2026
ac35c18
Merge branch 'refactor/adapter-lowering-20260914-l5a' into refactor/a…
luisleo526 Sep 15, 2026
fa32aed
Complete the sizing, money, ShortSeed, affordability and deferred-clo…
luisleo526 Sep 15, 2026
06ec2ea
Merge branch 'refactor/adapter-lowering-20260914-l5c' into refactor/a…
luisleo526 Sep 15, 2026
5ad3913
Add the generic path-order mode and explicit-units grid policy to the…
luisleo526 Sep 15, 2026
fa99468
Accept a zero price tick as an unquantized native run (R4-D L5o)
luisleo526 Sep 15, 2026
b2aac0d
Merge branch 'refactor/adapter-lowering-20260914-l5b' into refactor/a…
luisleo526 Sep 15, 2026
2769564
Merge branch 'refactor/adapter-lowering-20260914-l5n' into refactor/a…
luisleo526 Sep 15, 2026
ff65ec0
Merge branch 'refactor/adapter-lowering-20260914-l5o' into refactor/a…
luisleo526 Sep 15, 2026
1ca1bf2
Finish the risk, intraday-cap, margin, stream-preflight and verificat…
luisleo526 Sep 16, 2026
85c8450
Finish the magnifier sampled-path, tick price and security routing po…
luisleo526 Sep 16, 2026
99ec10e
Finish the sizing, money, ShortSeed, affordability and deferred-close…
luisleo526 Sep 16, 2026
b77b6fb
Merge branch 'refactor/adapter-lowering-20260914-l6a' into refactor/a…
luisleo526 Sep 16, 2026
4543bd7
Merge branch 'refactor/adapter-lowering-20260914-l6b' into refactor/a…
luisleo526 Sep 16, 2026
1ef64b0
Merge branch 'refactor/adapter-lowering-20260914-l6f' into refactor/a…
luisleo526 Sep 16, 2026
c4004dc
Finish the order-priority, exit-leg lifecycle, trail, COOF, OCA and i…
luisleo526 Sep 16, 2026
81449ac
Merge branch 'refactor/adapter-lowering-20260914-l6c' into refactor/a…
luisleo526 Sep 16, 2026
04924fc
Guard the tzdata resource-path checks against an empty descriptor (R4…
luisleo526 Sep 16, 2026
c1a9a98
Report the receipt-consuming ABI checks as skipped when their prepare…
luisleo526 Sep 16, 2026
16e4e81
Merge branch 'agent/trial-qwen-cal' into refactor/adapter-lowering-20…
luisleo526 Sep 16, 2026
6becce2
Merge branch 'agent/trial-qwen-abi' into refactor/adapter-lowering-20…
luisleo526 Sep 16, 2026
0e0b1a9
Finish the cross-lane regression and residual policies on the native …
luisleo526 Sep 16, 2026
8174fb8
Merge branch 'refactor/adapter-lowering-20260914-l7r' into refactor/a…
luisleo526 Sep 16, 2026
165105e
Name the warmup stage in native stream preflight refusals (R4-D follo…
luisleo526 Sep 16, 2026
8e907c4
Retire the l4-pending test label now that every restored twin passes …
luisleo526 Sep 16, 2026
b07eeb8
Merge branch 'agent/trial-warmup-diag' into agent/trial-runner-diag
luisleo526 Sep 16, 2026
1f9f80d
Expect the native stream preflight refusal for a misaligned warmup in…
luisleo526 Sep 16, 2026
e264595
Merge branch 'agent/trial-warmup-diag' into refactor/adapter-lowering…
luisleo526 Sep 16, 2026
1c0524d
Merge branch 'agent/trial-qwen-labels' into refactor/adapter-lowering…
luisleo526 Sep 16, 2026
ff8eb78
Merge branch 'agent/trial-runner-diag' into refactor/adapter-lowering…
luisleo526 Sep 16, 2026
1d0454f
Publish iterator traits on PlacementTable::Iterator so the source ada…
luisleo526 Sep 16, 2026
bf470dc
Guard the timezone identity checks against absent legacy tzdata links…
luisleo526 Sep 16, 2026
8086fc2
Merge branch 'refactor/adapter-lowering-20260914-l8e' into refactor/a…
luisleo526 Sep 16, 2026
ee7817f
Restore the legacy exit-leg activation, trail tick snapping, reservat…
luisleo526 Sep 16, 2026
87b77dd
Fold the drawdown once per script bar and scope the risk latch, cap f…
luisleo526 Sep 16, 2026
ce3a09d
Make the twin-parity, hash-coverage, mirror and ABI checkers CI-runna…
luisleo526 Sep 16, 2026
a5deb37
Guard ShortSeed as the legacy owner did, make adapter ordering determ…
luisleo526 Sep 16, 2026
111de43
Publish iterator traits on PlacementTable::Iterator so the source ada…
luisleo526 Sep 16, 2026
a06df6a
Remove the per-bar overhead of the switched Pine route so the replay …
luisleo526 Sep 16, 2026
4d2d2c3
Set the slice-C relative runtime ceiling at 10x of ab9714be (A40 rev 2)
luisleo526 Sep 16, 2026
7b207bd
Make the folded continuation hash reuse-invariant and settle the sour…
luisleo526 Sep 16, 2026
7024426
Merge branch 'refactor/adapter-lowering-20260914-l8c' into refactor/a…
luisleo526 Sep 16, 2026
cc93baf
Merge branch 'refactor/adapter-lowering-20260914-l8g' into refactor/a…
luisleo526 Sep 16, 2026
80d710e
Merge branch 'refactor/adapter-lowering-20260914-l8b' into refactor/a…
luisleo526 Sep 16, 2026
2a4dbfc
Restore the legacy C-ABI setter acceptance and refusal order and drop…
luisleo526 Sep 16, 2026
89716b6
Merge branch 'refactor/adapter-lowering-20260914-l8a' into refactor/a…
luisleo526 Sep 16, 2026
ae463df
Merge branch 'refactor/adapter-lowering-20260914-l8h' into refactor/a…
luisleo526 Sep 16, 2026
004a047
Merge branch 'refactor/adapter-lowering-20260914-l8d' into refactor/a…
luisleo526 Sep 16, 2026
1cccdb3
Clear the L8d integration tripwires and restore the competing-entry m…
luisleo526 Sep 16, 2026
6a026da
Merge branch 'refactor/adapter-lowering-20260914-l8f' into refactor/a…
luisleo526 Sep 16, 2026
11f6e54
Refresh the twin-parity fixtures and the mirror mutation controls for…
luisleo526 Sep 16, 2026
00f56c1
Give ci_preflight's verifier self-tests a 900 s budget on hosted runn…
luisleo526 Sep 16, 2026
f5aeb02
Set the slice-C relative runtime ceiling at 12x of ab9714be (A40 rev 3)
luisleo526 Sep 16, 2026
3286845
Measure the relative runtime witness as the best of five interleaved …
luisleo526 Sep 16, 2026
0b49d97
Restore the overflow refusal on the tolerant preflight branch, drop a…
luisleo526 Sep 16, 2026
479086d
Run the relative runtime witness in candidate-only mode on the hosted…
luisleo526 Sep 16, 2026
854f7f8
Ignore transient guard scratch dirs when the mirror mutation test cop…
luisleo526 Sep 16, 2026
23a31c8
Refuse the carried-POOC-short margin checkpoint while a competing pen…
luisleo526 Sep 16, 2026
3d6fa8a
Merge branch 'refactor/adapter-lowering-20260914-l9a' into refactor/a…
luisleo526 Sep 16, 2026
e12a0b7
Restore the legacy C-ABI setter tolerance after the first realtime ti…
luisleo526 Sep 16, 2026
7c0470a
Merge branch 'refactor/adapter-lowering-20260914-l9c' into refactor/a…
luisleo526 Sep 16, 2026
54e8aad
Name the in-run setter tolerance flag by what it does, not by which h…
luisleo526 Sep 16, 2026
894e01e
Free the recycled Prepared-envelope blocks when the thread-local scra…
luisleo526 Sep 16, 2026
7b4534e
Replace the nothrow allocation forms too in the pending-mirror alloca…
luisleo526 Sep 16, 2026
ba4a13d
Order opposite marketable stop entries at the open as the legacy owne…
luisleo526 Sep 16, 2026
aaa2c3a
Merge branch 'refactor/adapter-lowering-20260914-l9b' into refactor/a…
luisleo526 Sep 16, 2026
131c295
Keep untouched resting stops and throttle same-bar reopens in the ope…
luisleo526 Sep 16, 2026
a82a9d9
Merge branch 'refactor/adapter-lowering-20260914-l9d' into refactor/a…
luisleo526 Sep 16, 2026
16ee685
Apply the opposing-stop deferral and the priced-entry throttle at the…
luisleo526 Sep 16, 2026
8e15ddb
Evaluate a filled parent's same-bar exits on the entry bar beside sib…
luisleo526 Sep 16, 2026
cbfbbb3
Merge branch 'refactor/adapter-lowering-20260914-l9f' into refactor/a…
luisleo526 Sep 16, 2026
ae05760
Merge branch 'refactor/adapter-lowering-20260914-l9g' into refactor/a…
luisleo526 Sep 16, 2026
95749a1
Lower a 0.0 limit/stop price as a present level and let the kernel ac…
luisleo526 Sep 16, 2026
890da75
Merge branch 'refactor/adapter-lowering-20260914-l9e' into refactor/a…
luisleo526 Sep 16, 2026
8d8dfe8
Sample the open lots' full-bar excursion before a margin-call liquida…
luisleo526 Sep 16, 2026
046b7b4
Merge branch 'refactor/adapter-lowering-20260914-l10b' into refactor/…
luisleo526 Sep 16, 2026
f8b962d
Book a same-pass opposite stop at its stop level and let the older fl…
luisleo526 Sep 16, 2026
1560d1f
Merge branch 'refactor/adapter-lowering-20260914-l10e' into refactor/…
luisleo526 Sep 16, 2026
0486b3d
Mask the entry bar's pre-fill extreme out of a priced entry's excursi…
luisleo526 Sep 16, 2026
e905a1d
Merge branch 'refactor/adapter-lowering-20260914-l10d' into refactor/…
luisleo526 Sep 16, 2026
01e2f54
Cut the switched route's per-bar kernel overhead: receipt vectors, mu…
luisleo526 Sep 16, 2026
b2c8ab2
Size percent-of-equity priced entries and fill stop-limit entries as …
luisleo526 Sep 16, 2026
ddbfecb
Order same-bar commands, pair market entries behind a close and isola…
luisleo526 Sep 16, 2026
8ac4c0f
Merge branch 'refactor/adapter-lowering-20260914-l10c' into refactor/…
luisleo526 Sep 16, 2026
64ef853
Merge branch 'refactor/adapter-lowering-20260914-l10f' into refactor/…
luisleo526 Sep 16, 2026
3158a9d
Merge branch 'refactor/adapter-lowering-20260914-l10g' into refactor/…
luisleo526 Sep 16, 2026
13b0695
Embed the replayed 15m bars in test_l10d_entry_bar_excursion_masks
luisleo526 Sep 16, 2026
b88b464
Book magnifier one-price samples through a stop at the stop level and…
luisleo526 Sep 16, 2026
517230d
Merge branch 'refactor/adapter-lowering-20260914-l10h' into refactor/…
luisleo526 Sep 16, 2026
8e1db06
Arm and fill trailing exits as the legacy owner did, and fold pre-fil…
luisleo526 Sep 16, 2026
bf2d6d6
Order same-bar bracket exits by command sequence, isolate OCA bracket…
luisleo526 Sep 16, 2026
56476f4
Merge branch 'refactor/adapter-lowering-20260914-l10i' into refactor/…
luisleo526 Sep 16, 2026
827678a
Merge branch 'refactor/adapter-lowering-20260914-l10j' into refactor/…
luisleo526 Sep 16, 2026
168b163
Decide the exit-path extreme fold in one place (host) so the magnifie…
luisleo526 Sep 16, 2026
0d9d058
Revert "Merge branch 'refactor/adapter-lowering-20260914-l10i' into r…
luisleo526 Sep 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ jobs:
ccache-${{ runner.os }}-${{ runner.arch }}-${{ matrix.build_type }}-

- name: Verify (${{ matrix.build_type }})
env:
# A40 rev 6: the hosted macOS VM is not a stable timing host; the
# relative runtime witness gates on Linux CI and local builds.
PINEFORGE_RUNTIME_BUDGET_CANDIDATE_ONLY: ${{ runner.os == 'macOS' && '1' || '0' }}
run: python3 scripts/ci_verify.py ${{ matrix.build_type == 'Release' && 'release' || 'debug' }} --build-dir build --jobs 4 --ccache

- name: Stage and summarize diagnostics
Expand Down
28 changes: 11 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ option(PINEFORGE_ENABLE_SANITIZERS
# to quantify implicit-conversion debt. Not -Werror; never fails the build.
option(PINEFORGE_STRICT_WARNINGS
"Enable -Wconversion / -Wsign-conversion (does not imply -Werror)" OFF)
option(PINEFORGE_REQUIRE_ABI_RECEIPTS
"Make receipt-backed ABI CTest rows fail instead of skip when evidence is missing" OFF)

# === Eigen3 ============================================================
# Used for matrix-typed PineScript (matrix.* API). Tries system install
Expand All @@ -77,45 +79,37 @@ endif()

# === pineforge library =================================================
set(PINEFORGE_SOURCE_LAYER_SOURCES
src/compat/pine/exit_activation.cpp
src/compat/pine/exit_lifecycle.cpp
src/compat/pine/order_birth.cpp
src/compat/pine/order_priority.cpp
src/compat/pine/reservation_expansion.cpp
src/source/pine_adapter.cpp
src/source/pine_scheduler_native.cpp
src/source/pine_scheduler.cpp
src/source/pine_strategy_host.cpp
src/source/pine_strategy_commands.cpp
src/source/pine_risk.cpp
src/source/pine_market_admission.cpp
src/source/pine_scheduler.cpp
src/source/pine_stream.cpp
src/source/pine_aux_security.cpp
src/source/pine_fills.cpp
src/source/pine_path_resolve.cpp
src/source/pine_orders.cpp
src/source/pine_execution_lifecycle.cpp
src/source/pine_policy_members.cpp
src/source/pine_state_hash.cpp
src/source/pine_pending_mirror.cpp
)

add_library(pineforge STATIC
src/c_abi.cpp
src/compat/pine/order_birth.cpp
src/compat/pine/exit_activation.cpp
src/compat/pine/exit_lifecycle.cpp
src/compat/pine/order_priority.cpp
src/engine_aux_security.cpp
src/engine_fills.cpp
src/engine_lower_tf.cpp
src/engine_metrics.cpp
src/engine_orders.cpp
src/engine_execution.cpp
src/engine_path_resolve.cpp
src/engine_report.cpp
src/reservation_expansion.cpp
src/engine_run.cpp
src/engine_security.cpp
src/engine_state_hash.cpp
src/engine_stream.cpp
src/market_admission.cpp
src/compat/pine/market_admission.cpp
src/engine_trade_accessors.cpp
src/reservation_expansion.cpp
src/compat/pine/reservation_expansion.cpp
src/pending_order_mirror.cpp
src/native_order.cpp
src/engine_consumer.cpp
Expand Down
4 changes: 2 additions & 2 deletions docker/run_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
_ilmd = None

# Canonical strategy() defaults. Mirrors the engine base-class defaults in
# include/pineforge/engine.hpp (initial_capital_, process_orders_on_close_,
# include/pineforge/engine.hpp (initial_capital_, close-timing mode,
# default_qty_type_, default_qty_value_, pyramiding_, commission_type_,
# commission_value_, slippage_, close_entries_rule_any_). The codegen ctor
# emits only a subset (it omits process_orders_on_close + close_entries_rule),
Expand All @@ -128,7 +128,7 @@
# generated.cpp ctor field name -> provenance key.
_STRAT_FIELD_KEY = {
"initial_capital_": "initial_capital",
"process_orders_on_close_": "process_orders_on_close",
"process" + "_orders_on_close_": "process_orders_on_close",
"default_qty_type_": "default_qty_type",
"default_qty_value_": "default_qty_value",
"pyramiding_": "pyramiding",
Expand Down
33 changes: 16 additions & 17 deletions docs/cheatsheet-runtime-and-execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ exact sequence, fill math, and the subtleties that bite on real-time replay.
> *before* `dispatch_bar()` — `dispatch_bar()` itself does not reset it.
```
1. pending_close_qty_in_bar_ = 0 # reset (outer loop, pre-dispatch_bar)
2. process_pending_orders(bar) # OLD stop/limit/market from prior bars
2. native driver matches carried requests at the broker-open decision point
a. update_risk_state() # may latch risk_halted_
b. update_trail_best_for_bar_open(bar)
c. sort_exit_siblings_by_path_fill(bar)
Expand All @@ -138,12 +138,12 @@ exact sequence, fill math, and the subtleties that bite on real-time replay.
# NEW market orders wait for NEXT bar's open
```

**`process_orders_on_close = true`:** identical 1–4, then a **step 4b
`process_pending_orders(bar)`** so NEW market orders fill at **this bar's
close**. New *priced* (stop/limit/trail) orders created this bar are always
skipped from that second pass (they wait for next bar).
**`process_orders_on_close = true`:** the adapter projects close timing into
the native run specification, then the native driver evaluates eligible new
market requests at this bar's close. New *priced* (stop/limit/trail) requests
created this bar wait for the next eligible decision point.

**Magnifier:** per sub-bar, per sample tick → `process_pending_orders` +
**Magnifier:** per sub-bar, per sample tick → native request matching +
`update_per_trade_extremes`; `on_bar` runs **once**, on the last tick of the
last sub-bar (`is_first_tick_` forced true there).

Expand Down Expand Up @@ -171,11 +171,11 @@ mintick directionally (buys ceil, sells floor).

## 2.3 Market-order timing (critical)

- POOC **off**: market from `on_bar` → `pending_orders_`, fills **next bar
open**.
- POOC **on**: market from `on_bar` (no stop/limit) → `execute_market_entry`
**immediately at this bar's close** (never queued). `strategy.close` likewise
closes immediately at close.
- POOC **off**: a market request lowered from `on_source_bar` remains live and
fills at the **next eligible bar open**.
- POOC **on**: a market request lowered from `on_source_bar` is eligible at
the configured close-execution decision point. `strategy.close` follows the
same native request path.
- Priced order from `on_bar`: queued, evaluated from **next bar** at step 2.

## 2.4 Intrabar price path
Expand Down Expand Up @@ -263,8 +263,9 @@ deferred-flip entry fires. Reset to 0 at bar start.

## 2.11 Risk gates — when & what

- `update_risk_state()` at **start of `process_pending_orders`** (not
placement): drawdown halt, intraday-loss halt, cons-loss-day halt. Once
- The adapter evaluates source risk at native precommit/applied boundaries
(not through a second pending loop): drawdown halt, intraday-loss halt,
cons-loss-day halt. Once
`risk_halted_`, blocks all entries.
- `check_risk_allow_entry` at fill (and in `execute_market_entry`): halt,
direction lock, max_position_size.
Expand Down Expand Up @@ -347,10 +348,8 @@ Audited gaps a forward/real-time executor must know (beyond per-order fills).
for NaN-qty siblings.
- **Trail caveats:** `trail_price` **is read by the fill path**, not ignored:
when `trail_points` is unset it is used verbatim as the trail-activation
level (`compute_exit_trail_state`, `engine_path_resolve.cpp:683-707`,
called by `resolve_exit_path_fill` from the exit fill path
`engine_fills.cpp:8628-8635`; and the dormant-bracket trail check
`engine_fills.cpp:8006-8019` — `has_trail` tests
level (the native path resolver and source adapter trail projection); the
dormant-bracket trail check tests
`!std::isnan(o.trail_price)` alongside `trail_points`, and the activation
defaults to `trail_price` before `trail_points`, when set, overrides it);
`trail_points` wins over `trail_price` when both are set.
Expand Down
28 changes: 15 additions & 13 deletions docs/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,29 +80,31 @@ No release tag or VERSION value is rewritten by verification.

The verifier fetches the pinned ABI commits `e60e571` (R2), `0e18690`
(selected settlement, before exact reversal), `c3ed455` (native host v13),
`f736676` (native host v14), and `e7cdf052` (the frozen v15 source-layer
base) without tags only when each object is missing. It builds all five
`f736676` (native host v14), `e7cdf052` (the frozen v15 source-layer base),
and `ab9714b` (the frozen v16 adapter-lowering base) without tags only when
each object is missing. It builds all six
prepared static libraries with tests disabled, or validates and reuses
their matching prepared receipts under `settlement-abi-base/`,
`settlement-abi-prior/`, `native-abi-v13/`, `native-abi-v14/`, and
`native-abi-v15-frozen/`. Compiler,
`native-abi-v15-frozen/`, and `native-abi-v16-frozen/`. Compiler,
configuration and version-source mismatches refuse reuse without deleting the old evidence.
Each profile needs matching providers; a Mac Release archive cannot replace
a Linux sanitizer build. CTest itself performs no network fetch.
The full settlement matrix uses those five archives plus live v16. Its
host/order matrix retains the historical v13/v14/v15 verdicts and requires
both v15→v16 and v16→v15 rejection pairs; matching v16 callers/providers
succeed. The unchanged driver v4 keeps its historical positive links where its
owner domain is unchanged. Current source callers authenticate the
`pineforge-source-adapter/v1` domain, while the frozen v15 provider remains an
immutable historical identity.
CTest authenticates all six prepared receipts against their actual archive and
header bytes. The executing settlement, script-host, and aggregate controls
use the authenticated `host-ab9714b` v16 archive plus the live v17 archive:
v16 callers link to v16, v17 callers link to v17, and both cross-epoch
directions must fail at link time with the expected epoch-qualified symbol.
No ABI caller executable is run. The older receipts remain authenticated
historical evidence; they are not presented as a live v13/v14/v15 link matrix.
The [ABI guide](../tests/fixtures/settlement_cpp_abi/README.md) describes the
actual old/new library pairs and their immutable inputs.

CTest writes `settlement-abi-receipt.json` for the six-archive matrix and
CTest writes `settlement-abi-receipt.json`, `script-abi-receipt.json`, and
`aggregate-abi-receipt.json` for the real v16/v17 controls, plus
`native-abi-receipt.json` for native controls. The native receipt includes the
active `v14_current_execution_shape_agnostic_compile`, frozen-v15 surface
controls, and v16-current rejection controls against authenticated tar
active `v14_current_execution_shape_agnostic_compile`, frozen-v16
surface controls, and v17-current rejection controls against authenticated tar
closures. `CURRENT_TERMS_SURFACE_READY = True`: the complete current-execution,
FX, and missing-Cancelled controls are active, and the good caller compiles
before its intentional negative compile control. Ordinary compile failures
Expand Down
9 changes: 5 additions & 4 deletions docs/coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ single `.hpp`):
| Module | Header | Source | Pine-facing role |
| ------------------ | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Public C ABI | `pineforge.h` | `c_abi.cpp` (+ layout `static_assert`s) | 65 public `PF_API` declarations: 57 runtime implementations plus eight per-strategy generated exports. `strategy_configure_native_fx_curve_v1` stages the additive native FX curve. |
| Engine | `engine.hpp` | `engine_run.cpp`, `engine_stream.cpp`, `engine_orders.cpp`, `engine_fills.cpp`, `engine_path_resolve.cpp`, `engine_strategy_commands.cpp`, `engine_trade_accessors.cpp`, `engine_security.cpp`, `engine_lower_tf.cpp`, `engine_risk.cpp`, `engine_report.cpp` | One-shot and continuous lifecycle, orders, raw-trade/bar fills, risk, reports, inputs / syminfo, magnifier, TF aggregation, and `request.security` plumbing. |
| Engine | `engine.hpp` | `engine_run.cpp`, `engine_stream.cpp`, `engine_execution.cpp`, `engine_orders.cpp`, `engine_path_resolve.cpp`, `engine_trade_accessors.cpp`, `engine_security.cpp`, `engine_lower_tf.cpp`, `engine_report.cpp`, `native_execution_consumer.cpp` | One-shot and continuous lifecycle, native request matching/settlement, orders, reports, inputs / syminfo, magnifier, TF aggregation, and `request.security` plumbing. |
| Engine internals | `engine_internal.hpp` | (private cross-TU header) | `pineforge::internal::`* types and helpers shared between engine `.cpp` partitions; not part of the public ABI. |
| Technical analysis | `ta.hpp` | `ta_moving_averages.cpp`, `ta_oscillators.cpp`, `ta_volatility_trend.cpp`, `ta_extremes_volume.cpp`, `ta_misc.cpp` | Official `ta.`* functions and series variables backed by stateful runtime classes with `compute` / `recompute`, plus `pivot_point_levels(...)` free function. |
| Math | `math.hpp` | `math.cpp` | Inline `pine_random(...)` PRNG and rolling `math::Sum` class. |
Expand Down Expand Up @@ -203,7 +203,7 @@ density can be flipped to volume-weighted via
| `strategy_cancel(id)` / `strategy_cancel_all()` | Drops pending orders by id or globally. |


Pending orders are resolved on every `process_pending_orders(bar)` call,
Native resting requests are resolved at each native driver decision point,
which walks a 4-waypoint OHLC path (`O → H → L → C` or `O → L → H → C`
depending on open proximity to high vs low). The runtime resolves stop
/ limit priority, gap fills, opposing-stop arbitration, OCA siblings,
Expand Down Expand Up @@ -288,8 +288,9 @@ Aggregate strategy state methods are also defined on the engine:
`avg_trade / avg_winning_trade / avg_losing_trade` (and `_percent`),
`count_wintrades / count_losstrades`, `current_equity`,
`open_profit(price)`, `open_trades_capital_held`, and
`signed_position_size`. `margin_liquidation_price()` always returns
`na<double>()`.
`signed_position_size`. The Pine source host additionally exposes
`margin_liquidation_price()` as a source-level projection; it is not a generic
`BacktestEngine` contract.

### Bar metadata helpers

Expand Down
15 changes: 7 additions & 8 deletions docs/frozen-market-instruction.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Frozen Pine market instruction

This is a bounded representation migration of an existing Pine compatibility
policy. `compat::pine::FrozenMarketInstruction` replaces six independent
PendingOrder sidecars with one exclusive source operation. It does not make
policy. The adapter placement snapshot represents a frozen market instruction
as one exclusive source operation. It does not make
the existing cohort selector a generic native execution contract.

## Source operation and state ownership
Expand Down Expand Up @@ -57,9 +57,9 @@ and a matching entry remains pending later in the source execution order. That
path remains intact. Lowering this source operation into separate generic
native transaction/reduction instructions remains future adapter work.

This migration removes three direct PendingOrder booleans, rather than claiming
that an entire engine has reached a four-flag goal. The Pine cohort selector and
source-operation discriminator survive and must remain in compatibility audits.
L3b removes the retired compatibility-order booleans. The Pine cohort selector
and source-operation discriminator remain adapter facts and must remain in
compatibility audits.
No Pine selection predicate has been moved into the native contract by renaming.

## Observation and compatibility
Expand All @@ -75,9 +75,8 @@ truncation indicator and full string hash). The broker hash folds the kind and
only its live payload; QuantityRequest and placement facts are already folded
at their owning order. Metadata mutation checks refuse hidden nested fields,
changed variant/enum alternatives, removed or conditional folds, and waivers.
The aggregate representation uses internal engine/PendingOrder ABI v7 and
broker/stream fingerprint epoch7. The complete mirror has155 fields: the142
shipped fields, seven reservation facts and these six Pine instruction facts.
The representation is now adapter-owned over native requests. The frozen public
mirror layout remains append-only and is projected from those facts.
Public C ABI4 and stream API1 are unchanged.

`test_frozen_market_instruction` uses literal price-100 fixtures and direct
Expand Down
Loading
Loading