You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 46b2ced
Browse filesBrowse the repository at this point in the historyBrowse files
docs: ABI v4 live surface; cheatsheet corrections (trail_price is read; v4 accessors; corpus slippage facts)
README.md: symbol table and version line updated from ABI v3/32 symbols to
ABI v4/56 symbols (32 + 24, verified by counting `^PF_API ` declarations);
24 new rows for the live-runtime surface; pf_report_t's broker_state_hash
array and pf_pending_order_v1_t noted; v0.14.0 release line added.
docs/cheatsheet-runtime-and-execution.md: three corrections against the
actual code (per AGENTS.md SOP, spec item 3.9) --
- trail_price IS read by the fill path (engine_fills.cpp:4916-4926,
8006-8019: used as the trail-activation level whenever trail_points is
unset), not "accepted but ignored".
- the equity curve exists since ABI v2; ABI v4 adds the closed-trade
id/exit-id/exit-comment/close-cause accessors and
strategy_script_bars_processed; entry_bar_index/exit_bar_index were
already struct fields on pf_trade_t pre-v4 (no "ABI vN" doc-comment
tag), so the old "no bar_index over the C ABI" claim was already wrong
independent of this task -- what remains genuinely unavailable is
stated explicitly.
- corpus slippage/commission facts corrected: 252/312 probes run
slippage=0, but 60/312 declare slippage=1|2 and 62/312 a non-zero
commission_value -- the adjacent "masked because all probes run
slippage=0" argument for the possible close_opposite_then_enter
double-slip bug does not hold for those 60; flagged inline rather than
silently kept, since whether any of them exercises that path is
unverified (out of scope here: src/ is not touched by this task).
docs/pages/streaming.md: new paragraph stating pineforge-live does not use
the strategy_stream_* lifecycle (different fill model) and instead
recomputes run_backtest_full over script-TF bars with the ABI v4 flags;
links to the new page.
docs/pages/live-surface.md (new): the 24 v4 symbols in one table (purpose/
default/"changes history?"=No), flag semantics for realtime_tail,
probe_suppress_tail_logic, path_order and broker_state_hash_recording
matching spec sec 3.1-3.4 exactly, abort semantics (3.5), string lifetimes
and exit-id conventions, the report array, the generated pending-order
mirror, and an evidence section naming the three L0 lanes with their
published numbers (identity 312/0 differ; live-flags 312/0 positives/130
open-at-end subtracted; bar-identity row 1: 222295 bars/2 explained/0
else). Added to docs/Doxyfile's INPUT list (this repo's Doxygen nav) and
linked from docs/pages/index.md's realtime-feed tab.
Verified: check_c_abi_runtime.py, check_broker_state_hash_coverage.py,
gen_pending_order_mirror.py --check all pass; grep -c
strategy_set_realtime_tail README.md docs/pages/live-surface.md ->
README.md:1, live-surface.md:5; ctest 240/240; src/include/corpus/tests
untouched by this commit.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013ZEL52UCofp3j7gfABW7uB
Copy file name to clipboardExpand all lines: README.md
+17-4Lines changed: 17 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -209,7 +209,7 @@ TradingView ties some day-boundary logic (intraday order caps, session rollovers
209
209
210
210
## Public C ABI
211
211
212
-
`<pineforge/pineforge.h>` is the single canonical consumer header. Every compiled strategy `.so` exports exactly these 32 symbols and no internal C++ symbol (`-fvisibility=hidden`, `PF_API` on the public set, checked in CI by `scripts/check_c_abi_runtime.py`):
212
+
`<pineforge/pineforge.h>` is the single canonical consumer header. Every compiled strategy `.so` exports exactly these 56 symbols and no internal C++ symbol (`-fvisibility=hidden`, `PF_API` on the public set, checked in CI by `scripts/check_c_abi_runtime.py`):
213
213
214
214
| Symbol | Role |
215
215
|---|---|
@@ -227,9 +227,21 @@ TradingView ties some day-boundary logic (intraday order caps, session rollovers
227
227
|`strategy_set_native_security_feed` / `strategy_set_aux_security_feed`| Feed `request.security()` from a native higher-timeframe series / an auxiliary bar-aligned feed |
228
228
|`strategy_set_account_currency_fx_series`| Effective-time quote-to-account FX |
229
229
|`strategy_get_last_error`| The latest runtime error |
230
-
|`pf_version_get` / `pf_version_string` / `pf_abi_version`| Runtime version, version string, struct-layout version (`PF_ABI_VERSION == 3`) |
231
-
232
-
POD types `pf_bar_t`, `pf_trade_tick_t`, `pf_trade_t`, `pf_report_t`, `pf_security_diag_t`, `pf_trace_entry_t`, `pf_version_t`, `pf_trade_stats_t`, `pf_equity_stats_t`, `pf_metrics_t`, `pf_equity_point_t` and the `pf_magnifier_distribution_t` enum complete the surface. ABI v2 added computed trading metrics and a per-bar equity curve; ABI v3 added `pf_trade_t::open_at_end`, TradingView's range-end close of a position still open after the last bar. Check `pf_abi_version()` before running: the report struct is caller-allocated.
230
+
|`pf_version_get` / `pf_version_string` / `pf_abi_version`| Runtime version, version string, struct-layout version (`PF_ABI_VERSION == 4`) |
231
+
|`strategy_request_abort` / `strategy_last_run_status`| Cooperative abort of a run in progress; `0`=completed, `1`=aborted |
232
+
|`strategy_set_realtime_tail`| Live-runtime surface (ABI v4): the array's last bar is a still-forming tail — `barstate.islast=false`, `last_bar_index`/`last_bar_time` frozen at the horizon bar, no range-end row |
233
+
|`strategy_set_probe_suppress_tail_logic`| ABI v4: the last bar runs only the broker's pre-`on_bar` steps (pending-order settlement, intraday-cap/loss checks) and returns — no `on_bar`, no range-end/margin-call/bracket-reissue processing |
234
+
|`strategy_set_path_order` / `strategy_last_bar_dual_entry_path`| ABI v4: force the intrabar O→H/L→C leg order (`AUTO`/`HIGH_FIRST`/`LOW_FIRST`) for path-dependent fill probing; read which side won a same-bar dual-entry-stop arbitration |
235
+
|`strategy_set_broker_state_hash_recording` / `strategy_broker_state_hash`| ABI v4: toggle a 64-bit broker-state hash appended per script bar to `pf_report_t::broker_state_hash`; read the final state's hash |
236
+
|`strategy_pending_orders_len` / `strategy_pending_order_get` / `strategy_pending_order_layout`| ABI v4: the resting pending-order book after the most recent run — count, a POD snapshot per order (`pf_pending_order_v1_t`), and the snapshot's self-describing field layout |
237
+
|`strategy_pending_order_fill_qty` / `_level_resolved` / `_effective_levels` / `strategy_trail_best_price`| ABI v4: engine-computed values for a resting order — the quantity it would fill at a given price, whether its relative offsets resolve yet, its resolved stop/limit/trail-activation levels, and the live position's trail extreme |
238
+
|`strategy_position_avg_price` / `strategy_position_cycle_seq` / `strategy_position_size`| ABI v4: the live position's volume-weighted average entry price, its cycle id, and its script-facing signed size |
239
+
|`strategy_closed_trade_entry_id` / `_exit_id` / `_exit_comment` / `_close_cause`| ABI v4: per-closed-trade id/comment strings and a `close_cause` enum (`SCRIPT`/`BRACKET`/`MARGIN_CALL`/`INTRADAY_LOSS_CAP`/`INTRADAY_FILL_CAP`/`RANGE_END`), indexed like `strategy_closed_trade_entry_incarnation`|
240
+
|`strategy_current_equity` / `strategy_script_bars_processed`| ABI v4: `initial_capital + netprofit` (not Pine's `strategy.equity`, which also adds open profit); total script bars dispatched by the most recent run |
241
+
242
+
POD types `pf_bar_t`, `pf_trade_tick_t`, `pf_trade_t`, `pf_report_t`, `pf_security_diag_t`, `pf_trace_entry_t`, `pf_version_t`, `pf_trade_stats_t`, `pf_equity_stats_t`, `pf_metrics_t`, `pf_equity_point_t`, `pf_pending_order_v1_t`, `pf_field_desc_t` and the `pf_magnifier_distribution_t` enum complete the surface. ABI v2 added computed trading metrics and a per-bar equity curve; ABI v3 added `pf_trade_t::open_at_end`, TradingView's range-end close of a position still open after the last bar; ABI v4 added the live-runtime accessors above plus `pf_report_t::broker_state_hash` / `broker_state_hash_len` (a per-script-bar broker-state hash array, appended after `equity_curve_len`, NULL/0-length unless `strategy_set_broker_state_hash_recording` is on) and the `pf_pending_order_v1_t` generated POD mirror of the engine's resting-order record. Check `pf_abi_version()` before running: the report struct is caller-allocated.
243
+
244
+
Full flag semantics, string lifetimes and the three L0 evidence lanes behind the ABI v4 live surface: [`docs/pages/live-surface.md`](docs/pages/live-surface.md).
233
245
234
246
**Stability guarantee.** Within a major version, struct layouts and `extern "C"` signatures are append-only — fields and functions are added, never reordered, removed or retyped; `static_assert`s in `src/c_abi.cpp` pin the layouts. Semantic versioning at the ABI level: PATCH never touches the ABI, MINOR appends, MAJOR breaks. A `.so` built against `0.X.Y` keeps working on any later `0.X.Z`.
-**v0.14.0** (2026-09-08) — ABI v4 live surface for `pineforge-live`: 24 new default-off exports (cooperative abort, realtime tail, probe-suppress tail logic, forced path order, a per-bar broker-state hash, the pending-order book as a generated POD mirror, closed-trade id/comment/close-cause, position and equity accessors). No flag changes a historical run: `scripts/live_flags_off_identity.py` (312 corpus probes, 0 differ vs the pre-v4 branch point), `scripts/live_flags_lane.py` (312 probes, 0 positives, 130 open-at-end trades subtracted), and `scripts/bar_identity_lane.py` (row 1: 222,295 bars compared, 2 explained open divergences, 0 else) all pass. 56 symbols.
264
277
-**v0.13.0** (2026-09-05) — the parity campaign, rounds 1–11: TradingView's broker rules pinned with sensor exports and landed with replay tests — ten-significant-digit money, trailing-stop restarts, zero-offset trails, declined-reversal bracket legs, the surviving `strategy.close`, sparse `ta.atr`/`ta.tr`, pivot tick snap, same-bar entry/close transactions, early-close higher-timeframe buckets, 64-bit epoch arrays. Closed test 3,880/3,881; corpus 309/309. ABI v3, 32 symbols, 198 tests.
265
278
-**v0.7 – v0.12** (June–August 2026) — native and auxiliary `request.security()` feeds, ABI v2 metrics + equity curve, streaming mode, range-end accounting. See [GitHub releases](https://github.com/pineforge-4pass/pineforge-engine/releases).
266
279
-**v0.6.0** — performance sprint: cached static inputs, thread-local timestamp caching, lazy timezone caching; up to 6.7M bars/s.
0 commit comments