From d2cfd3eeeb8b6af3b7ccda01e6c1ac581a2df398 Mon Sep 17 00:00:00 2001 From: Joel Grunbaum <joelgrun@gmail.com> Date: Thu, 13 Jan 2022 06:54:09 +0000 Subject: [PATCH] Added time parsing --- book.cpp | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/book.cpp b/book.cpp index 7d74c6b..573fa75 100644 --- a/book.cpp +++ b/book.cpp @@ -71,7 +71,7 @@ std::ostream& operator<<(std::ostream& out, const Level& a) { return out << "Price: " << a.price << ", volume: " << a.volume - << ", time: " << a.timestamp << ", id: " << a.id; + << ", time: " << a.timestamp << ", id: " << a.id; } Book::Book() @@ -86,33 +86,32 @@ double pasFee, double broFee) : bidSide{}, askSide{}, productType{productType}, product(product), stationId(stationId), unit(unit), expiry(expiry), aggFee(aggFee), - pasFee(pasFee), broFee(broFee) + pasFee(pasFee), broFee(broFee), bomPrice(0) { } void Book::ask(Order& order) { - auto a = - this->askSide.emplace(order.id, order); - if (!a.second) { - std::cout << order.id << "already exists" << std::endl; - } + auto a = this->askSide.emplace(order.id, order); + if (!a.second) { + std::cout << order.id << "already exists" << std::endl; + } } void Book::bid(Order& order) { - auto a = - this->bidSide.emplace(order.id, order); - if (!a.second) { - std::cout << order.id << "already exists" << std::endl; - } + auto a = this->bidSide.emplace(order.id, order); + if (!a.second) { + std::cout << order.id << "already exists" << std::endl; + } } void Book::printBook(std::size_t numOrders) { std::cout << "Sell side: " << this->askSide.size() << std::endl; std::vector<Level> askCopy; - for (auto i : this->askSide) askCopy.push_back(i.second); + for (auto i : this->askSide) + askCopy.push_back(i.second); std::size_t count = 0; std::sort(askCopy.begin(), askCopy.end()); for (auto i = askCopy.rbegin(); i != askCopy.rend(); i++) { @@ -122,7 +121,8 @@ } std::cout << "Buy side: " << this->bidSide.size() << std::endl; std::vector<Level> bidCopy; - for (auto i : this->bidSide) bidCopy.push_back(i.second); + for (auto i : this->bidSide) + bidCopy.push_back(i.second); count = 0; std::sort(bidCopy.begin(), bidCopy.end()); for (auto i = bidCopy.rbegin(); i != bidCopy.rend(); i++) { -- Gitblit v1.9.3