|
PineForge v0.13.1-379-g9b50973
Deterministic PineScript v6 backtest runtime — C ABI reference
|
Every value below is the exact integer of the C++ alternative it names, pinned by static_asserts in src/native_c_host.cpp. More...
Every value below is the exact integer of the C++ alternative it names, pinned by static_asserts in src/native_c_host.cpp.
| enum pf_native_intent_t |
Order intent — the alternative index of native_order::OrderIntent.
| Enumerator | |
|---|---|
| PF_NATIVE_INTENT_FLATTEN | Close the whole book. |
| PF_NATIVE_INTENT_REDUCE | Reduce; see pf_native_reduction_t. |
| PF_NATIVE_INTENT_TRANSACT |
|
| PF_NATIVE_INTENT_REVERSE_TO |
|
| PF_NATIVE_INTENT_HOST_SIZED | The cohort close, and nothing else; see PF_NATIVE_OWNER_BIND_COHORT. Refused PF_NATIVE_E_UNSUPPORTED under any other owner. |
| PF_NATIVE_INTENT_SIZED | Kernel-sized opening (L3). |
Definition at line 236 of file native_c_api.h.
Reduction size — the alternative index of native_order::ReductionSize.
| Enumerator | |
|---|---|
| PF_NATIVE_REDUCE_EXPLICIT_UNITS |
|
| PF_NATIVE_REDUCE_OWNER_OPENED | Exactly what the owner opened. |
| PF_NATIVE_REDUCE_SCOPE_FRACTION |
|
Definition at line 249 of file native_c_api.h.
Scope claim of a fractional reduce.
| Enumerator | |
|---|---|
| PF_NATIVE_SCOPE_GROSS | |
| PF_NATIVE_SCOPE_NET_OF_SIBLINGS | |
Definition at line 256 of file native_c_api.h.
| enum pf_native_side_t |
Side of a kernel-sized opening.
| Enumerator | |
|---|---|
| PF_NATIVE_SIDE_LONG | |
| PF_NATIVE_SIDE_SHORT | |
Definition at line 262 of file native_c_api.h.
Sizing basis — the alternative index of native_order::SizeBasis.
| Enumerator | |
|---|---|
| PF_NATIVE_SIZE_BASIS_CASH |
|
| PF_NATIVE_SIZE_BASIS_EQUITY_FRACTION |
|
Definition at line 268 of file native_c_api.h.
When a sizing basis resolves.
| Enumerator | |
|---|---|
| PF_NATIVE_SIZE_AT_MATCH | |
| PF_NATIVE_SIZE_AT_ACCEPTANCE | |
Definition at line 274 of file native_c_api.h.
Whether resolved sizing snaps onto the run's quantity grid.
| Enumerator | |
|---|---|
| PF_NATIVE_GRID_SNAP | |
| PF_NATIVE_GRID_EXPLICIT_UNITS | |
Definition at line 280 of file native_c_api.h.
| enum pf_native_trigger_t |
Trigger — the alternative index of native_order::Trigger.
Definition at line 286 of file native_c_api.h.
| enum pf_native_anchor_t |
Where a trigger level comes from — native_order::TriggerAnchor (L7).
| Enumerator | |
|---|---|
| PF_NATIVE_ANCHOR_ABSOLUTE | The level written in the trigger. |
| PF_NATIVE_ANCHOR_FROM_OWNER_FILL | owner fill + |
Definition at line 295 of file native_c_api.h.
How a materialized anchored level snaps onto the run's price tick ladder — native_order::NativeAnchorRounding (L7b).
RAW is the established behaviour; the other two need price_tick > 0 at acceptance.
Definition at line 303 of file native_c_api.h.
Whether a WAIT_FOR_APPLIED child is a working order before its arm — native_order::NativeArmVisibility (L7b).
PENDING_UNTIL_ARMED keeps it out of strategy_native_working_len_v1 / strategy_native_working_get_v1 until its ArmedEvent; it stays a live request the whole time (replace, cancel, cancel_all still address it, and it never matches before the arm under either value).
| Enumerator | |
|---|---|
| PF_NATIVE_ARM_VISIBILITY_WORKING | |
| PF_NATIVE_ARM_VISIBILITY_PENDING_UNTIL_ARMED | |
Definition at line 315 of file native_c_api.h.
| enum pf_native_capacity_t |
Capacity — the alternative index of native_order::Capacity.
| Enumerator | |
|---|---|
| PF_NATIVE_CAPACITY_IMMEDIATE | Whole remaining at one point. |
| PF_NATIVE_CAPACITY_POINT_BUDGET |
|
Definition at line 321 of file native_c_api.h.
| enum pf_native_owner_t |
Owner — the alternative index of native_order::Owner.
| Enumerator | |
|---|---|
| PF_NATIVE_OWNER_INDEPENDENT | No owner. |
| PF_NATIVE_OWNER_WAIT_FOR_APPLIED | One parent in |
| PF_NATIVE_OWNER_BIND_OPENING | One opening + |
| PF_NATIVE_OWNER_BIND_OPENINGS |
|
| PF_NATIVE_OWNER_BIND_COHORT |
The kernel pairs this owner with exactly one intent — a host-sized CLOSE — so a cohort close is spelled PF_NATIVE_INTENT_HOST_SIZED with this owner and no quantity of its own: the roster's live openings are the target and the cohort authority decides the units. That pairing is the only shape in which HOST_SIZED is accepted here. |
Definition at line 327 of file native_c_api.h.
| enum pf_native_group_t |
Group — the alternative index of native_order::Group.
| Enumerator | |
|---|---|
| PF_NATIVE_GROUP_NONE | |
| PF_NATIVE_GROUP_MEMBER |
|
Definition at line 342 of file native_c_api.h.
What a filled group member does to its siblings.
| Enumerator | |
|---|---|
| PF_NATIVE_GROUP_CANCEL | |
| PF_NATIVE_GROUP_REDUCE | |
Definition at line 348 of file native_c_api.h.
Which identity text strategy_native_cancel_where_v1 compares.
Both are the free text the request carried: comment is the established selector, label is where a host that names its orders puts its own id, so LABEL is the one call that withdraws every live request issued under one such id. Neither is indexed; both walk the live book once.
| Enumerator | |
|---|---|
| PF_NATIVE_FIELD_COMMENT | |
| PF_NATIVE_FIELD_LABEL | |
Definition at line 359 of file native_c_api.h.
Price rule of an immediate execution.
| Enumerator | |
|---|---|
| PF_NATIVE_PRICE_AS_PRESENTED | |
| PF_NATIVE_PRICE_NEAREST_TICK | |
Definition at line 365 of file native_c_api.h.
Outcome of strategy_native_execute_current_v1 (non-negative returns).
Definition at line 371 of file native_c_api.h.
| enum pf_native_refusal_t |
Why execute_current refused.
Written to *refusal, if supplied, when strategy_native_execute_current_v1 answers PF_NATIVE_E_REFUSED. Mirrors NativeCurrentRefusal.
Definition at line 381 of file native_c_api.h.
Lifecycle of the native run — mirrors NativeLifecycleKind.
| Enumerator | |
|---|---|
| PF_NATIVE_LIFECYCLE_UNCONFIGURED | |
| PF_NATIVE_LIFECYCLE_READY | |
| PF_NATIVE_LIFECYCLE_RUNNING | |
| PF_NATIVE_LIFECYCLE_COMPLETED | |
| PF_NATIVE_LIFECYCLE_FAILED | |
Definition at line 394 of file native_c_api.h.
Event tag of pf_native_event_v1.
1..18 are the first eighteen alternatives of native_order::CommandEvent, in variant order plus one; 19 and 20 are the driver-point and account observations native_events() also carries. 21 is L9's NativeRiskEvent, the nineteenth CommandEvent alternative: it was added after this header froze, so it keeps a tag of its own past the two observations rather than taking 19 and renumbering them. A reader compiled before it skips it by tag, exactly as it must skip any tag it does not know.
One kind named in the design is NOT represented and never appears here: a completed higher-timeframe bucket, delivered only through on_timeframe_bar and never recorded in the event history.
Definition at line 415 of file native_c_api.h.
Which generic risk limit a PF_NATIVE_EVENT_RISK event reports — the reason field of pf_native_event_v1, mirroring native_order::RiskLimitKind (L9).
| Enumerator | |
|---|---|
| PF_NATIVE_RISK_MAX_DRAWDOWN | |
| PF_NATIVE_RISK_MAX_INTRADAY_LOSS | |
| PF_NATIVE_RISK_MAX_CONSECUTIVE_LOSS_DAYS | |
| PF_NATIVE_RISK_MAX_FILLS_PER_DAY | |
Definition at line 442 of file native_c_api.h.
| enum pf_native_risk_day_t |
Which day a risk limit's "day" is — NativeRiskDay.
SESSION is the run's own session calendar (an overnight session is one day); CALENDAR_TIMEZONE is the civil date in the spec's scheduling timezone.
| Enumerator | |
|---|---|
| PF_NATIVE_RISK_DAY_SESSION | |
| PF_NATIVE_RISK_DAY_CALENDAR_TIMEZONE | |
Definition at line 452 of file native_c_api.h.
What a breach does — NativeRiskAction.
BLOCK_OPENINGS refuses every opening while the block lasts and leaves the live book alone; FLATTEN_AND_BLOCK first closes the book with one kernel-originated Flatten.
| Enumerator | |
|---|---|
| PF_NATIVE_RISK_BLOCK_OPENINGS | |
| PF_NATIVE_RISK_FLATTEN_AND_BLOCK | |
Definition at line 461 of file native_c_api.h.
Remaining projection of a live request — native_order::RemainingProjection.
| Enumerator | |
|---|---|
| PF_NATIVE_REMAINING_UNBOUND | |
| PF_NATIVE_REMAINING_FLATTEN_ALL | |
| PF_NATIVE_REMAINING_UNITS |
|
| PF_NATIVE_REMAINING_DEFERRED | |
| PF_NATIVE_REMAINING_NO_TARGET | |
Definition at line 467 of file native_c_api.h.
Trigger state of a live request — native_order::TriggerState.
Definition at line 476 of file native_c_api.h.
Which extension blocks of pf_native_run_spec_ext_v1 are meaningful.
| Enumerator | |
|---|---|
| PF_NATIVE_SPEC_EXT_REPORT | |
| PF_NATIVE_SPEC_EXT_PRICE_GRID | |
| PF_NATIVE_SPEC_EXT_CALCULATION | |
| PF_NATIVE_SPEC_EXT_OPEN_BAR_VIEW | |
| PF_NATIVE_SPEC_EXT_MARGIN | |
| PF_NATIVE_SPEC_EXT_SUBSCRIPTIONS | |
| PF_NATIVE_SPEC_EXT_RISK | L9's generic risk limits. Only a caller whose pf_native_run_spec_ext_v1 carries the risk tail may set this bit; a caller sending the base layout is refused with PF_NATIVE_E_STRUCT. |
| PF_NATIVE_SPEC_EXT_INTRABAR | The retained intrabar execution path. Needs the N8 tail. |
| PF_NATIVE_SPEC_EXT_FEED_POLICY | The four feed-shape and presentation policies: slot labels, feed tolerance, the forced path order and abort reporting. Needs the N8 tail. |
| PF_NATIVE_SPEC_EXT_AUXILIARY_FEED | The auxiliary finer feed. Only a caller whose pf_native_run_spec_ext_v1 carries the auxiliary tail may set this bit; a caller sending any earlier layout is refused with PF_NATIVE_E_STRUCT. |
Definition at line 489 of file native_c_api.h.
The bars a declared series is built from — NativeSeriesSource.
| Enumerator | |
|---|---|
| PF_NATIVE_SERIES_SOURCE_INPUT | The accepted input (the default). |
| PF_NATIVE_SERIES_SOURCE_AUXILIARY_FEED | The run's auxiliary finer feed. |
Definition at line 514 of file native_c_api.h.
WHICH price a kernel-sized basis converts at — native_order::SizePrice (L3b).
RESOLVED is the established behaviour: the price the kernel would otherwise settle at. SIGNAL is the decision-point price at placement, carried to the expected fill by the side's slippage and rounded onto the run's fill grid. SIGNAL_ON_TICK is that same rule measured on the INSTRUMENT's own tick ladder (price_tick) instead of the fill grid, rounded before the slippage as well as after.
| Enumerator | |
|---|---|
| PF_NATIVE_SIZE_PRICE_RESOLVED | |
| PF_NATIVE_SIZE_PRICE_SIGNAL | |
| PF_NATIVE_SIZE_PRICE_SIGNAL_ON_TICK | |
Definition at line 526 of file native_c_api.h.
WHICH measurement of the bound scope a fractional reduce takes its fraction of — native_order::ScopeBasis.
AT_MATCH reads the scope as it stands at the matching candidate. AT_ACCEPTANCE freezes the scope SIZE when the request is accepted, so two 50 % siblings on one 10-unit lot both claim 5 under GROSS even after the first has executed.
| Enumerator | |
|---|---|
| PF_NATIVE_SCOPE_BASIS_AT_MATCH | |
| PF_NATIVE_SCOPE_BASIS_AT_ACCEPTANCE | |
Definition at line 537 of file native_c_api.h.
When the kernel tests the maintenance requirement — NativeLiquidationCheck, the margin_check field of pf_native_run_spec_ext_v1.
Definition at line 545 of file native_c_api.h.
Which equity the maintenance requirement is tested against — NativeMarginEquityBasis.
| Enumerator | |
|---|---|
| PF_NATIVE_MARGIN_EQUITY_MARKED | |
| PF_NATIVE_MARGIN_EQUITY_BEFORE_OPEN_COMMISSION | |
Definition at line 553 of file native_c_api.h.
Which base the liquidation level is solved from — NativeLiquidationLevelBase.
| Enumerator | |
|---|---|
| PF_NATIVE_MARGIN_LEVEL_MARKED_EQUITY | |
| PF_NATIVE_MARGIN_LEVEL_REALIZED_ONLY | |
Definition at line 560 of file native_c_api.h.
Which intrabar execution path the run retains — the alternative of IntrabarPath.
NONE is the whole default surface. LOWER_TF retains the caller's own finer bars (and is the one mode that delivers pf_native_callbacks_v1::on_sub_bar). SYNTHESIZED samples each script bar's own OHLC path through the generic sampler and retains no feed.
| Enumerator | |
|---|---|
| PF_NATIVE_INTRABAR_NONE | |
| PF_NATIVE_INTRABAR_LOWER_TF | |
| PF_NATIVE_INTRABAR_SYNTHESIZED | |
Definition at line 570 of file native_c_api.h.
Whether matching stays continuous between generated samples — IntrabarPath::SampleEligibility.
LOWER_TF only; a synthesized path's point-only eligibility is inherent to that mode.
| Enumerator | |
|---|---|
| PF_NATIVE_SAMPLE_CONTINUOUS_SEGMENTS | |
| PF_NATIVE_SAMPLE_DISTRIBUTION_SAMPLES | |
Definition at line 579 of file native_c_api.h.
Whether a confirmed bar must name a canonical input slot — NativeSlotLabelPolicy.
A feed-shape policy, not a source-language one; the two modes never share a continuation.
| Enumerator | |
|---|---|
| PF_NATIVE_SLOT_LABEL_CANONICAL | |
| PF_NATIVE_SLOT_LABEL_FEED_TOLERANT | |
Definition at line 587 of file native_c_api.h.
Opt-in admission exceptions for a tolerated input-feed shape — NativeFeedTolerance.
A BIT MASK, not an enumerator: the values combine, and any bit outside this set is PF_NATIVE_E_TAG.
Definition at line 595 of file native_c_api.h.
Generic ordering for a modeled OHLC path — NativePathOrder.
AUTO keeps the open-proximity rule; the forced modes make the first excursion explicit for replay and live hosts.
| Enumerator | |
|---|---|
| PF_NATIVE_PATH_ORDER_AUTO | |
| PF_NATIVE_PATH_ORDER_HIGH_FIRST | |
| PF_NATIVE_PATH_ORDER_LOW_FIRST | |
Definition at line 606 of file native_c_api.h.
How a cooperative abort is presented — NativeAbortReporting.
| Enumerator | |
|---|---|
| PF_NATIVE_ABORT_ERROR | |
| PF_NATIVE_ABORT_QUIET | |
Definition at line 613 of file native_c_api.h.
Why the kernel is asking the host to calculate — NativeCalculationReason (L5), the reason argument of pf_native_callbacks_v1::on_recalculate.
SUB_BAR is reserved and never delivered there: a lower-timeframe sub-bar has its own hook, pf_native_callbacks_v1::on_sub_bar.
Definition at line 622 of file native_c_api.h.
Which kernel check point is about to test the maintenance requirement — NativeMarginCheckKind (L4b).
These are the kernel's own points; a broker model that checks somewhere else is host policy, expressed by suppressing the points it does not share.
| Enumerator | |
|---|---|
| PF_NATIVE_MARGIN_CHECK_BAR_OPEN | The script bar's open. |
| PF_NATIVE_MARGIN_CHECK_AFTER_APPLIED | The re-arm after a point's fills. |
| PF_NATIVE_MARGIN_CHECK_CALCULATION | A CalculationOnly model's calculation. |
| PF_NATIVE_MARGIN_CHECK_FX_ROLL | A step of the run's declared pf_native_fx_curve_v1: the first point the account converts at a new rate, offered immediately before that point is matched. A run that declares no curve has none, and a CalculationOnly model, which measures at its calculation alone, is not offered it. |
Definition at line 633 of file native_c_api.h.
| enum pf_native_answer_t |
What an ANSWERING callback's return value means.
The four answering hooks of pf_native_callbacks_v1 do not report success: their return value selects WHOSE answer the kernel uses, so every value is in contract and an answering hook can never fail the run. A host that needs to abort does it from an observation callback, which keeps the "non-zero ends the run Failed" rule exactly where it already was.
| Enumerator | |
|---|---|
| PF_NATIVE_ANSWER_DEFAULT | Keep the kernel's own; the output is ignored. |
| PF_NATIVE_ANSWER_PROVIDED | Use the output. Any non-zero value means this. |
Definition at line 654 of file native_c_api.h.