PineForge unreleased
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
pineforge::native_calc Namespace Reference

Data Structures

struct  Event
 One driving event: its kind and its time. More...
 
struct  Point
 One planned calculation. More...
 

Enumerations

enum class  EventKind : std::uint32_t {
  WarmupBar = 1 ,
  Bar = 2 ,
  Tick = 3 ,
  AdvanceTime = 4
}
 The driving events of a schedule. More...
 
enum class  Phase : std::uint32_t {
  Pre = 0 ,
  Post = 1
}
 Whether a calculation ran before the payload of its driving event was applied (a bar closed only because time reached its end) or after it. More...
 
enum class  Finality : std::uint32_t {
  Provisional = 0 ,
  Confirmed = 1
}
 Provisional for an intrabar calculation, Confirmed for the calculation that closes a bar. More...
 
enum class  Status : std::uint32_t {
  Ok = 0 ,
  NotEngaged ,
  BadArguments ,
  BadCadence ,
  UnknownEventKind ,
  BarKeyExhausted ,
  TraceExhausted ,
  NoBarSlot ,
  BarEndNotAfterEvent ,
  PositionOutsideWindow
}
 How a derivation ended. More...
 

Functions

constexpr bool is_known (EventKind kind) noexcept
 Whether kind is in the registry: the one range check a raw number passes before the derivation treats it as an EventKind.
 

Variables

constexpr std::uint32_t kCadenceAdvanceTime = 1u << 0
 Which driving events make an instance calculate, as a bit set.
 
constexpr std::uint32_t kCadenceBarClose = 1u << 1
 
constexpr std::uint32_t kCadenceTick = 1u << 2
 
constexpr std::uint32_t kCadenceMask
 

Enumeration Type Documentation

◆ EventKind

enum class pineforge::native_calc::EventKind : std::uint32_t
strong

The driving events of a schedule.

The numbers are the event-kind registry of the named-stream boundary; zero, and every value above AdvanceTime, name no event: the derivation refuses them rather than plan nothing for them.

Enumerator
WarmupBar 
Bar 
Tick 
AdvanceTime 

Definition at line 16 of file native_calc_point.hpp.

◆ Phase

enum class pineforge::native_calc::Phase : std::uint32_t
strong

Whether a calculation ran before the payload of its driving event was applied (a bar closed only because time reached its end) or after it.

Enumerator
Pre 
Post 

Definition at line 48 of file native_calc_point.hpp.

◆ Finality

enum class pineforge::native_calc::Finality : std::uint32_t
strong

Provisional for an intrabar calculation, Confirmed for the calculation that closes a bar.

Enumerator
Provisional 
Confirmed 

Definition at line 55 of file native_calc_point.hpp.

◆ Status

enum class pineforge::native_calc::Status : std::uint32_t
strong

How a derivation ended.

Ok with a count of zero is a schedule that plans no calculation; every other status is a refusal and plans nothing.

Enumerator
Ok 
NotEngaged 

The consumer's schedule group was not enabled for the current run.

BadArguments 

A null event array with a nonzero count.

BadCadence 

A cadence without the bar-close bit, or with a bit outside the set.

UnknownEventKind 

An event kind outside the registry.

BarKeyExhausted 

A bar lifecycle had to open while the last ordinal assigned was already the largest representable one: the boundary reports capacity exhausted.

TraceExhausted 

The trace ordinal of the next event is the largest representable one.

NoBarSlot 

The timebase has no bar interval at the time of an event that opens one.

BarEndNotAfterEvent 

The interval the timebase holds for an event ends no later than the event: its end cannot be the exclusive end of a bar that event opens.

PositionOutsideWindow 

A position the kernel planned itself lies outside the window of its driving event: an internal invariant failure, not an admission error.

Definition at line 83 of file native_calc_point.hpp.

Function Documentation

◆ is_known()

bool pineforge::native_calc::is_known ( EventKind kind)
constexprnoexcept

Whether kind is in the registry: the one range check a raw number passes before the derivation treats it as an EventKind.

Definition at line 25 of file native_calc_point.hpp.

References AdvanceTime, and WarmupBar.

Variable Documentation

◆ kCadenceAdvanceTime

std::uint32_t pineforge::native_calc::kCadenceAdvanceTime = 1u << 0
inlineconstexpr

Which driving events make an instance calculate, as a bit set.

A cadence always contains kCadenceBarClose; the other two bits are optional.

Definition at line 40 of file native_calc_point.hpp.

◆ kCadenceBarClose

std::uint32_t pineforge::native_calc::kCadenceBarClose = 1u << 1
inlineconstexpr

Definition at line 41 of file native_calc_point.hpp.

◆ kCadenceTick

std::uint32_t pineforge::native_calc::kCadenceTick = 1u << 2
inlineconstexpr

Definition at line 42 of file native_calc_point.hpp.

◆ kCadenceMask

std::uint32_t pineforge::native_calc::kCadenceMask
inlineconstexpr
Initial value:
=
constexpr std::uint32_t kCadenceBarClose
constexpr std::uint32_t kCadenceTick
constexpr std::uint32_t kCadenceAdvanceTime
Which driving events make an instance calculate, as a bit set.

Definition at line 43 of file native_calc_point.hpp.