|
OpenPine C++ API
C++ wrapper for the OpenPine Pine Script VM
|
C ABI and C++ wrappers for the OpenPine Pine Script VM. Use this to run Pine scripts from C or C++ and read chart outputs (plots, labels, lines, etc.) without depending on Rust directly.
From the repository root (not from crates/capi):
This builds the static library (openpine_capi) and the C++ example. The example target is helloworld (see examples/cpp/).
Example CMake snippet:
If you build from the repo root with the top-level CMakeLists.txt, openpine_capi is already defined via Corrosion.
Catch openpine::Error for creation and execution failures.
| Type | Description |
|---|---|
| openpine::CreateInstanceOptions | Script source, timeframe, optional path and options. |
| openpine::Instance | VM instance; create(), run(symbol, tf, from, callback), chart(), scriptInfo(). |
| openpine::DataProvider | Abstract base; implement symbolInfo() + candlesticksOpen(). |
| openpine::CandlestickStream | RAII push stream; create in candlesticksOpen, push from any thread. |
| openpine::Chart | Chart data; seriesLength(), seriesGraphIterator(), graphIterator(), asBarColors(). |
| openpine::SeriesGraphIterator | Iterates series graphs (plot, background colors, fill, etc.). Optional SeriesGraphType filter. |
| openpine::GraphIterator | Iterates non-series graphs (hline, label, line, box, etc.). Optional GraphType filter. |
| openpine::SeriesGraph / openpine::Graph | Tagged unions; use type() and asPlot(), asLabel(), etc. |
| openpine::Error | Thrown on failure; errorMessage(), errorSpan(). |
The C++ API is a thin wrapper over the C API with RAII, std::optional, and exceptions for errors.