Add implemented and used getKnownProducts from MerkelMain

This commit is contained in:
Lev
2021-05-26 01:16:37 -05:00
parent 25e93995b9
commit e212127cd3
11 changed files with 3962 additions and 0 deletions

View File

@ -0,0 +1,36 @@
#include "OrderBook.h"
#include "CSVReader.h"
#include <map>
/* 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<std::string> OrderBook::getKnownProducts()
{
std::vector<std::string> products;
std::map<std::string, bool> 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<OrderBookEntry> OrderBook::getOrders(OrderBookType type, std::string product, std::string timestamp)
{
std::vector<OrderBookEntry> order_selection;
return order_selection;
}