-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOrderBook.h
37 lines (30 loc) · 1.1 KB
/
OrderBook.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
#pragma once
#include "OrderBookEntry.h"
#include "CSVReader.h"
#include <string>
#include <vector>
class OrderBook
{
public:
/** construct, reading a csv data file */
OrderBook(std::string filename);
/** return vector of all know products in the dataset*/
std::vector<std::string> getKnownProducts();
/** return vector of Orders according to the sent filters*/
std::vector<OrderBookEntry> getOrders(OrderBookType type,
std::string product,
std::string timestamp);
/** returns the earliest time in the orderbook*/
std::string getEarliestTime();
/** returns the next time after the
* sent time in the orderbook
* If there is no next timestamp, wraps around to the start
* */
std::string getNextTime(std::string timestamp);
void insertOrder(OrderBookEntry& order);
std::vector<OrderBookEntry> matchAsksToBids(std::string product, std::string timestamp);
static double getHighPrice(std::vector<OrderBookEntry>& orders);
static double getLowPrice(std::vector<OrderBookEntry>& orders);
private:
std::vector<OrderBookEntry> orders;
};