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

Namespaces

namespace  native_order_v1
 
namespace  native_order_v8
 

Data Structures

struct  Absolute
 Where a request's trigger level comes from. More...
 
struct  AcceptedEvent
 One request was accepted: the definition, and the timeline ordinal it was accepted at. More...
 
struct  ActivatedEvent
 
struct  ActivateStop
 
struct  ActivateStopLimit
 
struct  ActivateTrail
 
struct  ActivationGrid
 What the consumer hands to prepare_trigger under an opted-in price grid (NativeRunSpec::price_grid == QuantizeFillsAndTriggers), the way acceptance receives CommandContext::price_tick: the tick ladder and the rounding the matcher tested the activation on. More...
 
struct  AllowanceAllScope
 
struct  AllowanceDeferred
 
struct  AllowanceUnits
 
struct  AllowanceUnset
 
struct  ArmContext
 What the consumer hands to prepare_owner_applied for an anchored leg's materialization, the way acceptance receives CommandContext::price_tick. More...
 
struct  ArmedEvent
 An anchored leg was materialized, exactly once: fill + offset, then the rounding, then resolve_anchored_level, then the representability check, and the resulting level written into the leg's trigger with its anchor becoming Absolute. More...
 
struct  ArmedTransaction
 
struct  BeginTrailTracking
 
struct  BindCohort
 Bind to a host-built roster (cohort_open / cohort_add / cohort_remove), read at the match rather than frozen at submit. More...
 
struct  BindOpening
 Bind to ONE already-live opening, by its handle and the positive cycle it is live in. More...
 
struct  BindOpenings
 Bind to a fixed cohort of already-live openings. More...
 
struct  Birth
 
struct  BookClose
 The authority an armed leg acquires under NativeArmScope::Book: the whole position its owner's fill left, on this cycle and side, bound at the fill's cursor. More...
 
struct  BookTransaction
 
struct  CancelledEvent
 
struct  CancelResult
 
struct  CashValue
 Native sizing bases (L3). More...
 
struct  CloseBoundEvent
 
struct  CohortClose
 
struct  CohortHandle
 A host-maintained, run-scoped roster identity. More...
 
struct  CohortReceipt
 
struct  CohortRoster
 
struct  CommandContext
 What acceptance needs from the run to judge a command: the point's ordinal and coordinate, the price tick the tick spellings resolve against, the quantity grid, and the live book. More...
 
struct  CommandInstalled
 
struct  CommittedExecutionFacts
 
struct  DeferredGroupAdjustmentEvent
 A group effect's deduction deferred into a sibling whose units are not known yet: its pending total grows by deferred_delta, in commit order, and the receipts chain back through previous_pending_receipt until the terms or the owner fill that binds the sibling's units takes the total off them. More...
 
struct  EligibilityFacts
 
struct  EnrollmentFromApplied
 
struct  EnrollmentFromCommand
 
struct  EquityFraction
 A fraction in (0, 1] of MARKED equity at the sizing point. More...
 
struct  EvaluationContext
 
struct  EventId
 
struct  EventRange
 Where an install put its events: first_index is an ABSOLUTE journal position – the count of events the run committed before them – so it stays valid when the front of the journal is retired (WorkingRequestCore::history_at reads it back). More...
 
struct  ExecutionAppliedEvent
 One committed execution: the definition, the cursor, the resolved price and units, the scope it acted on, the committed closed-row range, the cycle on either side, and the ticket it booked under. More...
 
struct  ExecutionProposal
 
struct  ExecutionTerms
 
struct  ExplicitUnits
 A reduction of exactly these units, finite and positive. More...
 
struct  FromOwnerFill
 Defer a level to the owner's fill: at the arm the level becomes fill + offset, with offset signed (adverse is negative) and spelled in price ticks when ticks is set, then rounded by rounding. More...
 
struct  GroupEffectReceipt
 One group-effect receipt: the applied event that caused it, the request it acted on, the effect, and the ordinal of the event that recorded the outcome. More...
 
struct  HostSized
 An opening or a closing whose quantity the HOST resolves, in NativeStrategyHost::resolve_execution_terms. More...
 
struct  ImmediateRemaining
 Take whatever the point allows, with no per-point cap. More...
 
struct  Independent
 No owner: the request stands on its own book authority. More...
 
class  InlineCommandEvents
 Almost every prepared command yields one history event. More...
 
struct  Installed
 
struct  InvalidHandleEvent
 
class  JournalRecordSource
 
struct  Limit
 fill_through makes the limit a touch trigger (market-if-touched): the level still gates when the request becomes executable, but its fill is not bounded by the level, so slippage may carry it past the level. More...
 
struct  LimitReady
 
struct  LiveRequest
 
struct  MarginCallEvent
 A kernel-issued liquidation that actually filled. More...
 
struct  Market
 Match at the next eligible matching point, with no level to reach. More...
 
struct  MarketReady
 
struct  MatchCursor
 
struct  MatchRejectedEvent
 A candidate the run refused, with its MatchRejectReason and the cursor it was refused at. More...
 
struct  Member
 
struct  NativeRiskEvent
 One generic risk limit breaching (L9). More...
 
struct  NoChange
 
struct  NoEffectEvent
 A reduction or a flatten that had nothing to close: terminal, with no execution identity, no fill, no fee and no physical action. More...
 
struct  NoGroup
 
struct  NoTarget
 A dynamic cohort has no currently live member. More...
 
struct  NotWorkingEvent
 
struct  ObserveTrailExtremum
 
struct  OpeningClose
 
class  OpeningInputCursor
 Call-local input. More...
 
struct  OpeningObservation
 
class  OpeningObservationReadback
 Borrowed through the enclosing command/evaluation and any prepare/install pair that copies its TargetObservation, including nested reads. More...
 
class  OpeningReadback
 Immutable membership, independent of a source scratch scope. More...
 
struct  OpeningsClose
 Immutable fixed cohort. More...
 
struct  OwnerOpenedUnits
 A reduction of exactly what the owner's fill opened, bound at the arm and reported by a QuantityBoundEvent. More...
 
struct  PendingDeferred
 
struct  PendingNone
 
struct  PointBudget
 Cap what this request may execute at ONE matching point at units. More...
 
struct  PositionFlat
 
struct  PositionNonflat
 
struct  PreparationError
 A working-request preparation that could not produce a representable instruction — a nonrepresentable quantity, most often. More...
 
class  PreparedCancel
 
class  PreparedExecution
 
class  PreparedMutation
 
class  PreparedReplace
 
class  PreparedSubmit
 
struct  QuantityBoundEvent
 A Reduce{OwnerOpenedUnits} was bound, at its owner's fill, to what that fill opened. More...
 
struct  Reduce
 A closing-only intent. More...
 
struct  RejectedEvent
 
struct  RemainingDeferred
 
struct  RemainingFlattenAll
 
struct  RemainingProjectionDeferred
 
struct  RemainingProjectionFlattenAll
 
struct  RemainingProjectionNoTarget
 
struct  RemainingProjectionUnbound
 
struct  RemainingProjectionUnits
 
struct  RemainingUnbound
 
struct  RemainingUnits
 A resolved remaining quantity, in units. More...
 
struct  ReplacedEvent
 
struct  ReplaceOptions
 Replacement behaviour that is not expressible in the successor request. More...
 
struct  ReplaceRejectedEvent
 
struct  ReplaceResult
 
struct  Request
 Aggregate field order keeps market construction: Request{Transact{1.0}, "buy", "comment"} Request{Flatten{}, "flat", ""} Request{Reduce{ExplicitUnits{3}}, "close", ""} New fields default to Market / ImmediateRemaining / Independent / NoGroup. More...
 
struct  RequestDefinition
 The immutable accepted form of one request: its handle, the request value as accepted, its birth (acceptance ordinal and decision floor), its origin (RequestOrigin::Host, or the kernel's own for a liquidation or a risk flatten) and its authority. More...
 
struct  RequestHandle
 
class  RequestReadback
 Complete request schema, including owner text and every opening handle. More...
 
struct  ReservationReducedEvent
 A group effect's deduction from a live sibling whose remaining units are known (GroupEffect::Reduce): requested_delta is the member fill's filled_working, actual_deduction the part taken – capped at before, which then cancels the sibling – and after is fl(before - actual_deduction). More...
 
struct  ReverseTo
 Exact target exposure for an explicit reversal request. More...
 
struct  RunIdentity
 
struct  ScopeFraction
 A fraction in (0, 1] of the bound scope, resolved at the matching candidate. More...
 
struct  SelectedExposure
 Native authorization receipt, converted to a call-local financial SelectedOpeningSet only at the consumer's settlement boundary. More...
 
class  SessionKey
 
struct  Sized
 A kernel-sized opening. More...
 
struct  Stop
 A stop trigger: the modeled path has to reach price from the adverse side. More...
 
struct  StopActive
 
struct  StopIdle
 
struct  StopLimit
 A stop that, once reached, becomes a limit at limit. More...
 
struct  StopLimitLive
 
struct  StopLimitPending
 
struct  SubmitResult
 What submit answers. More...
 
struct  TailWindowConfig
 Payload row policy for pending batches and committed-row read caches. More...
 
struct  TailWindowStats
 Storage observations only, excluded from continuation state. More...
 
struct  TargetObservation
 
struct  TermsResolvedEvent
 One candidate's execution terms, recorded. More...
 
struct  TermsResolvedInput
 
struct  Trail
 offset is a price distance: the stop rides offset behind the running best. More...
 
struct  TrailActive
 A triggered trail; activation_ordinal carries TrailTrack's. More...
 
struct  TrailTicks
 Trail offset spelled in price ticks instead of a price distance. More...
 
struct  TrailTrack
 A trail riding its running best. More...
 
struct  TrailWaitArm
 
struct  UnboundBookClose
 
struct  Wait
 The authority an unarmed WaitForApplied child holds: accepted and live, but never a matching candidate until its owner's fill arms it — under either visibility. More...
 
struct  WaitForApplied
 The one owner relation that arms (the ArmedEvent). More...
 
class  WorkingRequestCore
 

Typedefs

using Flatten = execution::Flatten
 
using Transact = order_action::Transact
 A signed book transaction: finite nonzero units on the side their sign names.
 
using HandleVisitor = void (*)(void*, const RequestHandle&)
 
using SizeBasis = std::variant<CashValue, EquityFraction>
 The two bases a Sized intent may name.
 
using ReductionSize = std::variant<ExplicitUnits, OwnerOpenedUnits, ScopeFraction>
 How much a Reduce takes: literal units, the owner's own opening, or a fraction of the bound scope.
 
using OrderIntent = std::variant<Flatten, Reduce, Transact, ReverseTo, HostSized, Sized>
 What a request does.
 
using Trigger = std::variant<Market, Limit, Stop, StopLimit, Trail>
 
using TriggerAnchor = std::variant<Absolute, FromOwnerFill>
 
using Capacity = std::variant<ImmediateRemaining, PointBudget>
 
using Owner = std::variant<Independent, WaitForApplied, BindOpening, BindOpenings, BindCohort>
 
using Group = std::variant<NoGroup, Member>
 
using Remaining
 
using RemainingProjection
 
using Enrollment = std::variant<EnrollmentFromCommand, EnrollmentFromApplied>
 
using Authority
 
using ExecutionScope = std::variant<execution::Book, execution::OpeningExposure, SelectedExposure>
 What one execution acted on: the whole book, one opening's exposure, or a bound selection.
 
using TriggerState
 
using Allowance
 
using PendingAdjustments = std::variant<PendingNone, PendingDeferred>
 
using PositionIdentity = std::variant<PositionFlat, PositionNonflat>
 
using DefinitionRef = std::shared_ptr<const RequestDefinition>
 
using ExecutionPlan
 The settlement shape one execution takes.
 
using CommandEvent
 Every alternative of one request's history, as one value.
 
using AnchoredLevelResolver
 The one policy point of an anchored materialization.
 
using TriggerTransition
 
using InstallResult = std::variant<Installed, InstallError>
 
template<class T>
using Preparation = std::variant<T, NoChange, PreparationError>
 
template<class R>
using InstalledCommand = std::variant<CommandInstalled<R>, InstallError>
 

Enumerations

enum class  HostSizedKind : std::uint8_t {
  Open = 0 ,
  Close = 1
}
 
enum class  Side : std::uint8_t {
  Long = 0 ,
  Short = 1
}
 
enum class  ExecutionGridPolicy : std::uint8_t {
  SnapToGrid = 0 ,
  ExplicitUnits = 1
}
 Resolved host sizing normally remains subject to the run's quantity grid. More...
 
enum class  SizeTime : std::uint8_t {
  AtMatch = 0 ,
  AtAcceptance = 1
}
 AtMatch resolves the basis at the matching candidate; AtAcceptance freezes the resolved units when the request is accepted. More...
 
enum class  SizePrice : std::uint8_t {
  Resolved = 0 ,
  Signal = 1 ,
  SignalOnTick = 2
}
 WHICH price the basis is converted at. More...
 
enum class  ScopeClaim : std::uint8_t {
  Gross = 0 ,
  NetOfSiblings = 1
}
 Gross claims the whole bound scope; NetOfSiblings first subtracts the units already claimed by the live sibling reduces bound to that same scope. More...
 
enum class  ScopeBasis : std::uint8_t {
  AtMatch = 0 ,
  AtAcceptance = 1
}
 Which measurement of the bound scope the fraction is taken of. More...
 
enum class  NativeAnchorRounding : std::uint8_t {
  Raw = 0 ,
  HalfUp = 1 ,
  Directional = 2
}
 How a materialized anchored level is snapped onto the run's price tick ladder (NativeRunSpec::price_tick). More...
 
enum class  NativeArmVisibility : std::uint8_t {
  Working = 0 ,
  PendingUntilArmed = 1
}
 Whether an owner-related request that arms is a working order before its arm. More...
 
enum class  NativeArmFirstMatch : std::uint8_t {
  AtArmPrint = 0 ,
  AfterArmPrint = 1
}
 When an armed request may first match. More...
 
enum class  NativeArmScope : std::uint8_t {
  OwnerLot = 0 ,
  Book = 1
}
 What an armed CLOSING request (Reduce, Flatten, a HostSized close) closes. More...
 
enum class  GroupEffect : std::uint8_t {
  Cancel = 0 ,
  Reduce = 1
}
 
enum class  RequestOrigin : std::uint8_t {
  Host = 0 ,
  KernelLiquidation = 1 ,
  KernelRisk = 2
}
 Who authored a request. More...
 
enum class  RequestRejectReason : std::uint8_t {
  InvalidQuantity = 0 ,
  OffGrid = 1 ,
  InvalidTrigger = 2 ,
  InvalidCapacity = 3 ,
  InvalidOwner = 4 ,
  InvalidQuantityBasis = 5 ,
  InvalidGroup = 6 ,
  PlacementAdmission = 7
}
 Why an acceptance was refused, on a Rejected SubmitResult. More...
 
enum class  SubmitStatus {
  Accepted ,
  Rejected
}
 
enum class  ReplaceStatus {
  Replaced ,
  ReplaceRejected ,
  NotWorking ,
  InvalidHandle
}
 
enum class  CancelStatus {
  Cancelled ,
  NotWorking ,
  InvalidHandle
}
 
enum class  MatchRejectReason : std::uint8_t {
  NonpositivePrice = 0 ,
  OpeningDirection = 1 ,
  MaxAbsUnits = 2 ,
  MaxOpenLots = 3 ,
  InitialMargin = 4 ,
  TermsUnresolved = 5 ,
  InvalidTerms = 6 ,
  NoOppositeExposure = 7 ,
  HostPrecommit = 8 ,
  RiskLimit = 9 ,
  UnrepresentableQuantity = 10
}
 Why a CANDIDATE was refused at a matching point. More...
 
enum class  NativeCandidatePriceKind : std::uint8_t {
  PointPrice = 0 ,
  TriggerLevel = 1 ,
  CurrentQuote = 2
}
 Which price a candidate is being offered at: the point's own price, or the request's trigger level (a crossing that books the level itself). More...
 
enum class  OpeningShape : std::uint8_t {
  Transact = 0 ,
  ReverseTo = 1 ,
  CloseOpposite = 2
}
 
enum class  CancelReason : std::uint8_t {
  User = 0 ,
  Group = 1 ,
  OwnerGone = 2 ,
  UnsupportedRelation = 3 ,
  Superseded = 4
}
 Why a request left the book. More...
 
enum class  AppliedTerminalReason : std::uint8_t {
  WorkingUnitsSatisfied = 0 ,
  Flattened = 1 ,
  TargetExhausted = 2
}
 
enum class  ActivationKind : std::uint8_t {
  Stop = 0 ,
  StopLimit = 1 ,
  TrailArm = 2 ,
  TrailTrigger = 3
}
 
enum class  CoreFailure : std::uint8_t {
  Invariant = 0 ,
  InvalidCause = 1 ,
  NonrepresentableQuantity = 2 ,
  MissingObservation = 3 ,
  StaleHandle = 4 ,
  UnsupportedTransition = 5 ,
  ConflictingReceipt = 6 ,
  UnrepresentableReservation = 7 ,
  InvalidScope = 8 ,
  InvalidProposal = 9 ,
  ObservationMismatch = 10
}
 
enum class  DriverEligibilityClass : std::uint8_t {
  ObservedPrint = 0 ,
  CarriedOpen = 1 ,
  TickAfterCalculation = 2 ,
  ConfirmedOpen = 3 ,
  ConfirmedExcursion = 4 ,
  ConfirmedAfterCalculationClose = 5 ,
  CurrentExecution = 6
}
 
enum class  CommandSurface : std::uint8_t {
  General = 0 ,
  MarketOnly = 1
}
 
enum class  RiskLimitKind : std::uint8_t {
  MaxDrawdown = 0 ,
  MaxIntradayLoss = 1 ,
  MaxConsecutiveLossDays = 2 ,
  MaxFillsPerDay = 3
}
 Which generic risk limit of NativeRunSpec::risk a NativeRiskEvent reports. More...
 
enum class  InstallError : std::uint8_t {
  StalePreparation = 0 ,
  WrongCoreOrRun = 1 ,
  AlreadyConsumed = 2
}
 
enum class  NoChangeReason : std::uint8_t {
  NoTransition = 0 ,
  StillWaiting = 1 ,
  NotEligible = 2 ,
  NotWorking = 3 ,
  AlreadyApplied = 4
}
 
enum class  CohortReceiptOperation : std::uint8_t {
  Add = 0 ,
  Remove = 1
}
 
enum class  CohortReceiptStatus : std::uint8_t {
  Applied = 0 ,
  InvalidHandle = 1 ,
  UnknownOrigin = 2 ,
  TerminalOrigin = 3
}
 
enum class  TailWindowKind {
  successor_roots ,
  receipts ,
  chain_segments
}
 

Functions

bool operator== (CohortHandle left, CohortHandle right) noexcept
 
bool operator!= (CohortHandle left, CohortHandle right) noexcept
 
bool operator< (CohortHandle left, CohortHandle right) noexcept
 
detail::ScratchStatus freeze_openings (const RunIdentity &, const OpeningReadback &, std::shared_ptr< const OpeningReadback > &out)
 Freeze and canonicalize a same-run, unique stream.
 
std::uint64_t opening_count (const std::vector< RequestHandle > &, const OpeningReadback *) noexcept
 
detail::ScratchStatus opening_at (const std::vector< RequestHandle > &, const OpeningReadback *, std::uint64_t, RequestHandle &) noexcept
 
OrderIntent intent_from_physical (const execution::Action &action)
 
Request market_request (execution::Action action, std::string label={}, std::string comment={})
 
bool has_market_defaults (const Request &request) noexcept
 
bool operator== (const EventId &a, const EventId &b)
 
bool operator!= (const EventId &a, const EventId &b)
 
bool operator== (const MatchCursor &a, const MatchCursor &b) noexcept
 
bool operator!= (const MatchCursor &a, const MatchCursor &b) noexcept
 
std::uint8_t display_waypoint (const MatchCursor &cursor) noexcept
 
std::uint64_t opening_observation_count (const TargetObservation &) noexcept
 
detail::ScratchStatus opening_observation_at (const TargetObservation &, std::uint64_t, OpeningObservation &) noexcept
 
bool point_eligible (const LiveRequest &live, uint64_t point_ordinal, int64_t effective_time_ms) noexcept
 Whether a request may be considered at this driver point: the point's ordinal must be strictly past the birth acceptance ordinal AND its effective time at or past the birth's decision-time lower bound.
 
bool quantity_on_grid (double q, double step) noexcept
 v2 exact binary64 grid: r=abs(q)/s, n=round(r) half away from zero, g=n*s.
 
ExecutionPlan to_execution_plan (const execution::Action &action)
 
JournalRecordSource encode_journal_record (const CommandEvent &) noexcept
 
detail::ScratchStatus decode_journal_record (const detail::ScratchByteSource &, detail::ScratchBuffer, CommandEvent &)
 
void bind_journal_codec (WorkingRequestCore &, detail::CommandScratchStore &)
 
detail::ScratchStatus append_journal_record (WorkingRequestCore &, const detail::ScratchByteSource &)
 
const detail::ScratchReadback & journal_readback (const WorkingRequestCore &)
 
bool operator== (const RunIdentity &a, const RunIdentity &b)
 
bool operator!= (const RunIdentity &a, const RunIdentity &b)
 
bool operator== (const RequestHandle &a, const RequestHandle &b)
 
bool operator!= (const RequestHandle &a, const RequestHandle &b)
 
bool operator== (const Birth &a, const Birth &b)
 
bool operator!= (const Birth &a, const Birth &b)
 
bool point_eligible (const Birth &birth, uint64_t point_ordinal, int64_t effective_time_ms) noexcept