29struct PnlDecomposition {
82 std::uint64_t
fills = 0;
Post-fill markouts: the metric that separates spread captured from adverse selection.
Definition backtest_config.hpp:39
constexpr double kMinAnnualizedDurationS
Shortest run whose Sharpe ratio is annualised: one day.
Definition metrics.hpp:118
Metrics compute_metrics(const EquityRows &equity, const FillRows &fills, const OrderRows &orders, const MetricsInputs &in)
constexpr Duration seconds(std::int64_t v) noexcept
Definition time.hpp:41
Diagnostics of how the fills were obtained, next to the markouts.
Definition metrics.hpp:46
double queue_ahead_mean
base units
Definition metrics.hpp:65
std::uint64_t quotes_placed
Definition metrics.hpp:61
std::uint64_t time_to_fill_p50_ns
Venue arrival of a new order to its first fill. Only orders that filled are counted.
Definition metrics.hpp:56
double queue_ahead_p90
Definition metrics.hpp:67
double inside_touch_share
fills at a better price than the touch (it improved it)
Definition metrics.hpp:52
std::uint64_t quotes_filled
Definition metrics.hpp:62
double realized_spread_bps
Notional-weighted (mid at fill - price) for buys, (price - mid at fill) for sells,...
Definition metrics.hpp:49
std::uint64_t time_to_fill_p90_ns
Definition metrics.hpp:57
std::uint64_t time_to_fill_p99_ns
Definition metrics.hpp:58
double realized_spread_quote
Definition metrics.hpp:50
double at_touch_share
fills at the venue's best price on our side
Definition metrics.hpp:51
bool queue_position_known
Displayed quantity still ahead of the order when it filled; the L2Queue fill model only.
Definition metrics.hpp:64
double behind_touch_share
fills at a worse price than the touch
Definition metrics.hpp:53
double through_touch_share
fills at or beyond the opposite touch (aggressive)
Definition metrics.hpp:54
double fill_rate_per_quote
Share of new orders that got at least one fill (fill_ratio counts fills per order instead).
Definition metrics.hpp:60
double queue_ahead_p50
Definition metrics.hpp:66
Buckets of one horizon, all over the same measured fills.
Definition markout.hpp:58
Definition metrics.hpp:70
double fill_ratio
fills / new orders
Definition metrics.hpp:91
double final_position
base units, summed over instruments
Definition metrics.hpp:76
std::uint64_t replaces
Definition metrics.hpp:89
std::uint64_t rejects
Definition metrics.hpp:90
double fees
Definition metrics.hpp:75
double net_pnl
PnL in quote currency at the last bar: net == realized + unrealized - fees.
Definition metrics.hpp:72
std::vector< MarkoutHorizon > markouts
one entry per configured horizon, in order
Definition metrics.hpp:111
double inventory_max
max |position| over bars
Definition metrics.hpp:97
std::uint64_t maker_fills
Definition metrics.hpp:85
std::uint64_t virtual_tick_to_order_p99_ns
Definition metrics.hpp:104
double spread_captured_bps
mean of (mid - px) / mid for buys, (px - mid) / mid sells
Definition metrics.hpp:92
PnlDecomposition decomposition
Where the net PnL came from, and how good the fills were. See markout.hpp.
Definition metrics.hpp:109
double sharpe_annualized
sharpe_bar * sqrt(bars per 365-day year); NaN for runs shorter than kMinAnnualizedDurationS,...
Definition metrics.hpp:80
FillQuality fill_quality
Definition metrics.hpp:110
std::uint64_t taker_fills
Definition metrics.hpp:86
std::uint64_t bars
Definition metrics.hpp:99
double volume_quote
Definition metrics.hpp:94
double duration_s
Definition metrics.hpp:100
std::uint64_t cancels
Definition metrics.hpp:88
double volume_base
Definition metrics.hpp:93
std::uint64_t wall_tick_to_order_p99_ns
Definition metrics.hpp:107
double unrealized_pnl
Definition metrics.hpp:74
const MarkoutHorizon * markout(std::int64_t horizon_ns) const noexcept
The markout of one horizon, or nullptr when it was not measured.
double realized_pnl
Definition metrics.hpp:73
double quote_uptime
fraction of bars with both a bid and an ask resting
Definition metrics.hpp:98
std::uint64_t virtual_tick_to_order_p50_ns
Virtual tick-to-order: engine receipt of the triggering event (T0, virtual clock) to the order's arri...
Definition metrics.hpp:103
double inventory_mean
over bars
Definition metrics.hpp:95
std::uint64_t orders
new orders sent
Definition metrics.hpp:87
std::uint64_t fills
Definition metrics.hpp:84
double sharpe_bar
mean / sample stdev of per-bar equity changes
Definition metrics.hpp:77
double max_drawdown
largest fall of equity from its peak, quote currency, >= 0
Definition metrics.hpp:81
double max_drawdown_pct
max_drawdown / initial_capital; NaN when initial_capital <= 0.
Definition metrics.hpp:83
std::uint64_t wall_tick_to_order_p50_ns
Measured wall clock per engine step that consumed market data (0 when not measured).
Definition metrics.hpp:106
double inventory_abs_mean
over bars
Definition metrics.hpp:96
How the net PnL of the run splits into the parts a market maker can act on: net == spread_capture + m...
Definition metrics.hpp:31
double notional
traded notional of every fill
Definition metrics.hpp:39
double spread_capture
sum of signed_qty * (mid at fill - fill price)
Definition metrics.hpp:32
std::uint64_t fills
Definition metrics.hpp:42
double capture_notional
traded notional of the fills that had a mid at the fill
Definition metrics.hpp:40
double residual
reported net PnL - net
Definition metrics.hpp:38
double spread_capture_bps
Definition metrics.hpp:33
double fees_paid
sum of the positive fees, >= 0
Definition metrics.hpp:35
std::uint64_t capture_fills
Definition metrics.hpp:41
double rebates_received
sum of the negative fees with the sign flipped, >= 0
Definition metrics.hpp:36
double net
spread_capture + mid_drift - fees_paid + rebates_received
Definition metrics.hpp:37
double mid_drift
sum of signed_qty * (final mid - mid at fill)
Definition metrics.hpp:34