-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOrderBookEntry.h
44 lines (39 loc) · 990 Bytes
/
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
44
#pragma once
#include <string>
enum class OrderBookType
{
bid,
ask,
asksale,
bidsale,
unknown
};
class OrderBookEntry
{
public:
static bool compareByTimestamp(OrderBookEntry &e1, OrderBookEntry &e2)
{
return e1.timestamp < e2.timestamp;
}
static bool compareByPriceAsc(OrderBookEntry &e1, OrderBookEntry &e2)
{
return e1.price < e2.price;
}
static bool compareByPriceDec(OrderBookEntry &e1, OrderBookEntry &e2)
{
return e1.price > e2.price;
}
double price;
double amount;
std::string timestamp;
std::string product;
OrderBookType orderType;
std::string username;
OrderBookEntry(double _price,
double _amount,
std::string _timestamp,
std::string _product,
OrderBookType _orderType,
std::string username = "dataset");
static OrderBookType stringToOrderBookType(std::string s);
};