FastMM documentation
FastMM C++ API 0.14.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
fastmm::store::Backend Class Referenceabstract

#include <fastmm/store/backend.hpp>

Public Member Functions

 Backend ()=default
 
virtual ~Backend ()=default
 
 Backend (const Backend &)=delete
 
Backend & operator= (const Backend &)=delete
 
virtual std::string_view name () const noexcept=0
 
virtual Result< void, std::string > open (const BackendOptions &opts)=0
 Opens or creates the store and brings its schema up to date.
 
virtual Result< void, std::string > session_open (const SessionOpen &s)=0
 
virtual Result< void, std::string > instruments (std::uint64_t session_id, std::span< const Instrument > table)=0
 The instrument table of this session, by dense id.
 
virtual void begin ()=0
 One batch. StoreThread calls begin(), then zero or more records, then commit().
 
virtual void fill (const FillRecord &r)=0
 
virtual void order (const OrderRecord &r)=0
 
virtual void position (const PositionRecord &r)=0
 
virtual void kill (const KillRecord &r)=0
 
virtual void funding (const FundingRecord &)
 A funding payment.
 
virtual void replayed (const ReplayedRecord &)
 A venue's execution replay ended complete.
 
virtual void param (const ParamRecord &)
 A strategy parameter update the engine applied. The default drops it.
 
virtual void reject (const RejectRecord &)
 An order refused by the pre-trade checks or by its venue. The default drops it.
 
virtual void limits (const LimitsRecord &)
 An operator's risk limit change the engine applied. The default drops it.
 
virtual void markout (const MarkoutRecord &)
 The mid at or after a fill ([engine] markout_ms).
 
virtual void capacity (const CapacityRecord &)
 A minute of one account's capacity price ([capacity]). The default drops it.
 
virtual void context_names (const ContextNamesRecord &)
 The names of the strategy's quote context values (FillRecord::order_context).
 
virtual void commit ()=0
 
virtual void idle (std::int64_t)
 StoreThread calls it when the ring is empty, outside a batch, with the wall clock: a backend may do one small piece of housekeeping (the SQLite backend's [storage] retention_days) and must return within milliseconds, since records wait in the ring meanwhile.
 
virtual Result< void, std::string > session_close (const SessionClose &s)=0
 
virtual void close ()=0
 
virtual std::uint64_t rows () const noexcept=0
 Any thread: fastmm-live reads them for the status file while the store thread writes.
 
virtual std::uint64_t errors () const noexcept=0
 
virtual std::string last_error () const =0
 

Constructor & Destructor Documentation

◆ Backend() [1/2]

fastmm::store::Backend::Backend ( )
default

◆ ~Backend()

virtual fastmm::store::Backend::~Backend ( )
virtualdefault

◆ Backend() [2/2]

fastmm::store::Backend::Backend ( const Backend &  )
delete

Member Function Documentation

◆ operator=()

Backend & fastmm::store::Backend::operator= ( const Backend &  )
delete

◆ name()

virtual std::string_view fastmm::store::Backend::name ( ) const
pure virtualnoexcept

◆ open()

virtual Result< void, std::string > fastmm::store::Backend::open ( const BackendOptions &  opts)
pure virtual

Opens or creates the store and brings its schema up to date.

A failure here stops the session from starting: an operator who does not want a store sets backend = "none".

◆ session_open()

virtual Result< void, std::string > fastmm::store::Backend::session_open ( const SessionOpen &  s)
pure virtual

◆ instruments()

virtual Result< void, std::string > fastmm::store::Backend::instruments ( std::uint64_t  session_id,
std::span< const Instrument >  table 
)
pure virtual

The instrument table of this session, by dense id.

◆ begin()

virtual void fastmm::store::Backend::begin ( )
pure virtual

One batch. StoreThread calls begin(), then zero or more records, then commit().

◆ fill()

virtual void fastmm::store::Backend::fill ( const FillRecord &  r)
pure virtual

◆ order()

virtual void fastmm::store::Backend::order ( const OrderRecord &  r)
pure virtual

◆ position()

virtual void fastmm::store::Backend::position ( const PositionRecord &  r)
pure virtual

◆ kill()

virtual void fastmm::store::Backend::kill ( const KillRecord &  r)
pure virtual

◆ funding()

virtual void fastmm::store::Backend::funding ( const FundingRecord &  )
inlinevirtual

A funding payment.

The default drops it: a backend written before funding was booked keeps building (its positions still carry funding inside realized).

◆ replayed()

virtual void fastmm::store::Backend::replayed ( const ReplayedRecord &  )
inlinevirtual

A venue's execution replay ended complete.

The default drops it: a restart from such a store judges a session by whether it placed an order on the venue or shut down (Recovery).

◆ param()

virtual void fastmm::store::Backend::param ( const ParamRecord &  )
inlinevirtual

A strategy parameter update the engine applied. The default drops it.

◆ reject()

virtual void fastmm::store::Backend::reject ( const RejectRecord &  )
inlinevirtual

An order refused by the pre-trade checks or by its venue. The default drops it.

◆ limits()

virtual void fastmm::store::Backend::limits ( const LimitsRecord &  )
inlinevirtual

An operator's risk limit change the engine applied. The default drops it.

◆ markout()

virtual void fastmm::store::Backend::markout ( const MarkoutRecord &  )
inlinevirtual

The mid at or after a fill ([engine] markout_ms).

◆ capacity()

virtual void fastmm::store::Backend::capacity ( const CapacityRecord &  )
inlinevirtual

A minute of one account's capacity price ([capacity]). The default drops it.

◆ context_names()

virtual void fastmm::store::Backend::context_names ( const ContextNamesRecord &  )
inlinevirtual

The names of the strategy's quote context values (FillRecord::order_context).

The default drops them.

◆ commit()

virtual void fastmm::store::Backend::commit ( )
pure virtual

◆ idle()

virtual void fastmm::store::Backend::idle ( std::int64_t  )
inlinevirtual

StoreThread calls it when the ring is empty, outside a batch, with the wall clock: a backend may do one small piece of housekeeping (the SQLite backend's [storage] retention_days) and must return within milliseconds, since records wait in the ring meanwhile.

The default does nothing.

◆ session_close()

virtual Result< void, std::string > fastmm::store::Backend::session_close ( const SessionClose &  s)
pure virtual

◆ close()

virtual void fastmm::store::Backend::close ( )
pure virtual

◆ rows()

virtual std::uint64_t fastmm::store::Backend::rows ( ) const
pure virtualnoexcept

Any thread: fastmm-live reads them for the status file while the store thread writes.

◆ errors()

virtual std::uint64_t fastmm::store::Backend::errors ( ) const
pure virtualnoexcept

◆ last_error()

virtual std::string fastmm::store::Backend::last_error ( ) const
pure virtual