Skip to content

Commit 84c90eb

Browse files
docs: refresh README + CONTRIBUTING to 168-strategy parity framing
Reflects the 6 parity probes added in corpus/abf87e6: headline numbers move from "160 excellent + 2 strong across 162" to "165 excellent + 2 strong + 1 stress probe across 168". Plus minor wording and table formatting polish. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 9507d8f commit 84c90eb

2 files changed

Lines changed: 41 additions & 36 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ easy to find candidates.
146146

147147
## Parity testing
148148

149-
The 162-strategy parity corpus is the private **`corpus` git submodule** (see
149+
The 168-strategy parity corpus (162 base + 6 parity probes) is the private **`corpus` git submodule** (see
150150
top of this file). After `git submodule update --init corpus`, read
151151
[`corpus/README.md`](corpus/README.md) for layout and threshold profiles. The full sweep is:
152152

README.md

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
55
PineForge is the **C++ runtime** that PineForge-compiled strategies link against. It implements PineScript v6 strategy semantics — order matching, fills, the magnifier, technical indicators, time/session math — as a static C++ library with a stable C ABI.
66

7-
The runtime is parity-tested **trade-for-trade against TradingView's "List of Trades" CSV exports** on an internal reference corpus: **160 excellent + 2 strong** across 162 strategies under the canonical verifier. That corpus is **not shipped** in public checkouts; see **Contributing** / private `corpus` submodule below.
7+
The runtime is parity-tested **trade-for-trade against TradingView's "List of Trades" CSV exports** on an internal reference corpus: **165 excellent + 2 strong + 1 stress probe at the 1× margin boundary** across 168 strategies (162 reference + 6 parity probes) under the canonical verifier. That corpus is **not shipped** in public checkouts; see **Contributing** / private `corpus` submodule below.
88

99
This repository ships:
1010

1111
- `libpineforge.a` — the static runtime library
1212
- `<pineforge/pineforge.h>` — the public C ABI (the canonical, stability-pinned consumer surface)
1313
- `<pineforge/*.hpp>` — the internal C++ headers (used by the closed PineForge transpiler; not part of the stability guarantee)
1414
- A 16-binary ctest suite (15 C++ + 1 pure-C ABI sanity test) that runs in CI on every commit (~81% line coverage of `src/` measured via `bash scripts/coverage.sh`)
15-
- **`corpus/`** (optional **git submodule**) — **162 reference strategies** for maintainers who have access: each folder has `strategy.pine`, `generated.cpp`, `tv_trades.csv`, and `engine_trades.csv`, plus shared OHLCV under `corpus/data/`. Run `bash scripts/run_corpus.sh` after `git submodule update --init corpus`. Public clones omit this content.
16-
- [`benchmarks/`](benchmarks/)**three-way engine comparison** (PineForge ↔ [PyneCore](https://github.com/PyneSys/pynecore)[PineTS](https://github.com/LuxAlgo/PineTS)) on 50 strategies and 10 canonical indicators. The harness code and reports live here; **fixtures** (pinned OHLCV, every `strategies/*` folder with TV exports and trade CSVs) ship only via an optional **private `benchmarks/assets` submodule** — same confidentiality class as `corpus/`. With that init’d, `bash benchmarks/run_all.sh` reproduces the headline numbers with zero external API calls. PyneCore Python is official cloud-compiler output (no hand-ports). Headline: PineForge hits canonical *excellent* tier on 48/50 strategies vs PyneCore's 45/50; the 3 outliers are PyneCore-specific defects on bracket / trail / partial-exit semantics
15+
- `**corpus/`** (optional **git submodule**) — **168 reference strategies** (162 base + 6 parity probes) for maintainers who have access: each folder has `strategy.pine`, `generated.cpp`, `tv_trades.csv`, and `engine_trades.csv`, plus shared OHLCV under `corpus/data/`. Run `bash scripts/run_corpus.sh` after `git submodule update --init corpus`. Public clones omit this content.
16+
- `[benchmarks/](benchmarks/)`**three-way engine comparison** (PineForge ↔ [PyneCore](https://github.com/PyneSys/pynecore)[PineTS](https://github.com/LuxAlgo/PineTS)) on 50 strategies and 10 canonical indicators. The harness code and reports live here; **fixtures** (pinned OHLCV, every `strategies/`* folder with TV exports and trade CSVs) ship only via an optional **private `benchmarks/assets` submodule** — same confidentiality class as `corpus/`. With that init’d, `bash benchmarks/run_all.sh` reproduces the headline numbers with zero external API calls. PyneCore Python is official cloud-compiler output (no hand-ports). Headline: PineForge hits canonical *excellent* tier on 48/50 strategies vs PyneCore's 45/50; the 3 outliers are PyneCore-specific defects on bracket / trail / partial-exit semantics
1717

1818
## Coverage
1919

20-
[**`docs/coverage.md`**](docs/coverage.md) is the complete, current map
20+
`**[docs/coverage.md](docs/coverage.md)`** is the complete, current map
2121
of which Pine v6 surface this runtime covers — every TA class, every
2222
order primitive, every `request.security()` semantic, plus a structured
2323
inventory of what's deliberately not implemented (with feasibility tags
@@ -30,7 +30,7 @@ auditing the parity claim.
3030

3131
**This is a backtest engine, not a charting library.** PineScript drawing primitives (`plot`, `bgcolor`, `label`, …) compile cleanly but do nothing at runtime. The runtime computes trade execution and reports — it does not render.
3232

33-
**This is not a TradingView clone.** PineForge intentionally diverges from TradingView in a handful of places where TV's behaviour is undocumented or platform-specific (the bar magnifier, deterministic float ordering). Where it converges, it converges **exactly** on the internal reference corpus (`160/162` at excellent tier; **maintainers only** — init the private `corpus` submodule per [`CONTRIBUTING.md`](CONTRIBUTING.md)). Where it diverges, it documents the divergence.
33+
**This is not a TradingView clone.** PineForge intentionally diverges from TradingView in a handful of places where TV's behaviour is undocumented or platform-specific (the bar magnifier, deterministic float ordering). Where it converges, it converges **exactly** on the internal reference corpus (`165/168` at strict-excellent tier; **maintainers only** — init the private `corpus` submodule per `[CONTRIBUTING.md](CONTRIBUTING.md)`). Where it diverges, it documents the divergence.
3434

3535
## Quickstart
3636

@@ -82,18 +82,20 @@ int main(void) {
8282
8383
`<pineforge/pineforge.h>` is the **single canonical consumer header**. Every compiled PineForge strategy `.so` exports exactly the 10 symbols declared there:
8484
85-
| Symbol | Role |
86-
| --- | --- |
87-
| `strategy_create` | Allocate a strategy instance |
88-
| `strategy_free` | Release the instance |
89-
| `run_backtest` | Run with auto-detected timeframe |
90-
| `run_backtest_full` | Run with timeframe + magnifier configuration |
91-
| `report_free` | Free arrays inside a filled `pf_report_t` |
92-
| `strategy_set_input` | Override a Pine `input.*()` value |
93-
| `strategy_set_override` | Override a `strategy(...)` declaration param |
94-
| `strategy_set_magnifier_volume_weighted` | Toggle volume-weighted magnifier |
95-
| `strategy_set_trace_enabled` | Toggle per-bar trace recording |
96-
| `pf_version_get` | Runtime version |
85+
86+
| Symbol | Role |
87+
| ---------------------------------------- | -------------------------------------------- |
88+
| `strategy_create` | Allocate a strategy instance |
89+
| `strategy_free` | Release the instance |
90+
| `run_backtest` | Run with auto-detected timeframe |
91+
| `run_backtest_full` | Run with timeframe + magnifier configuration |
92+
| `report_free` | Free arrays inside a filled `pf_report_t` |
93+
| `strategy_set_input` | Override a Pine `input.*()` value |
94+
| `strategy_set_override` | Override a `strategy(...)` declaration param |
95+
| `strategy_set_magnifier_volume_weighted` | Toggle volume-weighted magnifier |
96+
| `strategy_set_trace_enabled` | Toggle per-bar trace recording |
97+
| `pf_version_get` | Runtime version |
98+
9799
98100
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.
99101
@@ -126,8 +128,8 @@ src/ - implementation (~25 .cpp files split by concern)
126128
│ ├── ta_extremes_volume.cpp Highest/Lowest, OBV, AccDist, NVI/PVI/PVT, VWAP, ...
127129
│ └── ta_misc.cpp Linreg, PercentRank, BarsSince, ValueWhen, ...
128130
└── magnifier.cpp / matrix.cpp / session_time.cpp / str_utils.cpp / timeframe.cpp / timezone.cpp / math.cpp
129-
tests/ - 14 ctest binaries
130-
corpus/ - private submodule: 162 strategies (maintainers only); see CONTRIBUTING.md
131+
tests/ - 16 ctest binaries (15 C++ + 1 pure-C ABI sanity)
132+
corpus/ - private submodule: 168 strategies (maintainers only); see CONTRIBUTING.md
131133
├── data/ - reference 36k-bar OHLCV feed (Binance ETH/USDT:USDT 15m)
132134
└── CMakeLists.txt - opt-in subproject that compiles every generated.cpp into strategy.so
133135
benchmarks/ - three-way comparison harness vs PyneCore + PineTS
@@ -137,7 +139,7 @@ benchmarks/ - three-way comparison harness vs PyneCore + PineTS
137139
└── run_all.sh - one-shot: bootstrap + cloud-compile + run + diff (needs assets submodule)
138140
scripts/ - reproducibility tooling
139141
├── run_strategy.py - load any strategy.so via ctypes, write engine_trades.csv
140-
├── run_corpus.sh - one-shot: build all 162 .so + run + verify
142+
├── run_corpus.sh - one-shot: build all 168 .so + run + verify
141143
└── verify_corpus.py - diff each engine_trades.csv against its tv_trades.csv
142144
cmake/ - PineForgeConfig.cmake.in for downstream find_package()
143145
cmake/smoke_consumer/ - Minimal find_package(PineForge) CI smoke project
@@ -150,7 +152,7 @@ Every compiled strategy `.so` that statically links `libpineforge.a` exports **e
150152
151153
- `libpineforge.a` is built with `-fvisibility=hidden -fvisibility-inlines-hidden`
152154
- Public symbols are tagged `PF_API` (visibility=default)
153-
- Internal C++ classes (`BacktestEngine`, `ta::*`, `pineforge::internal::*`) are not tagged, so they stay hidden in any final `.so`
155+
- Internal C++ classes (`BacktestEngine`, `ta::`*, `pineforge::internal::`*) are not tagged, so they stay hidden in any final `.so`
154156
- CI runs `scripts/check_c_abi_runtime.py` (runtime `PF_API` split vs transpiler-emitted symbols). Full trade-list parity sweeps use the private `corpus` submodule locally, not in GitHub Actions.
155157
156158
## Versioning
@@ -165,26 +167,26 @@ A pre-compiled strategy `.so` against runtime `0.X.Y` will keep working against
165167
166168
## Reproducing the corpus run end-to-end
167169
168-
The private validation corpus lets maintainers rebuild and rerun all **162**
170+
The private validation corpus lets maintainers rebuild and rerun all **168**
169171
compiled PineForge strategies from a fresh clone. If you have access:
170172
171173
```bash
172174
git submodule update --init corpus
173175
bash scripts/run_corpus.sh
174176
```
175177

176-
That builds `libpineforge.a` plus 162 strategy `.so` files, runs each against the
178+
That builds `libpineforge.a` plus 168 strategy `.so` files, runs each against the
177179
reference OHLCV feed, and rewrites each `engine_trades.csv`. The script also
178180
prints the canonical five-tier corpus summary described in `corpus/README.md`.
179181

180-
Without the submodule, use **`ctest`** and optional local fixtures you own.
182+
Without the submodule, use `**ctest**` and optional local fixtures you own.
181183

182184
## Cross-engine comparison
183185

184-
[`benchmarks/`](benchmarks/) runs the same 50 strategies through
186+
`[benchmarks/](benchmarks/)` runs the same 50 strategies through
185187
PineForge, PyneCore, and PineTS to spot engine-specific defects vs
186188
TV-side semantics. **Strategy folders and** the 41,307-bar Binance
187-
ETH/USDT:USDT 15m OHLCV live under the private **`benchmarks/assets`**
189+
ETH/USDT:USDT 15m OHLCV live under the private `**benchmarks/assets`**
188190
submodule (`assets/strategies/`, `assets/data/`); public clones omit them.
189191
PyneCore Python sources are the official PyneSys cloud compiler output
190192
(no hand-ports). PineTS handles indicators only — their
@@ -199,23 +201,25 @@ cat benchmarks/results/summary.md
199201

200202
Current standings (window-clipped 4-dimension diff vs TV):
201203

202-
| Match degree | PineForge | PyneCore |
203-
|---|---:|---:|
204-
| 🟢 excellent | **48 / 50** | 45 / 50 |
205-
| 🟢 strong | 2 / 50 | 2 / 50 |
206-
| 🟡 moderate | 0 | 2 |
207-
| 🟠 weak | 0 | 1 |
204+
205+
| Match degree | PineForge | PyneCore |
206+
| ------------ | ----------- | -------- |
207+
| 🟢 excellent | **48 / 50** | 45 / 50 |
208+
| 🟢 strong | 2 / 50 | 2 / 50 |
209+
| 🟡 moderate | 0 | 2 |
210+
| 🟠 weak | 0 | 1 |
211+
208212

209213
The 3 PyneCore-only outliers (`liquidity-sweep`, `scalping-strategy`,
210214
`partial-exit-qty-percent`) all involve `strategy.exit(stop=…, limit=…)`
211-
brackets, `trail_*` exits, or `strategy.close(qty_percent=…)` partial
215+
brackets, `trail_`* exits, or `strategy.close(qty_percent=…)` partial
212216
exits — categories where PyneCore's broker emulator differs from TV
213-
and PineForge does not. See [`benchmarks/results/summary.md`](benchmarks/results/summary.md)
217+
and PineForge does not. See `[benchmarks/results/summary.md](benchmarks/results/summary.md)`
214218
for the full per-strategy table and methodology.
215219

216220
## Status
217221

218-
- v0.1 — initial public release. C ABI defined and pinned. Reported **160 excellent + 2 strong** TV parity on the internal corpus (private submodule); 48/50 strategies hit canonical *excellent* tier in the three-way benchmark. CI runs on Ubuntu + macOS (ctest + install smoke; no corpus).
222+
- v0.1 — initial public release. C ABI defined and pinned. Reported **165 excellent + 2 strong** TV parity on the internal corpus (private submodule, 168 strategies including 6 parity probes); 48/50 strategies hit canonical *excellent* tier in the three-way benchmark. CI runs on Ubuntu + macOS (ctest + install smoke; no corpus).
219223

220224
## License
221225

@@ -228,3 +232,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) (includes the **Apache-2.0** contribution
228232
1. Every contribution must keep the parity test green.
229233
2. Public-API changes (anything exported from `<pineforge/pineforge.h>`) require a major-version bump.
230234
3. Internal C++ helpers can change freely as long as the ABI surface stays put.
235+

0 commit comments

Comments
 (0)