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

Data Structures

class  MetricsBindingHashV1
 
struct  MetricsPlainHostV1
 Specialize for the EXACT host passed to PINEFORGE_EXPORT_NATIVE_STRATEGY. More...
 
class  Module
 The one class the macro instantiates: the host plus the module boundary. More...
 

Functions

template<typename Host>
bool metrics_plain_declaration_v1 (MetricsPlainDeclarationV1 &out) noexcept
 
template<typename Host>
std::int32_t metrics_only_capability_v1 () noexcept
 
std::uint64_t next_metrics_attempt_v1 () noexcept
 
BacktestEngine * as_engine (pf_strategy_t strategy)
 
template<typename Host>
Module< Host > * as_module (pf_strategy_t strategy)
 
template<typename Host>
void note_error (pf_strategy_t strategy, const char *text, const RunFailureValue &value)
 
RunFailureValue unclassified_failure () noexcept
 The code of an exception no coded site raised: engine_unclassified_error.
 
template<typename Host>
void note_error (pf_strategy_t strategy, const char *text)
 The text alone, as before run-failure codes: engine_unclassified_error.
 
template<typename Host, typename Fn>
void guarded (pf_strategy_t strategy, Fn &&fn)
 Runs fn and converts any escaping exception into presentation text and its code.
 
Bar copy_bar (const pf_bar_t &in)
 
bool magnifier_unsupported (int bar_magnifier, int magnifier_samples, pf_magnifier_distribution_t distribution)
 A native host owns its own intrabar path through NativeRunSpec::intrabar, so the C magnifier arguments have no meaning here.
 
void publish_report (BacktestEngine *engine, pf_report_t *out)
 Fills a local report first: the caller's struct is written only once the engine has produced a complete, owned value.
 
template<typename Host>
pf_strategy_t create ()
 
void destroy (pf_strategy_t strategy)
 
template<typename Host>
void set_input (pf_strategy_t strategy, const char *key, const char *value)
 
template<typename Host>
void set_override (pf_strategy_t strategy, const char *key, const char *value)
 
template<typename Host>
void set_magnifier_volume_weighted (pf_strategy_t strategy, int on)
 
template<typename Host>
void run_batch (pf_strategy_t strategy, pf_bar_t *bars, int count, const char *input_tf, const char *script_tf, bool with_timeframes, pf_report_t *out)
 
template<typename Host>
void run_backtest (pf_strategy_t strategy, pf_bar_t *bars, int count, pf_report_t *out)
 
template<typename Host>
void run_backtest_full (pf_strategy_t strategy, pf_bar_t *bars, int count, const char *input_tf, const char *script_tf, int bar_magnifier, int magnifier_samples, pf_magnifier_distribution_t magnifier_distribution, pf_report_t *out)
 
void report_free (pf_report_t *report)
 

Function Documentation

◆ metrics_plain_declaration_v1()

template<typename Host>
bool pineforge::native_module::metrics_plain_declaration_v1 ( MetricsPlainDeclarationV1 & out)
noexcept

◆ metrics_only_capability_v1()

template<typename Host>
std::int32_t pineforge::native_module::metrics_only_capability_v1 ( )
noexcept

◆ next_metrics_attempt_v1()

std::uint64_t pineforge::native_module::next_metrics_attempt_v1 ( )
inlinenoexcept

◆ as_engine()

BacktestEngine * pineforge::native_module::as_engine ( pf_strategy_t strategy)
inline

◆ as_module()

template<typename Host>
Module< Host > * pineforge::native_module::as_module ( pf_strategy_t strategy)

Definition at line 336 of file native_module.hpp.

References as_engine(), and pineforge::strategy.

Referenced by note_error(), and run_batch().

◆ note_error() [1/2]

template<typename Host>
void pineforge::native_module::note_error ( pf_strategy_t strategy,
const char * text,
const RunFailureValue & value )

Definition at line 341 of file native_module.hpp.

References as_module(), and pineforge::strategy.

Referenced by guarded(), note_error(), run_backtest_full(), and run_batch().

◆ unclassified_failure()

RunFailureValue pineforge::native_module::unclassified_failure ( )
inlinenoexcept

The code of an exception no coded site raised: engine_unclassified_error.

Definition at line 346 of file native_module.hpp.

References pineforge::engine_unclassified_error.

Referenced by guarded(), note_error(), and run_batch().

◆ note_error() [2/2]

template<typename Host>
void pineforge::native_module::note_error ( pf_strategy_t strategy,
const char * text )

The text alone, as before run-failure codes: engine_unclassified_error.

Definition at line 352 of file native_module.hpp.

References note_error(), pineforge::strategy, and unclassified_failure().

◆ guarded()

template<typename Host, typename Fn>
void pineforge::native_module::guarded ( pf_strategy_t strategy,
Fn && fn )

Runs fn and converts any escaping exception into presentation text and its code.

C callers have no exception channel, so nothing may propagate past here.

Definition at line 360 of file native_module.hpp.

References pineforge::classify_run_failure(), note_error(), pineforge::strategy, and unclassified_failure().

Referenced by set_input(), set_magnifier_volume_weighted(), and set_override().

◆ copy_bar()

◆ magnifier_unsupported()

bool pineforge::native_module::magnifier_unsupported ( int bar_magnifier,
int magnifier_samples,
pf_magnifier_distribution_t distribution )
inline

A native host owns its own intrabar path through NativeRunSpec::intrabar, so the C magnifier arguments have no meaning here.

Only the defaults are accepted; anything else is refused before the run starts.

Definition at line 386 of file native_module.hpp.

References PF_MAGNIFIER_ENDPOINTS.

Referenced by run_backtest_full().

◆ publish_report()

void pineforge::native_module::publish_report ( BacktestEngine * engine,
pf_report_t * out )
inline

Fills a local report first: the caller's struct is written only once the engine has produced a complete, owned value.

Definition at line 394 of file native_module.hpp.

References pineforge::engine_script_run_v19::BacktestEngine::fill_report().

Referenced by run_batch().

◆ create()

template<typename Host>
pf_strategy_t pineforge::native_module::create ( )

Definition at line 407 of file native_module.hpp.

References pf_abi_version().

◆ destroy()

void pineforge::native_module::destroy ( pf_strategy_t strategy)
inline

Definition at line 420 of file native_module.hpp.

References as_engine(), and pineforge::strategy.

◆ set_input()

template<typename Host>
void pineforge::native_module::set_input ( pf_strategy_t strategy,
const char * key,
const char * value )

◆ set_override()

template<typename Host>
void pineforge::native_module::set_override ( pf_strategy_t strategy,
const char * key,
const char * value )

◆ set_magnifier_volume_weighted()

template<typename Host>
void pineforge::native_module::set_magnifier_volume_weighted ( pf_strategy_t strategy,
int on )

◆ run_batch()

template<typename Host>
void pineforge::native_module::run_batch ( pf_strategy_t strategy,
pf_bar_t * bars,
int count,
const char * input_tf,
const char * script_tf,
bool with_timeframes,
pf_report_t * out )

◆ run_backtest()

template<typename Host>
void pineforge::native_module::run_backtest ( pf_strategy_t strategy,
pf_bar_t * bars,
int count,
pf_report_t * out )

Definition at line 483 of file native_module.hpp.

References run_batch(), and pineforge::strategy.

◆ run_backtest_full()

template<typename Host>
void pineforge::native_module::run_backtest_full ( pf_strategy_t strategy,
pf_bar_t * bars,
int count,
const char * input_tf,
const char * script_tf,
int bar_magnifier,
int magnifier_samples,
pf_magnifier_distribution_t magnifier_distribution,
pf_report_t * out )

◆ report_free()

void pineforge::native_module::report_free ( pf_report_t * report)
inline

Definition at line 508 of file native_module.hpp.