PineForge HPO 0.1.0
Native hyperparameter optimization for PineForge strategies
Loading...
Searching...
No Matches
pineforge::hpo::Dataset Class Referencefinal

Immutable in-memory OHLCV input shared by independent trial executions. More...

#include <pineforge/hpo/dataset.hpp>

Public Member Functions

 Dataset (std::vector< pf_bar_t > bars)
 Takes ownership of validated bars.
 
const pf_bar_t * data () const noexcept
 Returns a const pointer suitable for PineForge backtest calls.
 
std::size_t size () const noexcept
 Returns the number of bars.
 
bool empty () const noexcept
 Returns whether the dataset contains no bars.
 
const std::vector< pf_bar_t > & bars () const noexcept
 Returns the immutable owning bar container.
 

Static Public Member Functions

static Dataset load_csv (const std::filesystem::path &path)
 Loads timestamp,open,high,low,close,volume columns from a CSV file.
 

Detailed Description

Immutable in-memory OHLCV input shared by independent trial executions.

The public API intentionally exposes only const access even though the legacy PineForge C ABI accepts pf_bar_t* rather than const pf_bar_t*. Timestamps must be strictly increasing and every OHLCV value must be finite.

Definition at line 17 of file dataset.hpp.

Constructor & Destructor Documentation

◆ Dataset()

pineforge::hpo::Dataset::Dataset ( std::vector< pf_bar_t >  bars)
explicit

Takes ownership of validated bars.

Exceptions
std::invalid_argumentfor non-finite values or non-increasing timestamps.

Member Function Documentation

◆ bars()

const std::vector< pf_bar_t > & pineforge::hpo::Dataset::bars ( ) const
inlinenoexcept

Returns the immutable owning bar container.

Definition at line 38 of file dataset.hpp.

◆ data()

const pf_bar_t * pineforge::hpo::Dataset::data ( ) const
inlinenoexcept

Returns a const pointer suitable for PineForge backtest calls.

Definition at line 32 of file dataset.hpp.

◆ empty()

bool pineforge::hpo::Dataset::empty ( ) const
inlinenoexcept

Returns whether the dataset contains no bars.

Definition at line 36 of file dataset.hpp.

◆ load_csv()

static Dataset pineforge::hpo::Dataset::load_csv ( const std::filesystem::path &  path)
static

Loads timestamp,open,high,low,close,volume columns from a CSV file.

Header matching is ASCII case-insensitive, blank data lines are ignored, and quoted CSV fields are supported. The result contains at least one bar.

Exceptions
std::runtime_errorwhen the file cannot be read or its CSV data is invalid.
std::invalid_argumentwhen parsed bars violate Dataset invariants.

◆ size()

std::size_t pineforge::hpo::Dataset::size ( ) const
inlinenoexcept

Returns the number of bars.

Definition at line 34 of file dataset.hpp.


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