PineForge v0.13.1-379-g9b50973
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
pineforge::native_driver_v5 Namespace Reference

Data Structures

class  INativeDriverSink
 
struct  NativeCoordinate
 Everything the kernel knows about WHERE a point is, as one owning value: its event ordinal, the interval index, the nominal and scheduled-eligible opens, the last traded close, the next period and next input opens, the effective time the account converts and hashes at, the source price time, and the three classifications above. More...
 
struct  NativeDecisionContext
 
struct  NativeDriverPoint
 One point the driver produced: its coordinate, the raw price before slippage or any grid, the provider's sequence for an observed print (nullopt otherwise), and whether the point is a matching point, an excursion sample, or both. More...
 
struct  NativeDriverStatistics
 
struct  NativeInputPreflightResult
 What preflight_native_inputs answers: the error and the first offending bar's index, or -1 when the refusal is not about one bar. More...
 

Enumerations

enum class  NativePriceProvenance : std::uint8_t {
  Confirmed = 0 ,
  ObservedPrint = 1 ,
  ModeledOHLCOpen = 2 ,
  ModeledOHLCClose = 3 ,
  CarriedOpen = 4 ,
  AfterCalculationClose = 5 ,
  PartialFinalized = 6 ,
  Calculation = 7 ,
  CurrentExecution = 8
}
 Where a driver point's price came from. More...
 
enum class  NativePathPhase : std::uint8_t {
  None = 0 ,
  Open = 1 ,
  High = 2 ,
  Low = 3 ,
  Close = 4
}
 Which leg of a modeled OHLC walk a point sits on. More...
 
enum class  NativeCompletionKind : std::uint8_t {
  Confirmed = 0 ,
  LazyComplete = 1 ,
  SessionShortened = 2 ,
  PartialFinalized = 3
}
 How a script interval or a higher-timeframe bucket was closed. More...
 
enum class  NativeInputPolicy : std::uint8_t {
  Batch = 0 ,
  StreamWarmup = 1
}
 
enum class  NativeInputPreflightError : std::uint16_t {
  None = 0 ,
  NullArray = 1 ,
  InvalidCount = 2 ,
  StructuralInvalid = 3 ,
  Unaligned = 4 ,
  OffGridLabel = 5 ,
  NotStrictlyIncreasing = 6 ,
  OverlappingSlot = 7 ,
  InSessionGap = 8 ,
  CalendarFailure = 9 ,
  TimestampDeltaOverflow = 10
}
 Why a bar array was refused before the run touched anything. More...
 

Functions

bool native_bar_structurally_valid (const Bar &bar) noexcept
 Whether a bar can be admitted at all: finite positive OHLC with high >= max(open, close) and low <= min(open, close), and a finite nonnegative volume.
 
bool native_confirmed_bar_label_admitted (const native_calendar::NativeInterval &interval, int64_t timestamp) noexcept
 
int64_t native_canonical_input_completion (const native_calendar::NativeInterval &interval) noexcept
 
NativeInputPreflightResult preflight_native_inputs (const NativeRunSpec &spec, const Bar *bars, int n, NativeInputPolicy policy)
 Judge a whole bar array against a run spec before any of it is consumed, under NativeInputPolicy::Batch (sparse input is admitted; missing in-session slots are legal) or StreamWarmup (every provided slot must be a complete confirmed interval and an in-session gap is refused).
 

Variables

constexpr const char * kNativeDriverSemanticVersion = "native-driver/v5"
 
constexpr const char * kNativeConsumerSemanticVersion = "native-consumer/v7"
 
constexpr const char * kNativeCalendarSemanticVersion = "native-calendar/v1"
 

Enumeration Type Documentation

◆ NativePriceProvenance

enum class pineforge::native_driver_v5::NativePriceProvenance : std::uint8_t
strong

Where a driver point's price came from.

Confirmed is a confirmed input bar's own label; ObservedPrint a realtime tick; the two ModeledOHLC values and AfterCalculationClose are the modeled waypoints of a confirmed bar's path; CarriedOpen is a quiet tradable interval's carried last price; PartialFinalized a partially finalized observed slot; Calculation the script calculation point itself; CurrentExecution a synchronous execute_current. A host reads it off NativeDecisionContext::coordinate and never has to infer it.

Enumerator
Confirmed 
ObservedPrint 
ModeledOHLCOpen 
ModeledOHLCClose 
CarriedOpen 
AfterCalculationClose 
PartialFinalized 
Calculation 
CurrentExecution 

Definition at line 26 of file market_driver.hpp.

◆ NativePathPhase

enum class pineforge::native_driver_v5::NativePathPhase : std::uint8_t
strong

Which leg of a modeled OHLC walk a point sits on.

None is a discrete point (a calculation, an observed print); Open, High, Low and Close are the waypoints, in the order NativeRunSpec::path_order resolves. A margin check point's cursor.point.path_phase is the waypoint the check was taken at.

Enumerator
None 
Open 
High 
Low 
Close 

Definition at line 42 of file market_driver.hpp.

◆ NativeCompletionKind

enum class pineforge::native_driver_v5::NativeCompletionKind : std::uint8_t
strong

How a script interval or a higher-timeframe bucket was closed.

Confirmed means its own last contributing bar closed it; LazyComplete that the NEXT interval's first input did — a session-clipped bar, or a hole over the last slot; SessionShortened that the session close clipped it; PartialFinalized that a stream end finalized a forming observed slot. Delivered on NativeTimeframeBarContext::completion for a bucket and on the coordinate for a calculation.

Enumerator
Confirmed 
LazyComplete 
SessionShortened 
PartialFinalized 

Definition at line 57 of file market_driver.hpp.

◆ NativeInputPolicy

enum class pineforge::native_driver_v5::NativeInputPolicy : std::uint8_t
strong
Enumerator
Batch 
StreamWarmup 

Definition at line 190 of file market_driver.hpp.

◆ NativeInputPreflightError

enum class pineforge::native_driver_v5::NativeInputPreflightError : std::uint16_t
strong

Why a bar array was refused before the run touched anything.

NullArray and InvalidCount are the argument shape; StructuralInvalid is native_bar_structurally_valid; Unaligned and OffGridLabel are the slot label; NotStrictlyIncreasing and OverlappingSlot the ordering; InSessionGap a missing in-session slot, which only a stream warmup refuses; CalendarFailure a calendar the spec's own timezone and session could not resolve. A preflight refusal leaves the host Ready or Running and does NOT raise the decision floor.

Enumerator
None 
NullArray 
InvalidCount 
StructuralInvalid 
Unaligned 
OffGridLabel 
NotStrictlyIncreasing 
OverlappingSlot 
InSessionGap 
CalendarFailure 
TimestampDeltaOverflow 

Definition at line 202 of file market_driver.hpp.

Function Documentation

◆ native_bar_structurally_valid()

bool pineforge::native_driver_v5::native_bar_structurally_valid ( const Bar & bar)
noexcept

Whether a bar can be admitted at all: finite positive OHLC with high >= max(open, close) and low <= min(open, close), and a finite nonnegative volume.

A run's NativeFeedTolerance may relax the positivity and the volume half; this is the strict predicate those bits are measured against. It is also what refuses a bar of an auxiliary feed (InvalidAuxiliaryFeedBar).

◆ native_confirmed_bar_label_admitted()

bool pineforge::native_driver_v5::native_confirmed_bar_label_admitted ( const native_calendar::NativeInterval & interval,
int64_t timestamp )
inlinenoexcept

Definition at line 160 of file market_driver.hpp.

◆ native_canonical_input_completion()

int64_t pineforge::native_driver_v5::native_canonical_input_completion ( const native_calendar::NativeInterval & interval)
inlinenoexcept

Definition at line 167 of file market_driver.hpp.

◆ preflight_native_inputs()

NativeInputPreflightResult pineforge::native_driver_v5::preflight_native_inputs ( const NativeRunSpec & spec,
const Bar * bars,
int n,
NativeInputPolicy policy )

Judge a whole bar array against a run spec before any of it is consumed, under NativeInputPolicy::Batch (sparse input is admitted; missing in-session slots are legal) or StreamWarmup (every provided slot must be a complete confirmed interval and an in-session gap is refused).

Every public begin runs it first, which is why an invalid array leaves the lifecycle where it was instead of failing the host.

Variable Documentation

◆ kNativeDriverSemanticVersion

const char* pineforge::native_driver_v5::kNativeDriverSemanticVersion = "native-driver/v5"
inlineconstexpr

Definition at line 15 of file market_driver.hpp.

◆ kNativeConsumerSemanticVersion

const char* pineforge::native_driver_v5::kNativeConsumerSemanticVersion = "native-consumer/v7"
inlineconstexpr

Definition at line 16 of file market_driver.hpp.

◆ kNativeCalendarSemanticVersion

const char* pineforge::native_driver_v5::kNativeCalendarSemanticVersion = "native-calendar/v1"
inlineconstexpr

Definition at line 17 of file market_driver.hpp.