From e8c910e52d1807e2fcca3b43d80a9df6acac5387 Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Wed, 12 Jan 2022 06:26:46 +0000
Subject: [PATCH] write price level to each book

---
 protocol.cpp |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/protocol.cpp b/protocol.cpp
index e21a2df..0492374 100644
--- a/protocol.cpp
+++ b/protocol.cpp
@@ -109,24 +109,24 @@
 	case json::SPREAD_TYPE:
 	case json::CALL_TYPE:
 	case json::PUT_TYPE:
-		announce(bs, dynamic_cast<json::AnnounceMessage*>(message));
+		announce(bs, static_cast<json::AnnounceMessage*>(message));
 		break;
 	case json::SETTLEMENT:
-		settle(bs, dynamic_cast<json::SettleMessage*>(message));
+		settle(bs, static_cast<json::SettleMessage*>(message));
 		break;
 	case json::ADDED:
-		addedOrder(bs, dynamic_cast<json::AddedMessage*>(message));
+		addedOrder(bs, static_cast<json::AddedMessage*>(message));
 		break;
 	case json::DELETED:
-		deletedOrder(bs, dynamic_cast<json::DeletedMessage*>(message));
+		deletedOrder(bs, static_cast<json::DeletedMessage*>(message));
 		break;
 	case json::TRADE:
-		tradeOrder(bs, dynamic_cast<json::TradeMessage*>(message));
+		tradeOrder(bs, static_cast<json::TradeMessage*>(message));
 		break;
 	case json::BROKER_REQUEST:
 	case json::BROKER_ACK:
 	case json::BROKER_CONFIRM:
-		broker(bs, dynamic_cast<json::Broker*>(message));
+		broker(bs, static_cast<json::Broker*>(message));
 		break;
 	default:;
 	}
@@ -170,7 +170,7 @@
 void tradeOrder(std::unordered_map<std::string, book::Book>& bs,
                 json::TradeMessage* message)
 {
-	if (bs.contains(message->passiveOrder)) {
+	if (bs.find(message->passiveOrder) != bs.end()) {
 		if (message->tradeType == json::BUY_AGGRESSOR) {
 			if (message->passiveOrderRemaining > 0) {
 				bs[message->product].askSide.at(message->passiveOrder).volume =

--
Gitblit v1.9.3