CppTrader 1.0.5.0
C++ Trader
Loading...
Searching...
No Matches
level.inl
Go to the documentation of this file.
1
9namespace CppTrader {
10namespace Matching {
11
12template <class TOutputStream>
13inline TOutputStream& operator<<(TOutputStream& stream, LevelType type)
14{
15 switch (type)
16 {
17 case LevelType::BID:
18 stream << "BID";
19 break;
20 case LevelType::ASK:
21 stream << "ASK";
22 break;
23 default:
24 stream << "<unknown>";
25 break;
26 }
27 return stream;
28}
29
30inline Level::Level(LevelType type, uint64_t price) noexcept
31 : Type(type),
32 Price(price),
33 TotalVolume(0),
34 HiddenVolume(0),
35 VisibleVolume(0),
36 Orders(0)
37{
38}
39
40template <class TOutputStream>
41inline TOutputStream& operator<<(TOutputStream& stream, const Level& level)
42{
43 stream << "Level(Type=" << level.Type
44 << "; Price=" << level.Price
45 << "; TotalVolume=" << level.TotalVolume
46 << "; HiddenVolume=" << level.HiddenVolume
47 << "; VisibleVolume=" << level.VisibleVolume
48 << "; Orders=" << level.Orders
49 << ")";
50 return stream;
51}
52
53inline LevelNode::LevelNode(LevelType type, uint64_t price) noexcept
54 : Level(type, price)
55{
56}
57
58inline LevelNode::LevelNode(const Level& level) noexcept : Level(level)
59{
60}
61
62inline LevelNode& LevelNode::operator=(const Level& level) noexcept
63{
64 Level::operator=(level);
65 OrderList.clear();
66 return *this;
67}
68
69inline LevelUpdate::LevelUpdate(UpdateType type, const Level& update, bool top) noexcept
70 : Type(type),
71 Update(update),
72 Top(top)
73{
74}
75
76template <class TOutputStream>
77inline TOutputStream& operator<<(TOutputStream& stream, const LevelUpdate& update)
78{
79 stream << "LevelUpdate(Type=" << update.Type
80 << "; Update=" << update.Update
81 << "; Top=" << update.Top
82 << ")";
83 return stream;
84}
85
86} // namespace Matching
87} // namespace CppTrader
LevelType
Price level type.
Definition level.h:22
TOutputStream & operator<<(TOutputStream &stream, ErrorCode error)
Definition errors.inl:13
UpdateType
Update type.
Definition update.h:21
C++ Trader project definitions.
Definition errors.h:16
size_t Orders
Level orders.
Definition level.h:44
uint64_t TotalVolume
Level volume.
Definition level.h:38
LevelType Type
Level type.
Definition level.h:34
Level(LevelType type, uint64_t price) noexcept
Definition level.inl:30
uint64_t HiddenVolume
Level hidden volume.
Definition level.h:40
uint64_t Price
Level price.
Definition level.h:36
uint64_t VisibleVolume
Level visible volume.
Definition level.h:42
Level & operator=(const Level &) noexcept=default
Price level node.
Definition level.h:79
LevelNode(LevelType type, uint64_t price) noexcept
Definition level.inl:53
LevelNode & operator=(const Level &level) noexcept
Definition level.inl:62
Price level update.
Definition level.h:110
Level Update
Level update value.
Definition level.h:114
bool Top
Top of the book flag.
Definition level.h:116
LevelUpdate(UpdateType type, const Level &update, bool top) noexcept
Definition level.inl:69
UpdateType Type
Update type.
Definition level.h:112