Update insertOrder function
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
#include "OrderBook.h"
|
||||
#include "CSVReader.h"
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
/* Construct, reading a csv data file */
|
||||
OrderBook::OrderBook(std::string filename)
|
||||
@ -88,4 +89,10 @@ std::string OrderBook::getNextTime(std::string timestamp)
|
||||
next_timestamp = orders[0].timestamp;
|
||||
}
|
||||
return next_timestamp;
|
||||
}
|
||||
|
||||
void OrderBook::insertOrder(OrderBookEntry& order)
|
||||
{
|
||||
orders.push_back(order);
|
||||
std::sort(orders.begin(), orders.end(), OrderBookEntry::compareByTimestamp);
|
||||
}
|
||||
Reference in New Issue
Block a user