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
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>
Copy file name to clipboardExpand all lines: README.md
+40-35Lines changed: 40 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,20 +4,20 @@
4
4
5
5
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.
6
6
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.
8
8
9
9
This repository ships:
10
10
11
11
-`libpineforge.a` — the static runtime library
12
12
-`<pineforge/pineforge.h>` — the public C ABI (the canonical, stability-pinned consumer surface)
13
13
-`<pineforge/*.hpp>` — the internal C++ headers (used by the closed PineForge transpiler; not part of the stability guarantee)
14
14
- 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
17
17
18
18
## Coverage
19
19
20
-
[**`docs/coverage.md`**](docs/coverage.md) is the complete, current map
20
+
`**[docs/coverage.md](docs/coverage.md)`** is the complete, current map
21
21
of which Pine v6 surface this runtime covers — every TA class, every
22
22
order primitive, every `request.security()` semantic, plus a structured
23
23
inventory of what's deliberately not implemented (with feasibility tags
@@ -30,7 +30,7 @@ auditing the parity claim.
30
30
31
31
**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.
32
32
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.
34
34
35
35
## Quickstart
36
36
@@ -82,18 +82,20 @@ int main(void) {
82
82
83
83
`<pineforge/pineforge.h>` is the **single canonical consumer header**. Every compiled PineForge strategy `.so` exports exactly the 10 symbols declared there:
84
84
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 |
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.
├── 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
141
143
└── verify_corpus.py - diff each engine_trades.csv against its tv_trades.csv
142
144
cmake/ - PineForgeConfig.cmake.in for downstream find_package()
143
145
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
150
152
151
153
- `libpineforge.a` is built with `-fvisibility=hidden -fvisibility-inlines-hidden`
152
154
- 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`
154
156
- 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.
155
157
156
158
## Versioning
@@ -165,26 +167,26 @@ A pre-compiled strategy `.so` against runtime `0.X.Y` will keep working against
165
167
166
168
## Reproducing the corpus run end-to-end
167
169
168
-
The private validation corpus lets maintainers rebuild and rerun all **162**
170
+
The private validation corpus lets maintainers rebuild and rerun all **168**
169
171
compiled PineForge strategies from a fresh clone. If you have access:
170
172
171
173
```bash
172
174
git submodule update --init corpus
173
175
bash scripts/run_corpus.sh
174
176
```
175
177
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
177
179
reference OHLCV feed, and rewrites each `engine_trades.csv`. The script also
178
180
prints the canonical five-tier corpus summary described in `corpus/README.md`.
179
181
180
-
Without the submodule, use **`ctest`** and optional local fixtures you own.
182
+
Without the submodule, use `**ctest**` and optional local fixtures you own.
181
183
182
184
## Cross-engine comparison
183
185
184
-
[`benchmarks/`](benchmarks/) runs the same 50 strategies through
186
+
`[benchmarks/](benchmarks/)` runs the same 50 strategies through
185
187
PineForge, PyneCore, and PineTS to spot engine-specific defects vs
186
188
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`**
188
190
submodule (`assets/strategies/`, `assets/data/`); public clones omit them.
189
191
PyneCore Python sources are the official PyneSys cloud compiler output
190
192
(no hand-ports). PineTS handles indicators only — their
Current standings (window-clipped 4-dimension diff vs TV):
201
203
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
+
208
212
209
213
The 3 PyneCore-only outliers (`liquidity-sweep`, `scalping-strategy`,
210
214
`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
212
216
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)`
214
218
for the full per-strategy table and methodology.
215
219
216
220
## Status
217
221
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).
219
223
220
224
## License
221
225
@@ -228,3 +232,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) (includes the **Apache-2.0** contribution
228
232
1. Every contribution must keep the parity test green.
229
233
2. Public-API changes (anything exported from `<pineforge/pineforge.h>`) require a major-version bump.
230
234
3. Internal C++ helpers can change freely as long as the ABI surface stays put.
0 commit comments