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

#include <fastmm/store/reader.hpp>

Public Member Functions

 Reader ()=default
 
virtual ~Reader ()=default
 
 Reader (const Reader &)=delete
 
Reader & operator= (const Reader &)=delete
 
virtual Result< void, std::string > open (const BackendOptions &opts)=0
 
virtual Result< Rows, std::string > sessions (const QueryFilter &f)=0
 One row per session: id, engine, strategy, start, stop, PnL, fills, exit.
 
virtual Result< Rows, std::string > fills (const QueryFilter &f)=0
 One row per execution.
 
virtual Result< Rows, std::string > orders (const QueryFilter &f)=0
 One row per order, in its last known state.
 
virtual Result< Rows, std::string > pnl (const QueryFilter &f)=0
 One row per UTC day, account and symbol: realised (funding included, funding says how much), fees, net, the quantity traded, the executions and the estimates it counts, in the settlement currency.
 
virtual Result< Rows, std::string > books_pnl (const QueryFilter &f)
 The engine's day roll-up of its own position records, as it booked them: one row per UTC day, account and symbol.
 
virtual Result< AbData, std::string > ab_data (const QueryFilter &, const std::string &)
 fastmm-pnl ab: the fills, markouts and arm assignments of the [ab] test test (empty: the newest session's) in the sessions and days f names (ab_readout.hpp).
 
virtual Result< Rows, std::string > funding (const QueryFilter &)
 One row per funding payment. The default has none (a backend without the table).
 
virtual Result< Rows, std::string > duplicates (const QueryFilter &)
 One row per venue execution or funding payment stored more than once (by venue, symbol and the venue's id of it, within an engine): what a restart booked a second time.
 
virtual Result< Rows, std::string > ledger (const QueryFilter &, bool)
 The economic fill ledger: one row per execution (the venue's id of it on an account, symbol and side, within an engine) however many sessions stored it, as the first one did, with when it was first received, the venue's time, the quantity the position took (booked), how many copies there are and its flags (synthetic: booked from a cum_qty jump, no venue report; late: for an order already ended; before_start: traded before the session that booked it started, so it came in through the restart's replay; repeated: stored more than once).
 
virtual Result< Rows, std::string > fill_context (const QueryFilter &)
 One row per execution with its decision record (schema 16): the order's state when the fill arrived, when it was placed and at what price, when its working leg went out (sent; after amends accepted replaces) and was acknowledged, how long it had rested, the cancel or replace in flight and for how long, and the strategy's quote context when the order went out and when the fill arrived.
 
virtual Result< Rows, std::string > order_timeline (const QueryFilter &)
 Everything stored about one client order (f.order), in time order: sent, each refusal, each execution, and its last known state.
 
virtual Result< std::vector< AuditFill >, std::string > booked_fills (const BookedFillQuery &)
 The executions stored for q.venue, of every session of q.engine, by the venue's time of the trade: the venue's trade id, order ids, side, price, quantity and the commission as reported (AuditFill::fee_asset: quote, base or other).
 
virtual Result< Rows, std::string > positions (const QueryFilter &f)=0
 The last position snapshot per session and instrument.
 
virtual Result< Rows, std::string > params (const ParamQuery &)
 The strategy parameters in effect at q.at_ns (0: the session's last update) in the session q.session_id, else the newest of q.engine that started by then: one row per parameter and scope (every instrument, or one that has its own value), with when it was set, its origin (initial, control, strategy) and source.
 
virtual Result< Rows, std::string > param_changes (const QueryFilter &)
 Every parameter update, one row per value it carried, in order: the starting set (origin initial) and each update the engine applied.
 
virtual Result< Rows, std::string > param_diff (std::uint64_t, std::uint64_t)
 The parameters session a ended with against those session b started with: one row per parameter and scope that differs.
 
virtual Result< Rows, std::string > rejects (const QueryFilter &)
 One row per refused order the engine recorded (count with the ones folded into it): when, which account, instrument and side, whether it only reduced the position, the reason, the limit or side that refused it (source) and the account's budget then.
 
virtual Result< Rows, std::string > limit_changes (const QueryFilter &)
 Every risk limit change an operator made at run time (fastmm-ctl limits), one row per key: when, the session, the key, its value before and after, and whether --force turned it off.
 
virtual Result< Rows, std::string > reject_summary (const QueryFilter &)
 The same summed: one row per account, instrument, side, reduces, reason and source.
 
virtual Result< std::string, std::string > session_config (const ParamQuery &)
 The effective configuration (TOML, secrets omitted) of the session q picks as params() does.
 
virtual Result< Recovery, std::string > recovery (const QueryFilter &f)=0
 The newest session of f.engine, summarised.
 

Constructor & Destructor Documentation

◆ Reader() [1/2]

fastmm::store::Reader::Reader ( )
default

◆ ~Reader()

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

◆ Reader() [2/2]

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

Member Function Documentation

◆ operator=()

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

◆ open()

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

◆ sessions()

virtual Result< Rows, std::string > fastmm::store::Reader::sessions ( const QueryFilter &  f)
pure virtual

One row per session: id, engine, strategy, start, stop, PnL, fills, exit.

◆ fills()

virtual Result< Rows, std::string > fastmm::store::Reader::fills ( const QueryFilter &  f)
pure virtual

One row per execution.

◆ orders()

virtual Result< Rows, std::string > fastmm::store::Reader::orders ( const QueryFilter &  f)
pure virtual

One row per order, in its last known state.

◆ pnl()

virtual Result< Rows, std::string > fastmm::store::Reader::pnl ( const QueryFilter &  f)
pure virtual

One row per UTC day, account and symbol: realised (funding included, funding says how much), fees, net, the quantity traded, the executions and the estimates it counts, in the settlement currency.

Recomputed from the stored fills at average cost, so that an execution counts once however many records hold it (a copy another session stored, a repeat the engine booked again, fill_repeats), an estimate (a synthetic fill) counts only for what no execution named since, and a position carries from one session to the next by the name of the account holding it. estimates: the synthetic fills no execution has named, still counted at the order's price and no fee. books_net: the engine's own net for the day (books_pnl), for comparison. A backend or a store that cannot recompute it answers with books_pnl.

◆ books_pnl()

virtual Result< Rows, std::string > fastmm::store::Reader::books_pnl ( const QueryFilter &  f)
inlinevirtual

The engine's day roll-up of its own position records, as it booked them: one row per UTC day, account and symbol.

The default is pnl().

◆ ab_data()

virtual Result< AbData, std::string > fastmm::store::Reader::ab_data ( const QueryFilter &  ,
const std::string &   
)
inlinevirtual

fastmm-pnl ab: the fills, markouts and arm assignments of the [ab] test test (empty: the newest session's) in the sessions and days f names (ab_readout.hpp).

◆ funding()

virtual Result< Rows, std::string > fastmm::store::Reader::funding ( const QueryFilter &  )
inlinevirtual

One row per funding payment. The default has none (a backend without the table).

◆ duplicates()

virtual Result< Rows, std::string > fastmm::store::Reader::duplicates ( const QueryFilter &  )
inlinevirtual

One row per venue execution or funding payment stored more than once (by venue, symbol and the venue's id of it, within an engine): what a restart booked a second time.

Empty in a sound store; the default has none. Filtered by engine and instrument.

◆ ledger()

virtual Result< Rows, std::string > fastmm::store::Reader::ledger ( const QueryFilter &  ,
bool   
)
inlinevirtual

The economic fill ledger: one row per execution (the venue's id of it on an account, symbol and side, within an engine) however many sessions stored it, as the first one did, with when it was first received, the venue's time, the quantity the position took (booked), how many copies there are and its flags (synthetic: booked from a cum_qty jump, no venue report; late: for an order already ended; before_start: traded before the session that booked it started, so it came in through the restart's replay; repeated: stored more than once).

raw lists every stored row instead, with its copy number. A session filter keeps the executions it booked first (raw: its rows). The default cannot answer.

◆ fill_context()

virtual Result< Rows, std::string > fastmm::store::Reader::fill_context ( const QueryFilter &  )
inlinevirtual

One row per execution with its decision record (schema 16): the order's state when the fill arrived, when it was placed and at what price, when its working leg went out (sent; after amends accepted replaces) and was acknowledged, how long it had rested, the cancel or replace in flight and for how long, and the strategy's quote context when the order went out and when the fill arrived.

The context columns are named after the session's quote_context_names (sent_<name>, fill_<name>; ctx0..ctx3 where the sessions shown name them differently or not at all); a value no row has is left out. Filtered like fills(); also by f.order. The default cannot answer.

◆ order_timeline()

virtual Result< Rows, std::string > fastmm::store::Reader::order_timeline ( const QueryFilter &  )
inlinevirtual

Everything stored about one client order (f.order), in time order: sent, each refusal, each execution, and its last known state.

The default cannot answer.

◆ booked_fills()

virtual Result< std::vector< AuditFill >, std::string > fastmm::store::Reader::booked_fills ( const BookedFillQuery &  )
inlinevirtual

The executions stored for q.venue, of every session of q.engine, by the venue's time of the trade: the venue's trade id, order ids, side, price, quantity and the commission as reported (AuditFill::fee_asset: quote, base or other).

Estimates (no trade id) are left out. Needs the venue's names and times (schema 3); the default cannot answer.

◆ positions()

virtual Result< Rows, std::string > fastmm::store::Reader::positions ( const QueryFilter &  f)
pure virtual

The last position snapshot per session and instrument.

◆ params()

virtual Result< Rows, std::string > fastmm::store::Reader::params ( const ParamQuery &  )
inlinevirtual

The strategy parameters in effect at q.at_ns (0: the session's last update) in the session q.session_id, else the newest of q.engine that started by then: one row per parameter and scope (every instrument, or one that has its own value), with when it was set, its origin (initial, control, strategy) and source.

Needs schema 8; the default cannot answer.

◆ param_changes()

virtual Result< Rows, std::string > fastmm::store::Reader::param_changes ( const QueryFilter &  )
inlinevirtual

Every parameter update, one row per value it carried, in order: the starting set (origin initial) and each update the engine applied.

Filtered by engine, session, day and instrument.

◆ param_diff()

virtual Result< Rows, std::string > fastmm::store::Reader::param_diff ( std::uint64_t  ,
std::uint64_t   
)
inlinevirtual

The parameters session a ended with against those session b started with: one row per parameter and scope that differs.

a 0: the session of b's engine that started last before b (what a restart changed).

◆ rejects()

virtual Result< Rows, std::string > fastmm::store::Reader::rejects ( const QueryFilter &  )
inlinevirtual

One row per refused order the engine recorded (count with the ones folded into it): when, which account, instrument and side, whether it only reduced the position, the reason, the limit or side that refused it (source) and the account's budget then.

Filtered by engine, session, day and instrument. Needs schema 9.

◆ limit_changes()

virtual Result< Rows, std::string > fastmm::store::Reader::limit_changes ( const QueryFilter &  )
inlinevirtual

Every risk limit change an operator made at run time (fastmm-ctl limits), one row per key: when, the session, the key, its value before and after, and whether --force turned it off.

Filtered by engine, session and day. Needs schema 11.

◆ reject_summary()

virtual Result< Rows, std::string > fastmm::store::Reader::reject_summary ( const QueryFilter &  )
inlinevirtual

The same summed: one row per account, instrument, side, reduces, reason and source.

◆ session_config()

virtual Result< std::string, std::string > fastmm::store::Reader::session_config ( const ParamQuery &  )
inlinevirtual

The effective configuration (TOML, secrets omitted) of the session q picks as params() does.

◆ recovery()

virtual Result< Recovery, std::string > fastmm::store::Reader::recovery ( const QueryFilter &  f)
pure virtual

The newest session of f.engine, summarised.