PineForge unreleased
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
pineforge::native_run_spec_v3::NativeRunSpec Struct Reference

One complete setup value, staged/copied by NativeStrategyHost before it is applied at begin. More...

#include <native_run_spec.hpp>

Data Fields

native_order::RunIdentity identity
 
std::string input_tf
 
std::string script_tf
 
bool timeframe_undetected = false
 A public begin with fewer than two bars may not establish a timeframe.
 
NativeSlotLabelPolicy slot_label_policy = NativeSlotLabelPolicy::Canonical
 Strict native hosts retain the canonical slot-label rule.
 
NativeFeedTolerance legacy_tolerance = NativeFeedTolerance::None
 
NativePathOrder path_order = NativePathOrder::Auto
 
std::string ticker
 
std::string tickerid
 
std::string type
 
std::string currency
 
std::string basecurrency
 
std::string description
 
std::string volumetype
 
std::string timezone
 
std::string session
 
std::string chart_timezone
 
double initial_capital = 0.0
 
double point_value = 0.0
 
double account_fx = 0.0
 
double price_tick = 0.0
 
std::uint32_t slippage_ticks = 0
 
NativePriceGrid price_grid = NativePriceGrid::None
 Opt-in instrument grid.
 
NativeGridRounding grid_rounding = NativeGridRounding::HalfUp
 
NativeFeeKind fee_kind = NativeFeeKind::Percent
 
double fee_value = 0.0
 
std::optional< double > quantity_grid
 
NativeCloseExecution close_execution = NativeCloseExecution::NextEligiblePoint
 
NativeAbortReporting abort_reporting = NativeAbortReporting::Error
 
std::optional< double > max_abs_units
 
std::optional< std::uint64_t > max_open_lots
 
NativeOpenDirections allowed_open_directions = NativeOpenDirections::Both
 
std::optional< double > initial_margin_fraction
 
std::optional< NativeMarginModel > margin
 Opt-in generic margin model.
 
std::optional< NativeRiskLimits > risk
 Opt-in generic account risk limits.
 
NativeReportPolicy report_policy = NativeReportPolicy::HostRecorded
 
bool report_open_position_at_end = false
 Report a position still open at run end as a mark-to-market closed row at the last close.
 
NativeCalculationTrigger calculation = NativeCalculationTrigger::BarClose
 Calculation timing.
 
std::uint32_t max_recalculations_per_point = 8
 
NativeOpenBarView open_bar_view = NativeOpenBarView::Complete
 
IntrabarPath intrabar {}
 
std::vector< NativeTimeframeSubscription > subscriptions
 Declared higher-timeframe series.
 
std::optional< NativeAuxiliaryFeed > auxiliary_feed
 Opt-in auxiliary finer feed.
 
std::vector< NativeInstrumentFeed > instrument_feeds
 Opt-in feeds of other instruments.
 
NativeEventRetention event_retention = NativeEventRetention::Window
 What native_events() can still return; see NativeEventRetention.
 
std::optional< double > quantity_tolerance
 Opt-in quantity tolerance, in units (finite, positive): two quantities within it of each other are one quantity to the settlement.
 

Detailed Description

One complete setup value, staged/copied by NativeStrategyHost before it is applied at begin.

This aggregate owns no host phase, consumed-run counter, parsed-calendar authority, physical account, or C transport presence mask. Empty required strings and zero capital/value/FX defaults make an incomplete value invalid; price_tick == 0 explicitly selects unquantized prices. No timezone/timeframe/instrument facts are inferred.

Definition at line 622 of file native_run_spec.hpp.

Field Documentation

◆ identity

◆ input_tf

std::string pineforge::native_run_spec_v3::NativeRunSpec::input_tf

◆ script_tf

std::string pineforge::native_run_spec_v3::NativeRunSpec::script_tf

◆ timeframe_undetected

bool pineforge::native_run_spec_v3::NativeRunSpec::timeframe_undetected = false

A public begin with fewer than two bars may not establish a timeframe.

This preserves that explicit state without inventing a clock literal.

Definition at line 628 of file native_run_spec.hpp.

Referenced by pineforge::source::PineExecutionAdapter::project().

◆ slot_label_policy

NativeSlotLabelPolicy pineforge::native_run_spec_v3::NativeRunSpec::slot_label_policy = NativeSlotLabelPolicy::Canonical

Strict native hosts retain the canonical slot-label rule.

A provider feed may opt into raw, strictly-increasing caller labels. The declared type spellings below are the ones the native C++ ABI guard pins.

Definition at line 632 of file native_run_spec.hpp.

Referenced by pineforge::source::PineExecutionAdapter::project().

◆ legacy_tolerance

NativeFeedTolerance pineforge::native_run_spec_v3::NativeRunSpec::legacy_tolerance = NativeFeedTolerance::None

◆ path_order

NativePathOrder pineforge::native_run_spec_v3::NativeRunSpec::path_order = NativePathOrder::Auto

◆ ticker

std::string pineforge::native_run_spec_v3::NativeRunSpec::ticker

◆ tickerid

std::string pineforge::native_run_spec_v3::NativeRunSpec::tickerid

◆ type

std::string pineforge::native_run_spec_v3::NativeRunSpec::type

◆ currency

std::string pineforge::native_run_spec_v3::NativeRunSpec::currency

◆ basecurrency

std::string pineforge::native_run_spec_v3::NativeRunSpec::basecurrency

◆ description

std::string pineforge::native_run_spec_v3::NativeRunSpec::description

◆ volumetype

std::string pineforge::native_run_spec_v3::NativeRunSpec::volumetype

◆ timezone

std::string pineforge::native_run_spec_v3::NativeRunSpec::timezone

◆ session

std::string pineforge::native_run_spec_v3::NativeRunSpec::session

◆ chart_timezone

std::string pineforge::native_run_spec_v3::NativeRunSpec::chart_timezone

◆ initial_capital

double pineforge::native_run_spec_v3::NativeRunSpec::initial_capital = 0.0

◆ point_value

double pineforge::native_run_spec_v3::NativeRunSpec::point_value = 0.0

◆ account_fx

double pineforge::native_run_spec_v3::NativeRunSpec::account_fx = 0.0

◆ price_tick

double pineforge::native_run_spec_v3::NativeRunSpec::price_tick = 0.0

◆ slippage_ticks

std::uint32_t pineforge::native_run_spec_v3::NativeRunSpec::slippage_ticks = 0

◆ price_grid

NativePriceGrid pineforge::native_run_spec_v3::NativeRunSpec::price_grid = NativePriceGrid::None

Opt-in instrument grid.

None keeps unquantized prices; both quantizing modes require price_tick > 0 and round before slippage.

Definition at line 655 of file native_run_spec.hpp.

◆ grid_rounding

NativeGridRounding pineforge::native_run_spec_v3::NativeRunSpec::grid_rounding = NativeGridRounding::HalfUp

Definition at line 656 of file native_run_spec.hpp.

◆ fee_kind

NativeFeeKind pineforge::native_run_spec_v3::NativeRunSpec::fee_kind = NativeFeeKind::Percent

◆ fee_value

double pineforge::native_run_spec_v3::NativeRunSpec::fee_value = 0.0

◆ quantity_grid

std::optional<double> pineforge::native_run_spec_v3::NativeRunSpec::quantity_grid

◆ close_execution

NativeCloseExecution pineforge::native_run_spec_v3::NativeRunSpec::close_execution = NativeCloseExecution::NextEligiblePoint

◆ abort_reporting

NativeAbortReporting pineforge::native_run_spec_v3::NativeRunSpec::abort_reporting = NativeAbortReporting::Error

◆ max_abs_units

std::optional<double> pineforge::native_run_spec_v3::NativeRunSpec::max_abs_units

Definition at line 663 of file native_run_spec.hpp.

◆ max_open_lots

std::optional<std::uint64_t> pineforge::native_run_spec_v3::NativeRunSpec::max_open_lots

Definition at line 664 of file native_run_spec.hpp.

◆ allowed_open_directions

NativeOpenDirections pineforge::native_run_spec_v3::NativeRunSpec::allowed_open_directions = NativeOpenDirections::Both

◆ initial_margin_fraction

std::optional<double> pineforge::native_run_spec_v3::NativeRunSpec::initial_margin_fraction

Definition at line 666 of file native_run_spec.hpp.

◆ margin

std::optional<NativeMarginModel> pineforge::native_run_spec_v3::NativeRunSpec::margin

Opt-in generic margin model.

Mutually exclusive with initial_margin_fraction, which remains the one-scalar spelling. Folded into the continuation digest only when it is present, so a spec that declares none keeps its pre-margin-model identity byte for byte.

Definition at line 672 of file native_run_spec.hpp.

Referenced by pineforge::source::PineExecutionAdapter::project().

◆ risk

std::optional<NativeRiskLimits> pineforge::native_run_spec_v3::NativeRunSpec::risk

Opt-in generic account risk limits.

Absent is the whole default surface: nothing is measured, no risk event is appended, and the continuation digest is the pre-risk one. Folded into it only when the block is present, exactly as margin is.

Definition at line 677 of file native_run_spec.hpp.

◆ report_policy

NativeReportPolicy pineforge::native_run_spec_v3::NativeRunSpec::report_policy = NativeReportPolicy::HostRecorded

◆ report_open_position_at_end

bool pineforge::native_run_spec_v3::NativeRunSpec::report_open_position_at_end = false

Report a position still open at run end as a mark-to-market closed row at the last close.

KernelRecorded only, and reporting only: the live book, the realized sums and every hash are left exactly as the run left them. Inert under HostRecorded, whose host owns the whole report series.

Definition at line 683 of file native_run_spec.hpp.

◆ calculation

NativeCalculationTrigger pineforge::native_run_spec_v3::NativeRunSpec::calculation = NativeCalculationTrigger::BarClose

Calculation timing.

BarClose is the established cadence and the whole default surface; the other triggers only add calculations, never move or remove one. max_recalculations_per_point bounds the fill cascade at one matching point: further executions at that point are still applied and still delivered to on_native_applied, they just stop driving a new calculation. Zero is a legal bound and means "deliver, never recalculate". All three fold into the continuation hash only once the trigger or the open-bar view is non-default, so a spec that leaves the cadence alone keeps the continuation identity it had before these fields existed.

Definition at line 694 of file native_run_spec.hpp.

Referenced by pineforge::source::PineExecutionAdapter::project().

◆ max_recalculations_per_point

std::uint32_t pineforge::native_run_spec_v3::NativeRunSpec::max_recalculations_per_point = 8

◆ open_bar_view

NativeOpenBarView pineforge::native_run_spec_v3::NativeRunSpec::open_bar_view = NativeOpenBarView::Complete

Definition at line 696 of file native_run_spec.hpp.

◆ intrabar

IntrabarPath pineforge::native_run_spec_v3::NativeRunSpec::intrabar {}

◆ subscriptions

std::vector<NativeTimeframeSubscription> pineforge::native_run_spec_v3::NativeRunSpec::subscriptions

Declared higher-timeframe series.

Empty is the whole default surface: no evaluator is registered, no feed is prepared, and the run spec's continuation digest is the pre-subscription one.

Definition at line 701 of file native_run_spec.hpp.

◆ auxiliary_feed

std::optional<NativeAuxiliaryFeed> pineforge::native_run_spec_v3::NativeRunSpec::auxiliary_feed

Opt-in auxiliary finer feed.

Absent is the whole default surface: nothing is stored, nothing is routed, and the continuation digest is the pre-feed one. Folded into it only when the block is present, exactly as margin and risk are.

Definition at line 706 of file native_run_spec.hpp.

Referenced by main().

◆ instrument_feeds

std::vector<NativeInstrumentFeed> pineforge::native_run_spec_v3::NativeRunSpec::instrument_feeds

Opt-in feeds of other instruments.

Empty is the whole default surface: nothing is stored, nothing is delivered, and the continuation digest is the pre-feed one. Folded into it only when there are any, exactly as auxiliary_feed is. See NativeInstrumentFeed.

Definition at line 711 of file native_run_spec.hpp.

Referenced by pineforge::source::PineStrategyHost::prepare_native_begin(), and pineforge::source::PineExecutionAdapter::project().

◆ event_retention

NativeEventRetention pineforge::native_run_spec_v3::NativeRunSpec::event_retention = NativeEventRetention::Window

What native_events() can still return; see NativeEventRetention.

Folded into the spec digest only when it is not Window.

Definition at line 714 of file native_run_spec.hpp.

Referenced by pineforge::source::PineExecutionAdapter::project().

◆ quantity_tolerance

std::optional<double> pineforge::native_run_spec_v3::NativeRunSpec::quantity_tolerance

Opt-in quantity tolerance, in units (finite, positive): two quantities within it of each other are one quantity to the settlement.

A close that comes within it of a FIFO boundary – the binary64 sum of the lots through one of them – ends at that boundary, charged its request, and a lot of at most this size that binary64 cannot take off a close's rest closes whole with the close that reaches it (docs/native- settlement.md, "Quantity tolerance"). Absent is the whole default surface: the settlement stays exact, a quantity it cannot book exactly is that request's MatchRejectReason::UnrepresentableQuantity, and the continuation digest is the pre-tolerance one; the value folds only when present (R5 lane K-ULP4).

Definition at line 726 of file native_run_spec.hpp.


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