PineForge unreleased
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
pf_native_event_v1 Struct Reference

One recorded event, read back by strategy_native_events_v1. More...

#include <native_c_api.h>

Data Fields

uint32_t struct_size
 sizeof(pf_native_event_v1).
 
uint32_t version
 PF_NATIVE_API_VERSION.
 
uint32_t kind
 pf_native_event_kind_t.
 
uint32_t reason
 Per-kind reason enumerator, 0 when none.
 
uint64_t ordinal
 Event ordinal; strictly increasing.
 
uint64_t incarnation
 Subject request, 0 when the kind has none.
 
uint64_t successor
 REPLACED: the new handle.
 
double raw_price
 
double resolved_price
 
double price
 
double closed_units
 
double opened_units
 
int64_t cycle_before
 
int64_t cycle_after
 
int64_t effective_time_ms
 Cursor effective time, 0 when the kind has no cursor.
 
int32_t interval_index
 Cursor interval index.
 
uint8_t provenance
 Cursor pf_native_price_provenance_t.
 
uint8_t path_phase
 Cursor pf_native_path_phase_t.
 
uint8_t terminal
 APPLIED only.
 
uint8_t reserved0 [3]
 

Detailed Description

One recorded event, read back by strategy_native_events_v1.

kind tags the union: every field below is documented per kind and is zero where that kind has no such fact. reason is read by the kind's own enumeration, and is 0 for a kind that names none.

  • ACCEPTED / ARMED: incarnation.
  • REJECTED: reason is a pf_native_reject_reason_t.
  • REPLACE_REJECTED: incarnation is the target, reason a pf_native_reject_reason_t.
  • REPLACED: incarnation is the predecessor, successor the new handle.
  • CANCELLED: reason is a pf_native_cancel_reason_t.
  • NOT_WORKING / INVALID_HANDLE: incarnation is the target.
  • NO_EFFECT: incarnation, cursor fields.
  • MATCH_REJECTED: reason is a pf_native_match_reject_t, cursor fields.
  • APPLIED: every price/unit/cycle field, terminal, cursor fields; when terminal is 1, reason is the pf_native_terminal_reason_t that finished the request.
  • CLOSE_BOUND: reason is the pf_native_side_t of the book the close bound to, cycle_after its cycle, cursor fields.
  • RESERVATION_REDUCED / DEFERRED_GROUP: incarnation is the recipient, reason its pf_native_group_effect_t, closed_units the deduction (applied, or deferred); 0 when it was absorbed – too small to move the recipient's remaining units, or its pending total, in binary64, which stay as they were (R5 lane K-ULP5).
  • QUANTITY_BOUND: incarnation, opened_units = the source units.
  • TERMS_RESOLVED: raw_price, resolved_price (= price), cursor fields.
  • MARGIN_CALL: reason is the pf_native_side_t of the liquidated position, price = mark, closed_units = liquidated units, opened_units = the signed position after it, raw_price = the re-solved liquidation price. The call's equity, requirement and the position before it are strategy_native_margin_call_v1's.
  • ACTIVATED: reason is a pf_native_activation_t, price the reached price.
  • DRIVER_POINT: cursor fields and raw_price.
  • ACCOUNT: price = marked equity, raw_price = realized balance, opened_units = signed position units.
  • RISK: reason is a pf_native_risk_limit_t, price = the observed value that reached the limit, raw_price = the limit it was measured against (account currency for the two loss limits — a percent limit is already resolved against its basis equity — days or fills for the two counts), cycle_before = the risk day the breach happened on, on the spec's own day basis, successor = the cursor's matching-point ordinal, cursor fields set. The event names no request: it is an account fact, so incarnation stays 0.

Definition at line 1633 of file native_c_api.h.

Field Documentation

◆ struct_size

uint32_t pf_native_event_v1::struct_size

sizeof(pf_native_event_v1).

Definition at line 1634 of file native_c_api.h.

◆ version

uint32_t pf_native_event_v1::version

PF_NATIVE_API_VERSION.

Definition at line 1635 of file native_c_api.h.

◆ kind

uint32_t pf_native_event_v1::kind

pf_native_event_kind_t.

Definition at line 1636 of file native_c_api.h.

◆ reason

uint32_t pf_native_event_v1::reason

Per-kind reason enumerator, 0 when none.

Definition at line 1637 of file native_c_api.h.

◆ ordinal

uint64_t pf_native_event_v1::ordinal

Event ordinal; strictly increasing.

Definition at line 1638 of file native_c_api.h.

◆ incarnation

uint64_t pf_native_event_v1::incarnation

Subject request, 0 when the kind has none.

Definition at line 1639 of file native_c_api.h.

◆ successor

uint64_t pf_native_event_v1::successor

REPLACED: the new handle.

RISK: the cursor's matching-point ordinal. 0 otherwise.

Definition at line 1640 of file native_c_api.h.

◆ raw_price

double pf_native_event_v1::raw_price

Definition at line 1642 of file native_c_api.h.

◆ resolved_price

double pf_native_event_v1::resolved_price

Definition at line 1643 of file native_c_api.h.

Referenced by run_mode().

◆ price

double pf_native_event_v1::price

Definition at line 1644 of file native_c_api.h.

◆ closed_units

double pf_native_event_v1::closed_units

Definition at line 1645 of file native_c_api.h.

◆ opened_units

double pf_native_event_v1::opened_units

Definition at line 1646 of file native_c_api.h.

◆ cycle_before

int64_t pf_native_event_v1::cycle_before

Definition at line 1647 of file native_c_api.h.

◆ cycle_after

int64_t pf_native_event_v1::cycle_after

Definition at line 1648 of file native_c_api.h.

◆ effective_time_ms

int64_t pf_native_event_v1::effective_time_ms

Cursor effective time, 0 when the kind has no cursor.

Definition at line 1649 of file native_c_api.h.

◆ interval_index

int32_t pf_native_event_v1::interval_index

Cursor interval index.

Definition at line 1650 of file native_c_api.h.

◆ provenance

uint8_t pf_native_event_v1::provenance

Cursor pf_native_price_provenance_t.

Definition at line 1651 of file native_c_api.h.

◆ path_phase

uint8_t pf_native_event_v1::path_phase

Cursor pf_native_path_phase_t.

Definition at line 1652 of file native_c_api.h.

◆ terminal

uint8_t pf_native_event_v1::terminal

APPLIED only.

Definition at line 1653 of file native_c_api.h.

◆ reserved0

uint8_t pf_native_event_v1::reserved0[3]

Definition at line 1654 of file native_c_api.h.


The documentation for this struct was generated from the following file: