Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ add_library(pineforge STATIC
src/reservation_expansion.cpp
src/compat/pine/reservation_expansion.cpp
src/pending_order_mirror.cpp
src/native_order.cpp
src/engine_consumer.cpp
src/market_driver.cpp
src/native_execution_consumer.cpp
src/magnifier.cpp
src/math.cpp
src/matrix.cpp
Expand All @@ -116,6 +120,8 @@ add_library(pineforge STATIC
src/ta_volatility_trend.cpp
src/timeframe.cpp
src/timezone.cpp
src/native_calendar.cpp
src/native_run_spec.cpp
)

# Canonical alias for downstream find_package(PineForge) consumers.
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,21 @@ Lifecycle-aware compiled modules reset Pine variables, indicator/history buffers

---

## Native C++ strategy API

Use `NativeStrategyHost` with an explicit `NativeRunSpec` for native market
transactions, reductions and flatten requests. The [native engine guide](docs/pages/native-engine.md)
provides a complete C++ batch/stream example, calendar and execution contracts,
and a runnable JSON configuration for the live runner.

## Native live runner

The optional C++17 `pineforge-live` executable uses this engine's native
warmup-to-stream lifecycle. It accepts tick or confirmed 1m OHLCV input,
warmup-to-stream lifecycle. It accepts normalized ticks or confirmed OHLCV bars,
supports user-defined C++ parsers for broker/provider messages, and commits
inputs plus order-action webhooks to a durable SQLite ledger. Hand-written
C++ and codegen-generated strategies use the same strategy interface.
C++ strategies use the native contract; generated Pine strategies retain their
compatibility path. Both expose the versioned C ABI used by the runner.

Build with `-DPINEFORGE_BUILD_LIVE_RUNNER=ON`; the option is off by default,
so core-only users do not acquire SQLite/libcurl/OpenSSL dependencies. See
Expand Down Expand Up @@ -234,7 +242,7 @@ TradingView ties some day-boundary logic (intraday order caps, session rollovers

## Public C ABI

`<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`):
`<pineforge/pineforge.h>` is the single canonical consumer header. Every compiled strategy `.so` exports exactly these 64 symbols and no internal C++ symbol (`-fvisibility=hidden`, `PF_API` on the public set, checked in CI by `scripts/check_c_abi_runtime.py`):

| Symbol | Role |
|---|---|
Expand All @@ -254,6 +262,7 @@ TradingView ties some day-boundary logic (intraday order caps, session rollovers
| `strategy_set_account_currency_fx_series` | Effective-time quote-to-account FX |
| `strategy_get_last_error` | The latest runtime error |
| `pf_version_get` / `pf_version_string` / `pf_abi_version` | Runtime version, version string, struct-layout version (`PF_ABI_VERSION == 4`) |
| `strategy_execution_contract` / `strategy_configure_native_v1` | Query Legacy vs NativeMarketV1; apply the versioned native run specification |
| `strategy_request_abort` / `strategy_last_run_status` | Cooperative abort of a run in progress; `0`=completed, `1`=aborted |
| `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 |
| `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 margin-call / POOC second pass / bracket-reissue processing (the range-end row is `strategy_set_realtime_tail`'s to skip; the flags are independent) |
Expand Down
1 change: 1 addition & 0 deletions docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ INPUT = ../include/pineforge/pineforge.h \
pages/integration-cmake.md \
pages/lifecycle.md \
pages/fill-model.md \
pages/native-engine.md \
pages/market-admission.md \
pages/exit-leg-lifecycle.md \
pages/exit-leg-lifecycle-reflection.md \
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/abi-stability.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ notice:
Rebuild generated and native C++ objects against matching engine headers and
runtime. Deriving placement and opposite-predecessor facts from original
admission evidence changes the native layout and advances `PendingOrder` and
`BacktestEngine` to `engine_script_run_v11`. Exact pre-change fd4c686/v10
`BacktestEngine` to `engine_script_run_v12`. Exact pre-change fd4c686/v10
headers are authenticated before native, generated-style and standalone
PendingOrder pairing checks. Current/old matching links must succeed and stale
pairings must fail for the expected qualified symbols. Earlier v2-v9 controls
Expand Down
4 changes: 4 additions & 0 deletions docs/pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ consumption.
ownership, then **[Tutorial: MACD](@ref tutorial_macd)** for an
end-to-end working example.

- <b class="tab-title">I'm writing a native strategy</b>
Read **[Native market host](@ref native-market)** for `NativeStrategyHost`,
`configure_native`, and the C ABI contract query.

- <b class="tab-title">I'm integrating from CMake</b>
Jump straight to **[Install](@ref install)** and
**[CMake integration](@ref integration_cmake)**. Then skim
Expand Down
Loading
Loading