#include "OrderBook.h" #include "CSVReader.h" #include /* Construct, reading a csv data file */ OrderBook::OrderBook(std::string filename) { orders = CSVReader::readCSV(filename); } /* return vector of all known products in the dataset */ std::vector OrderBook::getKnownProducts() { std::vector products; std::map productMap; for(OrderBookEntry& entry : orders) { productMap[entry.product] = true; } for(auto const&entry : productMap) { products.push_back(entry.first); } return products; } /* return vector of Orders according to the sent filters */ std::vector OrderBook::getOrders(OrderBookType type, std::string product, std::string timestamp) { std::vector order_selection; for(OrderBookEntry& entry : orders) { if(entry.orderType == type && entry.product == product && entry.timestamp == timestamp) { order_selection.push_back(entry); } } return order_selection; }