-
Notifications
You must be signed in to change notification settings - Fork 0
/
OrderBookEntry.h
43 lines (35 loc) · 1.18 KB
/
OrderBookEntry.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once
#include <string>
/** The type of entries allowed.*/
enum class OrderBookType{bid, ask, unknown, bidsale,asksale};
/** Creates objects that go into the order book.*/
class OrderBookEntry
{
public:
OrderBookEntry( double _price,
double _amount,
std::string _timeStamp,
std::string _product,
OrderBookType _orderType,
std::string username = "dataset");
static OrderBookType strToOBT(std::string);
// comparators for the matching engine
static bool campareByTimestamp(const OrderBookEntry& e1, const OrderBookEntry& e2)
{
return e1.timeStamp < e2.timeStamp;
}
static bool compareByPriceAsc(OrderBookEntry& e1, OrderBookEntry& e2)
{
return e1.price < e2.price;
}
static bool compareByPriceDesc(OrderBookEntry& e1, OrderBookEntry& e2)
{
return e1.price > e2.price;
}
double price;
double amount;
std::string timeStamp;
std::string product;
OrderBookType orderType;
std::string username;
};