PineForge unreleased
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
pineforge::engine_script_run_v19::TradeLedger Class Reference

#include <trade_ledger.hpp>

Data Structures

struct  CacheStats
 
class  const_iterator
 

Public Types

enum class  CacheBypassReason : std::uint32_t {
  none ,
  allocation_failed
}
 
using size_type = std::size_t
 
using value_type = Trade
 
using Visitor = std::function<bool(size_type, const Trade&)>
 
using iterator = const_iterator
 

Public Member Functions

 TradeLedger ()
 
 TradeLedger (size_type cache_rows)
 
 TradeLedger (CacheCapacity capacity)
 
 ~TradeLedger ()
 
 TradeLedger (const TradeLedger &)
 
TradeLedger & operator= (const TradeLedger &)
 
 TradeLedger (TradeLedger &&)
 
TradeLedger & operator= (TradeLedger &&)
 
void set_scratch_directory (const std::string &)
 
const std::string & scratch_directory () const
 
void set_cache_rows (size_type rows)
 
void set_cache_capacity (CacheCapacity capacity)
 
size_type cache_rows () const
 
size_type cache_resident_bytes () const
 
bool cache_allocation_failed () const noexcept
 
CacheStats read_cache_stats () const noexcept
 
size_type cache_size () const
 
void clear ()
 
void reserve (size_type)
 
size_type size () const
 
size_type base () const
 
size_type resident_size () const
 
size_type resident_base () const
 
bool empty () const
 
Trade read (size_type global) const
 
Trade operator[] (size_type global) const
 
Trade at (size_type global) const
 
Trade back () const
 
Trade numeric_at (size_type global) const
 
std::string entry_id_at (size_type global) const
 
double pnl_at (size_type global) const
 
double pnl_pct_at (size_type global) const
 
double commission_at (size_type global) const
 
std::int32_t entry_bar_index_at (size_type global) const
 
std::int32_t exit_bar_index_at (size_type global) const
 
std::uint64_t entry_incarnation_at (size_type global) const
 
double entry_price_at (size_type global) const
 
double exit_price_at (size_type global) const
 
std::int64_t entry_time_at (size_type global) const
 
std::int64_t exit_time_at (size_type global) const
 
double qty_at (size_type global) const
 
double max_runup_at (size_type global) const
 
double max_drawdown_at (size_type global) const
 
bool is_long_at (size_type global) const
 
std::string entry_comment_at (size_type global) const
 
std::string exit_comment_at (size_type global) const
 
std::string exit_id_at (size_type global) const
 
bool entry_id_equals (size_type global, std::string_view rhs) const
 
bool exit_id_equals (size_type global, std::string_view rhs) const
 
bool entry_comment_equals (size_type global, std::string_view rhs) const
 
bool exit_comment_equals (size_type global, std::string_view rhs) const
 
void replace (size_type global, const Trade &)
 
void modify (size_type global, const std::function< void(Trade &)> &)
 
void push_back (const Trade &trade)
 Append at the logical global end (3.4:613-616).
 
void push_back (Trade &&trade)
 
void resize (size_type global_end)
 
const_iterator begin () const
 
const_iterator end () const
 
void visit (size_type first, size_type end, const Visitor &) const
 
bool previous (size_type &cursor, Trade &value) const
 
const Trade & materialize (size_type global) const
 
void seal (size_type global_end)
 
bool entry_id_matches (int index, std::string_view rhs) const
 
bool exit_id_matches (int index, std::string_view rhs) const
 
bool entry_comment_matches (int index, std::string_view rhs) const
 
bool exit_comment_matches (int index, std::string_view rhs) const
 

Static Public Member Functions

static constexpr size_type cache_capacity_bytes (size_type rows) noexcept
 
static size_type cache_rows_for_capacity (CacheCapacity capacity) noexcept
 
static size_type resident_cache_bytes (size_type rows)
 

Static Public Attributes

static constexpr size_type kRecordBytes = 168
 
static constexpr size_type kResidentRows = 64
 
static constexpr size_type kCacheStringBytes = 128
 
static constexpr size_type kLedgerEntryBytes
 
static constexpr size_type kCachePageSlots = 256
 
static constexpr size_type kDefaultCacheRows = 65536
 
static constexpr size_type kMaxCacheRows = 1048576
 
static constexpr size_type kSinkCacheRows = kDefaultCacheRows
 

Detailed Description

Definition at line 34 of file trade_ledger.hpp.

Member Typedef Documentation

◆ size_type

Definition at line 36 of file trade_ledger.hpp.

◆ value_type

◆ Visitor

Definition at line 66 of file trade_ledger.hpp.

◆ iterator

Member Enumeration Documentation

◆ CacheBypassReason

Enumerator
none 
allocation_failed 

Definition at line 133 of file trade_ledger.hpp.

Constructor & Destructor Documentation

◆ TradeLedger() [1/5]

pineforge::engine_script_run_v19::TradeLedger::TradeLedger ( )

◆ TradeLedger() [2/5]

pineforge::engine_script_run_v19::TradeLedger::TradeLedger ( size_type cache_rows)
explicit

References cache_rows().

◆ TradeLedger() [3/5]

pineforge::engine_script_run_v19::TradeLedger::TradeLedger ( CacheCapacity capacity)
explicit

◆ ~TradeLedger()

pineforge::engine_script_run_v19::TradeLedger::~TradeLedger ( )

◆ TradeLedger() [4/5]

pineforge::engine_script_run_v19::TradeLedger::TradeLedger ( const TradeLedger & )

References TradeLedger().

◆ TradeLedger() [5/5]

pineforge::engine_script_run_v19::TradeLedger::TradeLedger ( TradeLedger && )

References TradeLedger().

Member Function Documentation

◆ cache_capacity_bytes()

static constexpr size_type pineforge::engine_script_run_v19::TradeLedger::cache_capacity_bytes ( size_type rows)
inlinestaticconstexprnoexcept

Definition at line 56 of file trade_ledger.hpp.

References kCachePageSlots, and kLedgerEntryBytes.

◆ cache_rows_for_capacity()

static size_type pineforge::engine_script_run_v19::TradeLedger::cache_rows_for_capacity ( CacheCapacity capacity)
staticnoexcept

◆ operator=() [1/2]

TradeLedger & pineforge::engine_script_run_v19::TradeLedger::operator= ( const TradeLedger & )

References TradeLedger().

◆ operator=() [2/2]

TradeLedger & pineforge::engine_script_run_v19::TradeLedger::operator= ( TradeLedger && )

References TradeLedger().

◆ set_scratch_directory()

void pineforge::engine_script_run_v19::TradeLedger::set_scratch_directory ( const std::string & )

◆ scratch_directory()

const std::string & pineforge::engine_script_run_v19::TradeLedger::scratch_directory ( ) const

◆ set_cache_rows()

void pineforge::engine_script_run_v19::TradeLedger::set_cache_rows ( size_type rows)

◆ set_cache_capacity()

void pineforge::engine_script_run_v19::TradeLedger::set_cache_capacity ( CacheCapacity capacity)

◆ cache_rows()

size_type pineforge::engine_script_run_v19::TradeLedger::cache_rows ( ) const

Referenced by TradeLedger().

◆ resident_cache_bytes()

static size_type pineforge::engine_script_run_v19::TradeLedger::resident_cache_bytes ( size_type rows)
static

◆ cache_resident_bytes()

size_type pineforge::engine_script_run_v19::TradeLedger::cache_resident_bytes ( ) const

◆ cache_allocation_failed()

bool pineforge::engine_script_run_v19::TradeLedger::cache_allocation_failed ( ) const
noexcept

◆ read_cache_stats()

CacheStats pineforge::engine_script_run_v19::TradeLedger::read_cache_stats ( ) const
noexcept

References read_cache_stats().

Referenced by read_cache_stats().

◆ cache_size()

size_type pineforge::engine_script_run_v19::TradeLedger::cache_size ( ) const

References cache_size().

Referenced by cache_size().

◆ clear()

void pineforge::engine_script_run_v19::TradeLedger::clear ( )

References clear().

Referenced by clear().

◆ reserve()

void pineforge::engine_script_run_v19::TradeLedger::reserve ( size_type )

References reserve().

Referenced by reserve().

◆ size()

size_type pineforge::engine_script_run_v19::TradeLedger::size ( ) const

References size().

Referenced by pineforge::same_bar_exit_group_possible(), and size().

◆ base()

size_type pineforge::engine_script_run_v19::TradeLedger::base ( ) const

References base().

Referenced by base().

◆ resident_size()

size_type pineforge::engine_script_run_v19::TradeLedger::resident_size ( ) const

References resident_size().

Referenced by resident_size().

◆ resident_base()

size_type pineforge::engine_script_run_v19::TradeLedger::resident_base ( ) const

References resident_base().

Referenced by resident_base().

◆ empty()

bool pineforge::engine_script_run_v19::TradeLedger::empty ( ) const

References empty().

Referenced by empty().

◆ read()

Trade pineforge::engine_script_run_v19::TradeLedger::read ( size_type global) const

References read().

Referenced by read().

◆ operator[]()

Trade pineforge::engine_script_run_v19::TradeLedger::operator[] ( size_type global) const

◆ at()

Trade pineforge::engine_script_run_v19::TradeLedger::at ( size_type global) const

References at().

Referenced by at().

◆ back()

Trade pineforge::engine_script_run_v19::TradeLedger::back ( ) const

References back().

Referenced by back().

◆ numeric_at()

Trade pineforge::engine_script_run_v19::TradeLedger::numeric_at ( size_type global) const

◆ entry_id_at()

std::string pineforge::engine_script_run_v19::TradeLedger::entry_id_at ( size_type global) const

◆ pnl_at()

double pineforge::engine_script_run_v19::TradeLedger::pnl_at ( size_type global) const

References pnl_at().

Referenced by pnl_at().

◆ pnl_pct_at()

double pineforge::engine_script_run_v19::TradeLedger::pnl_pct_at ( size_type global) const

References pnl_pct_at().

Referenced by pnl_pct_at().

◆ commission_at()

double pineforge::engine_script_run_v19::TradeLedger::commission_at ( size_type global) const

References commission_at().

Referenced by commission_at().

◆ entry_bar_index_at()

std::int32_t pineforge::engine_script_run_v19::TradeLedger::entry_bar_index_at ( size_type global) const

References entry_bar_index_at().

Referenced by entry_bar_index_at().

◆ exit_bar_index_at()

std::int32_t pineforge::engine_script_run_v19::TradeLedger::exit_bar_index_at ( size_type global) const

References exit_bar_index_at().

Referenced by exit_bar_index_at().

◆ entry_incarnation_at()

std::uint64_t pineforge::engine_script_run_v19::TradeLedger::entry_incarnation_at ( size_type global) const

References entry_incarnation_at().

Referenced by entry_incarnation_at().

◆ entry_price_at()

double pineforge::engine_script_run_v19::TradeLedger::entry_price_at ( size_type global) const

References entry_price_at().

Referenced by entry_price_at().

◆ exit_price_at()

double pineforge::engine_script_run_v19::TradeLedger::exit_price_at ( size_type global) const

References exit_price_at().

Referenced by exit_price_at().

◆ entry_time_at()

std::int64_t pineforge::engine_script_run_v19::TradeLedger::entry_time_at ( size_type global) const

References entry_time_at().

Referenced by entry_time_at().

◆ exit_time_at()

std::int64_t pineforge::engine_script_run_v19::TradeLedger::exit_time_at ( size_type global) const

References exit_time_at().

Referenced by exit_time_at().

◆ qty_at()

double pineforge::engine_script_run_v19::TradeLedger::qty_at ( size_type global) const

References qty_at().

Referenced by qty_at().

◆ max_runup_at()

double pineforge::engine_script_run_v19::TradeLedger::max_runup_at ( size_type global) const

References max_runup_at().

Referenced by max_runup_at().

◆ max_drawdown_at()

double pineforge::engine_script_run_v19::TradeLedger::max_drawdown_at ( size_type global) const

References max_drawdown_at().

Referenced by max_drawdown_at().

◆ is_long_at()

bool pineforge::engine_script_run_v19::TradeLedger::is_long_at ( size_type global) const

References is_long_at().

Referenced by is_long_at().

◆ entry_comment_at()

std::string pineforge::engine_script_run_v19::TradeLedger::entry_comment_at ( size_type global) const

References entry_comment_at().

Referenced by entry_comment_at().

◆ exit_comment_at()

std::string pineforge::engine_script_run_v19::TradeLedger::exit_comment_at ( size_type global) const

References exit_comment_at().

Referenced by exit_comment_at().

◆ exit_id_at()

std::string pineforge::engine_script_run_v19::TradeLedger::exit_id_at ( size_type global) const

References exit_id_at().

Referenced by exit_id_at().

◆ entry_id_equals()

bool pineforge::engine_script_run_v19::TradeLedger::entry_id_equals ( size_type global,
std::string_view rhs ) const

References entry_id_equals().

Referenced by entry_id_equals().

◆ exit_id_equals()

bool pineforge::engine_script_run_v19::TradeLedger::exit_id_equals ( size_type global,
std::string_view rhs ) const

References exit_id_equals().

Referenced by exit_id_equals().

◆ entry_comment_equals()

bool pineforge::engine_script_run_v19::TradeLedger::entry_comment_equals ( size_type global,
std::string_view rhs ) const

References entry_comment_equals().

Referenced by entry_comment_equals().

◆ exit_comment_equals()

bool pineforge::engine_script_run_v19::TradeLedger::exit_comment_equals ( size_type global,
std::string_view rhs ) const

References exit_comment_equals().

Referenced by exit_comment_equals().

◆ replace()

void pineforge::engine_script_run_v19::TradeLedger::replace ( size_type global,
const Trade &  )

References replace().

Referenced by replace().

◆ modify()

void pineforge::engine_script_run_v19::TradeLedger::modify ( size_type global,
const std::function< void(Trade &)> &  )

References modify().

Referenced by modify().

◆ push_back() [1/2]

void pineforge::engine_script_run_v19::TradeLedger::push_back ( const Trade & trade)

Append at the logical global end (3.4:613-616).

References push_back().

Referenced by push_back(), and push_back().

◆ push_back() [2/2]

void pineforge::engine_script_run_v19::TradeLedger::push_back ( Trade && trade)

References push_back().

◆ resize()

void pineforge::engine_script_run_v19::TradeLedger::resize ( size_type global_end)

References resize().

Referenced by resize().

◆ begin()

const_iterator pineforge::engine_script_run_v19::TradeLedger::begin ( ) const

References begin().

Referenced by begin().

◆ end()

const_iterator pineforge::engine_script_run_v19::TradeLedger::end ( ) const

References end().

Referenced by end(), and visit().

◆ visit()

void pineforge::engine_script_run_v19::TradeLedger::visit ( size_type first,
size_type end,
const Visitor &  ) const

References end(), and visit().

Referenced by visit().

◆ previous()

bool pineforge::engine_script_run_v19::TradeLedger::previous ( size_type & cursor,
Trade & value ) const

References previous().

Referenced by previous().

◆ materialize()

const Trade & pineforge::engine_script_run_v19::TradeLedger::materialize ( size_type global) const

References materialize().

Referenced by materialize().

◆ seal()

void pineforge::engine_script_run_v19::TradeLedger::seal ( size_type global_end)

References seal().

Referenced by seal().

◆ entry_id_matches()

bool pineforge::engine_script_run_v19::TradeLedger::entry_id_matches ( int index,
std::string_view rhs ) const

References entry_id_matches().

Referenced by entry_id_matches().

◆ exit_id_matches()

bool pineforge::engine_script_run_v19::TradeLedger::exit_id_matches ( int index,
std::string_view rhs ) const

References exit_id_matches().

Referenced by exit_id_matches().

◆ entry_comment_matches()

bool pineforge::engine_script_run_v19::TradeLedger::entry_comment_matches ( int index,
std::string_view rhs ) const

◆ exit_comment_matches()

bool pineforge::engine_script_run_v19::TradeLedger::exit_comment_matches ( int index,
std::string_view rhs ) const

References exit_comment_matches().

Referenced by exit_comment_matches().

Field Documentation

◆ kRecordBytes

size_type pineforge::engine_script_run_v19::TradeLedger::kRecordBytes = 168
staticconstexpr

Definition at line 41 of file trade_ledger.hpp.

◆ kResidentRows

size_type pineforge::engine_script_run_v19::TradeLedger::kResidentRows = 64
staticconstexpr

Definition at line 42 of file trade_ledger.hpp.

◆ kCacheStringBytes

size_type pineforge::engine_script_run_v19::TradeLedger::kCacheStringBytes = 128
staticconstexpr

Definition at line 50 of file trade_ledger.hpp.

◆ kLedgerEntryBytes

size_type pineforge::engine_script_run_v19::TradeLedger::kLedgerEntryBytes
staticconstexpr
Initial value:

Definition at line 51 of file trade_ledger.hpp.

Referenced by cache_capacity_bytes().

◆ kCachePageSlots

size_type pineforge::engine_script_run_v19::TradeLedger::kCachePageSlots = 256
staticconstexpr

Definition at line 53 of file trade_ledger.hpp.

Referenced by cache_capacity_bytes().

◆ kDefaultCacheRows

size_type pineforge::engine_script_run_v19::TradeLedger::kDefaultCacheRows = 65536
staticconstexpr

Definition at line 54 of file trade_ledger.hpp.

◆ kMaxCacheRows

size_type pineforge::engine_script_run_v19::TradeLedger::kMaxCacheRows = 1048576
staticconstexpr

Definition at line 55 of file trade_ledger.hpp.

◆ kSinkCacheRows

size_type pineforge::engine_script_run_v19::TradeLedger::kSinkCacheRows = kDefaultCacheRows
staticconstexpr

Definition at line 65 of file trade_ledger.hpp.


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