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 1bd075c
Browse filesBrowse the repository at this point in the historyBrowse files
* feat(abi): metrics/equity-curve report fields, trade commission+bar-index fields, pf_abi_version (PF_ABI_VERSION=2)
Co-Authored-By: Claude Fable 5 <[email protected]>
* docs(abi): per-field metric doxygen with pinned units; test pf_abi_version C-side; document include-order
Co-Authored-By: Claude Fable 5 <[email protected]>
* feat(engine): capture per-trade commission at close; expose in TradeC
Co-Authored-By: Claude Fable 5 <[email protected]>
* feat(engine): per-script-bar equity curve + bars-in-market collection, reset-safe
Co-Authored-By: Claude Fable 5 <[email protected]>
* feat(metrics): compute_trade_stats with TV sign/NaN conventions + unit tests
Co-Authored-By: Claude Fable 5 <[email protected]>
* feat(metrics): compute_equity_stats (dd walk, TV monthly + per-bar sharpe/sortino, cagr/calmar) + unit tests
Co-Authored-By: Claude Fable 5 <[email protected]>
* test(metrics): engine-vs-walk dd invariant, per-bar + non-UTC sharpe oracles; document tz-lock contract
Co-Authored-By: Claude Fable 5 <[email protected]>
* feat(report): wire metrics + equity curve into fill_report/free_report
Co-Authored-By: Claude Fable 5 <[email protected]>
* feat(harness): mirror ABI v2 (metrics + equity curve), enforce pf_abi_version
pf_report_t grew in ABI v2 (pf_metrics_t by value + equity_curve ptr +
int64 len appended; pf_trade_t gained commission + entry/exit bar
indices). pf_report_t is CALLER-allocated, so every ctypes harness that
allocated it from the old field list would under-size the buffer and
let the runtime write past it.
Updated every ctypes mirror in the repo and added an ABI guard at every
CDLL load site (pf_abi_version() must equal 2; a missing symbol means a
pre-v2 .so and is rejected with a rebuild hint):
- scripts/run_strategy.py (corpus harness; trade dicts now also carry
commission + entry/exit bar_index)
- tutorial/run.py (mirrors + reusable check_abi)
- tutorial/run_mtf.py (guard via run.check_abi)
- tutorial/run_advanced.py (guard via run.check_abi)
- docker/run_json.py (codegen-mcp container harness)
- benchmarks/throughput/grid_search_repro.py
Mirror layouts verified against include/pineforge/pineforge.h:
ctypes sizeof matches the C side exactly (trade 96, trade_stats 216,
equity_stats 120, metrics 768, equity_point 24, report 944; metrics/
equity_curve/equity_curve_len offsets 160/928/936).
Co-Authored-By: Claude Fable 5 <[email protected]>
* polish(metrics): review nits — ordering comment, test deref guard, empty-curve coverage
Co-Authored-By: Claude Fable 5 <[email protected]>
* docs: sync FFI mirrors + report schema with ABI v2 (metrics, equity curve, pf_abi_version)
Co-Authored-By: Claude Fable 5 <[email protected]>
* docs(abi): truncation caveat on equity_curve len; drop gitignored-spec reference from source comment
Co-Authored-By: Claude Fable 5 <[email protected]>
* fix(metrics): TV conventions arbitrated vs real export — net return-on-cost pnl_pct, independent largest-%, inclusive avg bars
Co-Authored-By: Claude Fable 5 <[email protected]>
* test(metrics): cross-validation script vs quantstats/empyrical-reloaded
Co-Authored-By: Claude Fable 5 <[email protected]>
* ci: register pf_abi_version in check_c_abi_runtime EXPECTED_RUNTIME; SOP in CLAUDE.md
Co-Authored-By: Claude Fable 5 <[email protected]>
---------
Co-authored-by: Claude Fable 5 <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -299,7 +299,7 @@ int main(void) {
299
299
300
300
## Public C ABI (the stability surface)
301
301
302
-
`<pineforge/pineforge.h>` is the **single canonical consumer header**. Every compiled PineForge strategy `.so` exports exactly the 10 symbols declared there:
302
+
`<pineforge/pineforge.h>` is the **single canonical consumer header**. Every compiled PineForge strategy `.so` exports the symbols declared there:
| `pf_abi_version` | Struct-layout version (`PF_ABI_VERSION`) |
317
318
318
319
319
-
POD types (`pf_bar_t`, `pf_trade_t`, `pf_report_t`, `pf_security_diag_t`, `pf_trace_entry_t`, `pf_version_t`) and the `pf_magnifier_distribution_t` enum complete the surface.
320
+
POD types (`pf_bar_t`, `pf_trade_t`, `pf_report_t`, `pf_security_diag_t`, `pf_trace_entry_t`, `pf_version_t`, and — since ABI v2 — `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 (`PF_ABI_VERSION == 2`, exported as `pf_abi_version()`) appends computed trading metrics and a per-script-bar equity curve to `pf_report_t`; callers must verify the version before running since the report struct is caller-allocated.
320
321
321
322
**Stability guarantee:** within the same `PINEFORGE_VERSION_MAJOR`, struct layouts and `extern "C"` signatures are append-only. New fields may be appended; existing fields are never reordered, removed, or retyped. New functions may be added; existing functions are never removed or signature-changed. Compile-time `static_assert`s in `src/c_abi.cpp` pin the layouts against drift.
0 commit comments