PineForge v0.13.1-379-g9b50973
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
native_c_api.h File Reference
#include <stdint.h>
#include <stddef.h>
#include <pineforge/pineforge.h>
Include dependency graph for native_c_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pf_native_decision_v1
 Where the kernel is, presented to every callback. More...
 
struct  pf_native_applied_v1
 One applied execution, presented to on_applied. More...
 
struct  pf_native_event_v1
 One recorded event, read back by strategy_native_events_v1. More...
 
struct  pf_native_working_v1
 One live request, copied out by strategy_native_working_get_v1. More...
 
struct  pf_native_open_lot_v1
 One open physical lot, copied out by strategy_native_open_lot_get_v1 — the C spelling of NativeOpenLot (R5 gap lane N18): the book that strategy_native_position_v1 aggregates, lot by lot, marked at the price strategy_native_open_lot_count_v1 was given. More...
 
struct  pf_native_state_v1
 The run's lifecycle and its typed failure. More...
 
struct  pf_native_trail_state_v1
 The trail projection of strategy_native_trail_state_v1 — the C spelling of NativeTrailState. More...
 
struct  pf_native_margin_view_v1
 The facts one margin hook is handed — the C spelling of NativeMarginRequirementView, NativeMarginCheckPoint and NativeMarginCallView, which differ only in which of these facts they carry. More...
 
struct  pf_native_margin_decision_v1
 The host's answer to one requirement view — NativeMarginDecision. More...
 
struct  pf_native_close_view_v1
 The facts a host-sized CLOSE is resolved from, handed to pf_native_callbacks_v1::on_close_units. More...
 
struct  pf_native_lot_excursion_v1
 One closing lot's booking facts — ClosedLotExcursionFacts (RULING A48). More...
 
struct  pf_native_risk_state_v1
 The run's generic risk ledger — the C spelling of NativeRiskState (L9). More...
 
struct  pf_native_request_v1
 One order request. More...
 
struct  pf_native_subscription_v1
 One declared higher-timeframe series of pf_native_run_spec_ext_v1. More...
 
struct  pf_native_run_spec_ext_v1
 The run-specification fields pf_native_run_spec_v1 predates. More...
 
struct  pf_native_callbacks_v1
 The C host's strategy logic. More...
 

Macros

#define PINEFORGE_HAS_NATIVE_C_API_V1   1
 Feature probe for the C-level native host API.
 
#define PF_NATIVE_API_VERSION   1
 Monotonic version of this header's native-C layouts.
 
#define PF_NATIVE_OK   0
 Success.
 
#define PF_NATIVE_E_HANDLE   -1
 NULL handle, or not a C-callback native host.
 
#define PF_NATIVE_E_STRUCT   -2
 struct_size / version mismatch.
 
#define PF_NATIVE_E_TAG   -3
 An enum field outside its enumeration.
 
#define PF_NATIVE_E_ARGUMENT   -4
 NULL output, negative count, out-of-range index.
 
#define PF_NATIVE_E_STATE   -5
 Illegal here: the command legality rule, or the kernel's own lifecycle, refused it.
 
#define PF_NATIVE_E_REJECTED   -6
 The kernel rejected the request (reason written out).
 
#define PF_NATIVE_E_UNSUPPORTED   -7
 A tag this API version cannot represent.
 
#define PF_NATIVE_E_EXCEPTION   -8
 A C++ exception was contained at the boundary.
 
#define PF_NATIVE_E_NOT_WORKING   -9
 The target handle is no longer a live request.
 
#define PF_NATIVE_E_INVALID_TARGET   -10
 The target handle was never issued by this run.
 
#define PF_NATIVE_E_RUN_FAILED   -11
 The run did not reach Completed; read the state.
 
#define PF_NATIVE_E_REFUSED   -12
 execute_current refused; see pf_native_refusal_e.
 
#define PF_NATIVE_ABSENT   1
 Non-negative outcome: the kernel HAS no answer here and the output was left at its documented empty.
 
#define PF_NATIVE_FAILURE_CALLBACK   5
 NativeFailureCode::CallbackException — the code latched when a C callback returns non-zero.
 
#define PF_NATIVE_REQUEST_V1_BASE_SIZE    ((uint32_t)offsetof(pf_native_request_v1, anchor_rounding))
 Byte length of pf_native_request_v1 as the L13 lane first published it, before the anchored-leg tail was appended.
 
#define PF_NATIVE_REQUEST_V1_ANCHOR_SIZE    ((uint32_t)offsetof(pf_native_request_v1, size_price))
 Byte length of pf_native_request_v1 with L7b's anchored-leg tail but without L3b's sizing-detail tail — the second of its three published layouts.
 
#define PF_NATIVE_RUN_SPEC_EXT_V1_BASE_SIZE    ((uint32_t)offsetof(pf_native_run_spec_ext_v1, risk_has_max_drawdown))
 Byte length of pf_native_run_spec_ext_v1 as the L13 lane first published it, before the risk_* tail was appended.
 
#define PF_NATIVE_RUN_SPEC_EXT_V1_RISK_SIZE    ((uint32_t)offsetof(pf_native_run_spec_ext_v1, intrabar_kind))
 Byte length of pf_native_run_spec_ext_v1 with L9's risk tail but without N8's intrabar / policy tail — the second of its four published layouts.
 
#define PF_NATIVE_RUN_SPEC_EXT_V1_POLICY_SIZE    ((uint32_t)offsetof(pf_native_run_spec_ext_v1, auxiliary_tf))
 Byte length of pf_native_run_spec_ext_v1 with N8's intrabar / policy tail but before the auxiliary_* tail was appended — the third of its four published layouts.
 
#define PF_NATIVE_CALLBACKS_V1_BASE_SIZE    ((uint32_t)offsetof(pf_native_callbacks_v1, on_recalculate))
 Byte length of pf_native_callbacks_v1 as the L13 lane first published it, before the six-hook tail was appended.
 

Enumerations

enum  pf_native_intent_t {
  PF_NATIVE_INTENT_FLATTEN = 0 ,
  PF_NATIVE_INTENT_REDUCE = 1 ,
  PF_NATIVE_INTENT_TRANSACT = 2 ,
  PF_NATIVE_INTENT_REVERSE_TO = 3 ,
  PF_NATIVE_INTENT_HOST_SIZED = 4 ,
  PF_NATIVE_INTENT_SIZED = 5
}
 Order intent — the alternative index of native_order::OrderIntent. More...
 
enum  pf_native_reduction_t {
  PF_NATIVE_REDUCE_EXPLICIT_UNITS = 0 ,
  PF_NATIVE_REDUCE_OWNER_OPENED = 1 ,
  PF_NATIVE_REDUCE_SCOPE_FRACTION = 2
}
 Reduction size — the alternative index of native_order::ReductionSize. More...
 
enum  pf_native_scope_claim_t {
  PF_NATIVE_SCOPE_GROSS = 0 ,
  PF_NATIVE_SCOPE_NET_OF_SIBLINGS = 1
}
 Scope claim of a fractional reduce. More...
 
enum  pf_native_side_t {
  PF_NATIVE_SIDE_LONG = 0 ,
  PF_NATIVE_SIDE_SHORT = 1
}
 Side of a kernel-sized opening. More...
 
enum  pf_native_size_basis_t {
  PF_NATIVE_SIZE_BASIS_CASH = 0 ,
  PF_NATIVE_SIZE_BASIS_EQUITY_FRACTION = 1
}
 Sizing basis — the alternative index of native_order::SizeBasis. More...
 
enum  pf_native_size_time_t {
  PF_NATIVE_SIZE_AT_MATCH = 0 ,
  PF_NATIVE_SIZE_AT_ACCEPTANCE = 1
}
 When a sizing basis resolves. More...
 
enum  pf_native_grid_policy_t {
  PF_NATIVE_GRID_SNAP = 0 ,
  PF_NATIVE_GRID_EXPLICIT_UNITS = 1
}
 Whether resolved sizing snaps onto the run's quantity grid. More...
 
enum  pf_native_trigger_t {
  PF_NATIVE_TRIGGER_MARKET = 0 ,
  PF_NATIVE_TRIGGER_LIMIT = 1 ,
  PF_NATIVE_TRIGGER_STOP = 2 ,
  PF_NATIVE_TRIGGER_STOP_LIMIT = 3 ,
  PF_NATIVE_TRIGGER_TRAIL = 4
}
 Trigger — the alternative index of native_order::Trigger. More...
 
enum  pf_native_anchor_t {
  PF_NATIVE_ANCHOR_ABSOLUTE = 0 ,
  PF_NATIVE_ANCHOR_FROM_OWNER_FILL = 1
}
 Where a trigger level comes from — native_order::TriggerAnchor (L7). More...
 
enum  pf_native_anchor_rounding_t {
  PF_NATIVE_ANCHOR_ROUNDING_RAW = 0 ,
  PF_NATIVE_ANCHOR_ROUNDING_HALF_UP = 1 ,
  PF_NATIVE_ANCHOR_ROUNDING_DIRECTIONAL = 2
}
 How a materialized anchored level snaps onto the run's price tick ladder — native_order::NativeAnchorRounding (L7b). More...
 
enum  pf_native_arm_visibility_t {
  PF_NATIVE_ARM_VISIBILITY_WORKING = 0 ,
  PF_NATIVE_ARM_VISIBILITY_PENDING_UNTIL_ARMED = 1
}
 Whether a WAIT_FOR_APPLIED child is a working order before its arm — native_order::NativeArmVisibility (L7b). More...
 
enum  pf_native_capacity_t {
  PF_NATIVE_CAPACITY_IMMEDIATE = 0 ,
  PF_NATIVE_CAPACITY_POINT_BUDGET = 1
}
 Capacity — the alternative index of native_order::Capacity. More...
 
enum  pf_native_owner_t {
  PF_NATIVE_OWNER_INDEPENDENT = 0 ,
  PF_NATIVE_OWNER_WAIT_FOR_APPLIED = 1 ,
  PF_NATIVE_OWNER_BIND_OPENING = 2 ,
  PF_NATIVE_OWNER_BIND_OPENINGS = 3 ,
  PF_NATIVE_OWNER_BIND_COHORT = 4
}
 Owner — the alternative index of native_order::Owner. More...
 
enum  pf_native_group_t {
  PF_NATIVE_GROUP_NONE = 0 ,
  PF_NATIVE_GROUP_MEMBER = 1
}
 Group — the alternative index of native_order::Group. More...
 
enum  pf_native_group_effect_t {
  PF_NATIVE_GROUP_CANCEL = 0 ,
  PF_NATIVE_GROUP_REDUCE = 1
}
 What a filled group member does to its siblings. More...
 
enum  pf_native_request_field_t {
  PF_NATIVE_FIELD_COMMENT = 0 ,
  PF_NATIVE_FIELD_LABEL = 1
}
 Which identity text strategy_native_cancel_where_v1 compares. More...
 
enum  pf_native_price_rule_t {
  PF_NATIVE_PRICE_AS_PRESENTED = 0 ,
  PF_NATIVE_PRICE_NEAREST_TICK = 1
}
 Price rule of an immediate execution. More...
 
enum  pf_native_execute_outcome_t {
  PF_NATIVE_EXECUTED_APPLIED = 0 ,
  PF_NATIVE_EXECUTED_NO_EFFECT = 1 ,
  PF_NATIVE_EXECUTED_MATCH_REJECTED = 2 ,
  PF_NATIVE_EXECUTED_CANCELLED = 3
}
 Outcome of strategy_native_execute_current_v1 (non-negative returns). More...
 
enum  pf_native_refusal_t {
  PF_NATIVE_REFUSAL_NO_EXECUTION_CONTEXT = 0 ,
  PF_NATIVE_REFUSAL_REENTRANT = 1 ,
  PF_NATIVE_REFUSAL_INVALID_HANDLE = 2 ,
  PF_NATIVE_REFUSAL_NOT_WORKING = 3 ,
  PF_NATIVE_REFUSAL_NOT_ACCEPTED_IN_CALLBACK = 4 ,
  PF_NATIVE_REFUSAL_UNSUPPORTED_REQUEST = 5 ,
  PF_NATIVE_REFUSAL_UNREADY_OWNER = 6 ,
  PF_NATIVE_REFUSAL_INVALID_SELECTION = 7 ,
  PF_NATIVE_REFUSAL_CONFIGURATION_MISMATCH = 8
}
 Why execute_current refused. More...
 
enum  pf_native_lifecycle_t {
  PF_NATIVE_LIFECYCLE_UNCONFIGURED = 0 ,
  PF_NATIVE_LIFECYCLE_READY = 1 ,
  PF_NATIVE_LIFECYCLE_RUNNING = 2 ,
  PF_NATIVE_LIFECYCLE_COMPLETED = 3 ,
  PF_NATIVE_LIFECYCLE_FAILED = 4
}
 Lifecycle of the native run — mirrors NativeLifecycleKind. More...
 
enum  pf_native_event_kind_t {
  PF_NATIVE_EVENT_ACCEPTED = 1 ,
  PF_NATIVE_EVENT_REJECTED = 2 ,
  PF_NATIVE_EVENT_REPLACED = 3 ,
  PF_NATIVE_EVENT_REPLACE_REJECTED = 4 ,
  PF_NATIVE_EVENT_CANCELLED = 5 ,
  PF_NATIVE_EVENT_NOT_WORKING = 6 ,
  PF_NATIVE_EVENT_INVALID_HANDLE = 7 ,
  PF_NATIVE_EVENT_NO_EFFECT = 8 ,
  PF_NATIVE_EVENT_MATCH_REJECTED = 9 ,
  PF_NATIVE_EVENT_APPLIED = 10 ,
  PF_NATIVE_EVENT_CLOSE_BOUND = 11 ,
  PF_NATIVE_EVENT_ACTIVATED = 12 ,
  PF_NATIVE_EVENT_RESERVATION_REDUCED = 13 ,
  PF_NATIVE_EVENT_DEFERRED_GROUP = 14 ,
  PF_NATIVE_EVENT_QUANTITY_BOUND = 15 ,
  PF_NATIVE_EVENT_ARMED = 16 ,
  PF_NATIVE_EVENT_TERMS_RESOLVED = 17 ,
  PF_NATIVE_EVENT_MARGIN_CALL = 18 ,
  PF_NATIVE_EVENT_DRIVER_POINT = 19 ,
  PF_NATIVE_EVENT_ACCOUNT = 20 ,
  PF_NATIVE_EVENT_RISK = 21
}
 Event tag of pf_native_event_v1. More...
 
enum  pf_native_risk_limit_t {
  PF_NATIVE_RISK_MAX_DRAWDOWN = 0 ,
  PF_NATIVE_RISK_MAX_INTRADAY_LOSS = 1 ,
  PF_NATIVE_RISK_MAX_CONSECUTIVE_LOSS_DAYS = 2 ,
  PF_NATIVE_RISK_MAX_FILLS_PER_DAY = 3
}
 Which generic risk limit a PF_NATIVE_EVENT_RISK event reports — the reason field of pf_native_event_v1, mirroring native_order::RiskLimitKind (L9). More...
 
enum  pf_native_risk_day_t {
  PF_NATIVE_RISK_DAY_SESSION = 0 ,
  PF_NATIVE_RISK_DAY_CALENDAR_TIMEZONE = 1
}
 Which day a risk limit's "day" is — NativeRiskDay. More...
 
enum  pf_native_risk_action_t {
  PF_NATIVE_RISK_BLOCK_OPENINGS = 0 ,
  PF_NATIVE_RISK_FLATTEN_AND_BLOCK = 1
}
 What a breach does — NativeRiskAction. More...
 
enum  pf_native_remaining_t {
  PF_NATIVE_REMAINING_UNBOUND = 0 ,
  PF_NATIVE_REMAINING_FLATTEN_ALL = 1 ,
  PF_NATIVE_REMAINING_UNITS = 2 ,
  PF_NATIVE_REMAINING_DEFERRED = 3 ,
  PF_NATIVE_REMAINING_NO_TARGET = 4
}
 Remaining projection of a live request — native_order::RemainingProjection. More...
 
enum  pf_native_trigger_state_t {
  PF_NATIVE_TRIGGER_STATE_MARKET_READY = 0 ,
  PF_NATIVE_TRIGGER_STATE_LIMIT_READY = 1 ,
  PF_NATIVE_TRIGGER_STATE_STOP_IDLE = 2 ,
  PF_NATIVE_TRIGGER_STATE_STOP_ACTIVE = 3 ,
  PF_NATIVE_TRIGGER_STATE_STOP_LIMIT_PENDING = 4 ,
  PF_NATIVE_TRIGGER_STATE_STOP_LIMIT_LIVE = 5 ,
  PF_NATIVE_TRIGGER_STATE_TRAIL_WAIT_ARM = 6 ,
  PF_NATIVE_TRIGGER_STATE_TRAIL_TRACK = 7 ,
  PF_NATIVE_TRIGGER_STATE_TRAIL_ACTIVE = 8
}
 Trigger state of a live request — native_order::TriggerState. More...
 
enum  pf_native_spec_ext_mask_t {
  PF_NATIVE_SPEC_EXT_REPORT = 1u << 0 ,
  PF_NATIVE_SPEC_EXT_PRICE_GRID = 1u << 1 ,
  PF_NATIVE_SPEC_EXT_CALCULATION = 1u << 2 ,
  PF_NATIVE_SPEC_EXT_OPEN_BAR_VIEW = 1u << 3 ,
  PF_NATIVE_SPEC_EXT_MARGIN = 1u << 4 ,
  PF_NATIVE_SPEC_EXT_SUBSCRIPTIONS = 1u << 5 ,
  PF_NATIVE_SPEC_EXT_RISK = 1u << 6 ,
  PF_NATIVE_SPEC_EXT_INTRABAR = 1u << 7 ,
  PF_NATIVE_SPEC_EXT_FEED_POLICY = 1u << 8 ,
  PF_NATIVE_SPEC_EXT_AUXILIARY_FEED = 1u << 9
}
 Which extension blocks of pf_native_run_spec_ext_v1 are meaningful. More...
 
enum  pf_native_series_source_t {
  PF_NATIVE_SERIES_SOURCE_INPUT = 0 ,
  PF_NATIVE_SERIES_SOURCE_AUXILIARY_FEED = 1
}
 The bars a declared series is built from — NativeSeriesSource. More...
 
enum  pf_native_size_price_t {
  PF_NATIVE_SIZE_PRICE_RESOLVED = 0 ,
  PF_NATIVE_SIZE_PRICE_SIGNAL = 1 ,
  PF_NATIVE_SIZE_PRICE_SIGNAL_ON_TICK = 2
}
 WHICH price a kernel-sized basis converts at — native_order::SizePrice (L3b). More...
 
enum  pf_native_scope_basis_t {
  PF_NATIVE_SCOPE_BASIS_AT_MATCH = 0 ,
  PF_NATIVE_SCOPE_BASIS_AT_ACCEPTANCE = 1
}
 WHICH measurement of the bound scope a fractional reduce takes its fraction of — native_order::ScopeBasis. More...
 
enum  pf_native_liquidation_check_t {
  PF_NATIVE_LIQUIDATION_PATH_ADVERSE_EXTREME = 0 ,
  PF_NATIVE_LIQUIDATION_CALCULATION_ONLY = 1 ,
  PF_NATIVE_LIQUIDATION_PATH_ADVERSE_EXTREME_MARK = 2
}
 When the kernel tests the maintenance requirement — NativeLiquidationCheck, the margin_check field of pf_native_run_spec_ext_v1. More...
 
enum  pf_native_margin_equity_basis_t {
  PF_NATIVE_MARGIN_EQUITY_MARKED = 0 ,
  PF_NATIVE_MARGIN_EQUITY_BEFORE_OPEN_COMMISSION = 1
}
 Which equity the maintenance requirement is tested against — NativeMarginEquityBasis. More...
 
enum  pf_native_margin_level_base_t {
  PF_NATIVE_MARGIN_LEVEL_MARKED_EQUITY = 0 ,
  PF_NATIVE_MARGIN_LEVEL_REALIZED_ONLY = 1
}
 Which base the liquidation level is solved from — NativeLiquidationLevelBase. More...
 
enum  pf_native_intrabar_kind_t {
  PF_NATIVE_INTRABAR_NONE = 0 ,
  PF_NATIVE_INTRABAR_LOWER_TF = 1 ,
  PF_NATIVE_INTRABAR_SYNTHESIZED = 2
}
 Which intrabar execution path the run retains — the alternative of IntrabarPath. More...
 
enum  pf_native_sample_eligibility_t {
  PF_NATIVE_SAMPLE_CONTINUOUS_SEGMENTS = 0 ,
  PF_NATIVE_SAMPLE_DISTRIBUTION_SAMPLES = 1
}
 Whether matching stays continuous between generated samples — IntrabarPath::SampleEligibility. More...
 
enum  pf_native_slot_label_t {
  PF_NATIVE_SLOT_LABEL_CANONICAL = 0 ,
  PF_NATIVE_SLOT_LABEL_FEED_TOLERANT = 1
}
 Whether a confirmed bar must name a canonical input slot — NativeSlotLabelPolicy. More...
 
enum  pf_native_feed_tolerance_t {
  PF_NATIVE_FEED_TOLERANCE_NONE = 0 ,
  PF_NATIVE_FEED_TOLERANCE_BATCH_STRUCTURAL = 1u << 0 ,
  PF_NATIVE_FEED_TOLERANCE_WARMUP_NONNEGATIVE = 1u << 1
}
 Opt-in admission exceptions for a tolerated input-feed shape — NativeFeedTolerance. More...
 
enum  pf_native_path_order_t {
  PF_NATIVE_PATH_ORDER_AUTO = 0 ,
  PF_NATIVE_PATH_ORDER_HIGH_FIRST = 1 ,
  PF_NATIVE_PATH_ORDER_LOW_FIRST = 2
}
 Generic ordering for a modeled OHLC path — NativePathOrder. More...
 
enum  pf_native_abort_reporting_t {
  PF_NATIVE_ABORT_ERROR = 0 ,
  PF_NATIVE_ABORT_QUIET = 1
}
 How a cooperative abort is presented — NativeAbortReporting. More...
 
enum  pf_native_calc_reason_t {
  PF_NATIVE_CALC_BAR_CLOSE = 0 ,
  PF_NATIVE_CALC_ORDER_FILL = 1 ,
  PF_NATIVE_CALC_TICK = 2 ,
  PF_NATIVE_CALC_SUB_BAR = 3
}
 Why the kernel is asking the host to calculate — NativeCalculationReason (L5), the reason argument of pf_native_callbacks_v1::on_recalculate. More...
 
enum  pf_native_margin_check_kind_t {
  PF_NATIVE_MARGIN_CHECK_BAR_OPEN = 0 ,
  PF_NATIVE_MARGIN_CHECK_AFTER_APPLIED = 1 ,
  PF_NATIVE_MARGIN_CHECK_CALCULATION = 2 ,
  PF_NATIVE_MARGIN_CHECK_FX_ROLL = 3
}
 Which kernel check point is about to test the maintenance requirement — NativeMarginCheckKind (L4b). More...
 
enum  pf_native_answer_t {
  PF_NATIVE_ANSWER_DEFAULT = 0 ,
  PF_NATIVE_ANSWER_PROVIDED = 1
}
 What an ANSWERING callback's return value means. More...
 

Functions

int strategy_native_api_version (void)
 This header's layout version.
 
pf_strategy_t strategy_native_host_create_v1 (const pf_native_callbacks_v1 *callbacks)
 Allocate a native host that forwards every kernel callback to callbacks.
 
void strategy_native_host_free (pf_strategy_t s)
 Release a handle from strategy_native_host_create_v1.
 
int strategy_native_run_v1 (pf_strategy_t s, const pf_bar_t *bars, int n, pf_report_t *out)
 Run n bars as one batch and fill out.
 
void strategy_native_report_free_v1 (pf_report_t *report)
 Free the heap arrays inside a report filled by strategy_native_run_v1.
 
int strategy_native_submit_v1 (pf_strategy_t s, const pf_native_request_v1 *request, uint64_t *incarnation, uint32_t *reject)
 Submit request.
 
int strategy_native_replace_v1 (pf_strategy_t s, uint64_t incarnation, const pf_native_request_v1 *request, uint64_t *successor)
 Replace the live request incarnation with request.
 
int strategy_native_cancel_v1 (pf_strategy_t s, uint64_t incarnation)
 Cancel one live request.
 
int strategy_native_cancel_all_v1 (pf_strategy_t s)
 Cancel every live request, dependants included.
 
int strategy_native_cancel_where_v1 (pf_strategy_t s, const char *text, uint32_t field)
 Cancel exactly the live requests whose field equals text.
 
int strategy_native_execute_current_v1 (pf_strategy_t s, uint64_t incarnation, uint32_t price_rule, uint32_t *refusal)
 Execute one live request at the current execution point.
 
int strategy_native_position_v1 (pf_strategy_t s, double *signed_units, double *average_price, uint64_t *lots)
 Read the physical position.
 
int strategy_native_working_len_v1 (pf_strategy_t s)
 Snapshot the live working book and return its length.
 
int strategy_native_working_get_v1 (pf_strategy_t s, int index, pf_native_working_v1 *out)
 Copy row index of the most recent working snapshot into out.
 
int strategy_native_open_lot_count_v1 (pf_strategy_t s, double mark)
 Snapshot the open lots marked at mark and return their count.
 
int strategy_native_open_lot_get_v1 (pf_strategy_t s, int index, pf_native_open_lot_v1 *out)
 Copy row index of the most recent open-lot snapshot into out.
 
int strategy_native_events_v1 (pf_strategy_t s, uint64_t after_ordinal, pf_native_event_v1 *out, int cap)
 Copy up to cap events with an ordinal strictly greater than after_ordinal into out, in the kernel's own recording order.
 
int strategy_native_state_v1 (pf_strategy_t s, pf_native_state_v1 *out)
 Read the run's lifecycle and typed failure into out.
 
int strategy_native_declare_subscriptions_v1 (pf_strategy_t s, const pf_native_subscription_v1 *rows, int n)
 Declare this run's higher-timeframe series from inside on_run_begindeclare_timeframe_subscriptions().
 
int strategy_native_partial_bar_v1 (pf_strategy_t s, pf_bar_t *out)
 The bar so far at the current cursor — current_partial_bar().
 
int strategy_native_recalculations_v1 (pf_strategy_t s, uint64_t *driven, uint64_t *skipped)
 How many recalculations the kernel drove, and how many it suppressed because a point had spent its max_recalculations_per_point budget — native_recalculation_count() / native_recalculations_skipped().
 
int strategy_native_trail_state_v1 (pf_strategy_t s, uint64_t incarnation, pf_native_trail_state_v1 *out)
 The trail projection of one live request — trail_state().
 
int strategy_native_series_bar_v1 (pf_strategy_t s, uint32_t subscription, pf_bar_t *out)
 The latest completed bucket of a declared subscription — native_series_bar().
 
int strategy_native_marked_equity_v1 (pf_strategy_t s, double mark, double *out)
 The account's marked equity at marknative_marked_equity().
 
int strategy_native_liquidation_price_v1 (pf_strategy_t s, double *out)
 The price at which the marked equity falls below the run's maintenance requirement for the live position's side — native_liquidation_price().
 
int strategy_native_risk_state_v1 (pf_strategy_t s, pf_native_risk_state_v1 *out)
 The run's generic risk ledger — native_risk_state().
 
int strategy_native_continuation_hash_v1 (pf_strategy_t s, uint64_t *out)
 The run's continuation identity — native_continuation_hash().
 
int strategy_native_cohort_open_v1 (pf_strategy_t s, uint64_t *cohort)
 Open a cohort roster for PF_NATIVE_OWNER_BIND_COHORT.
 
int strategy_native_cohort_add_v1 (pf_strategy_t s, uint64_t cohort, uint64_t incarnation)
 Enrol a live request into a cohort roster.
 
int strategy_native_cohort_remove_v1 (pf_strategy_t s, uint64_t cohort, uint64_t incarnation)
 Remove a request from a cohort roster.
 
int strategy_configure_native_ext_v1 (pf_strategy_t s, const pf_native_run_spec_v1 *base, const pf_native_run_spec_ext_v1 *ext)
 Configure a native run from the v1 specification plus the extension.
 
int strategy_native_append_auxiliary_bars_v1 (pf_strategy_t s, const pf_bar_t *bars, int32_t n)
 Append later bars to the run's declared auxiliary feed on a realtime stream (NativeStrategyHost::append_auxiliary_bars).
 

Macro Definition Documentation

◆ PINEFORGE_HAS_NATIVE_C_API_V1

#define PINEFORGE_HAS_NATIVE_C_API_V1   1

Feature probe for the C-level native host API.

When defined, strategy_native_host_create_v1 is available.

Definition at line 184 of file native_c_api.h.

◆ PF_NATIVE_API_VERSION

#define PF_NATIVE_API_VERSION   1

Monotonic version of this header's native-C layouts.

Every versioned struct below carries it in its version field.

Definition at line 188 of file native_c_api.h.

Referenced by grid_without_a_ladder_is_refused(), main(), make_ext(), on_bar(), run_mode(), and submit().

◆ PF_NATIVE_FAILURE_CALLBACK

#define PF_NATIVE_FAILURE_CALLBACK   5

NativeFailureCode::CallbackException — the code latched when a C callback returns non-zero.

Mirrors the C++ enumerator; pinned by a static_assert.

Definition at line 228 of file native_c_api.h.