Slick Trader 0.11.0
Multi-broker algorithmic trading engine with plugin strategies and a live web dashboard
Loading...
Searching...
No Matches
order_book_event.hpp
Go to the documentation of this file.
1#pragma once
2
5#include <type_traits>
6
7namespace slick::trader {
8
9constexpr size_t MAX_ORDER_BOOK_LEVELS = 10;
10
11#pragma pack(push, 1)
19
20// OrderBookEvent - POD struct for lock-free queue
21struct OrderBookEvent : public Event {
24 uint16_t num_bids;
25 uint16_t num_asks;
26 uint64_t sequence_num;
27 bool is_snapshot; // true for snapshot, false for update
28
31 , bids{}
32 , asks{}
33 , num_bids(0)
34 , num_asks(0)
35 , sequence_num(0)
36 , is_snapshot(false) {}
37};
38#pragma pack(pop)
39
40static_assert(std::is_trivially_copyable_v<OrderBookEvent>, "OrderBookEvent must be trivially copyable");
41
42} // namespace slick::trader
int64_t qty_t
Definition types.hpp:17
int64_t price_t
Definition types.hpp:16
constexpr size_t MAX_ORDER_BOOK_LEVELS
Event(EventType t=EventType::TRADE)
Definition event.hpp:63
OrderBookPriceLevel asks[MAX_ORDER_BOOK_LEVELS]
OrderBookPriceLevel bids[MAX_ORDER_BOOK_LEVELS]