|
| | L2Book () noexcept=default |
| |
| void | clear () noexcept |
| |
| FASTMM_FORCE_INLINE bool | apply_level (Side side, Price price, Qty qty) noexcept |
| | Sets/updates/deletes (qty == 0) one level.
|
| |
| FASTMM_FORCE_INLINE bool | apply_level (Side side, Price price, Qty qty, Qty &old) noexcept |
| | The same; old is the quantity the level had (zero when absent).
|
| |
| bool | add_own (Side side, Price price, Qty qty, bool &inserted) noexcept |
| |
| void | remove_own (Side side, Price price, Qty qty, bool inserted) noexcept |
| |
| void | apply_snapshot (std::span< const Level > bids, std::span< const Level > asks, std::uint64_t seq, Timestamp ts) noexcept |
| | O(levels) for a snapshot sorted best-first or worst-first with no empty level (what every parser sends); any other input is applied level by level.
|
| |
| void | apply_delta (const BookDeltaMsg &d) noexcept |
| | Applies a BookDeltaMsg (or snapshot with kSnapshot).
|
| |
| void | set_seq (std::uint64_t s) noexcept |
| |
| void | set_last_update (Timestamp t) noexcept |
| |
| void | mark_snapshot () noexcept |
| |
| FASTMM_FORCE_INLINE Level | best_bid () const noexcept |
| |
| FASTMM_FORCE_INLINE Level | best_ask () const noexcept |
| |
| Price | mid () const noexcept |
| |
| Price | spread () const noexcept |
| |
| Level | level (Side side, std::size_t i) const noexcept |
| | i == 0 is best. Level{} if out of range.
|
| |
| std::size_t | depth (Side side) const noexcept |
| |
| std::size_t | depth () const noexcept |
| |
| Qty | qty_at_or_better (Side side, Price limit) const noexcept |
| | Total quantity on side at prices at-or-better than limit.
|
| |
| Price | price_for_qty (Side side, Qty qty) const noexcept |
| | Price of the level at which cumulative quantity from the best reaches qty; Price{} if the side is too thin.
|
| |
| template<class F > |
| void | for_each_level (Side side, F &&f) const noexcept |
| | Visits levels best-first. F(const Level&) may return bool (false stops) or void.
|
| |
| template<std::size_t N> |
| TopLevels< N > | top (Side side) const noexcept |
| |
| bool | crossed () const noexcept |
| |
| Duration | crossed_for (Timestamp now) const noexcept |
| | How long the book has been crossed as of now (zero if not crossed).
|
| |
| bool | truncated (Side side) const noexcept |
| |
| bool | truncated () const noexcept |
| |
| bool | has_snapshot () const noexcept |
| |
| bool | is_valid () const noexcept |
| |
| std::uint64_t | seq () const noexcept |
| |
| Timestamp | last_update () const noexcept |
| |
| const Levels & | raw (Side side) const noexcept |
| |
template<std::size_t kMaxDepth = 256>
The same; old is the quantity the level had (zero when absent).
< delete of an unknown level: no-op
< worse than everything we hold
Drop the worst level and insert in one shift: only the i - 1 levels worse than the new one move, as an insert into a side with room moves the ones better than it.
template<std::size_t kMaxDepth = 256>
Our own quantity shown in a book that is otherwise the market's (the engine's view of a simulated feed that shows our orders, OwnLevelsMsg): add_own() adds qty at price, a level of its own where there is none, beyond kMaxDepth if the side is full (a side has room for kOwnLevels more); remove_own() takes it out again, which leaves the book as it was when nothing else changed it in between.
add_own() returns false, adding nothing, when there is no room.