From 128c6d51ec8c70e230dc86b100cb887ba3f0378d Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Thu, 20 Jan 2022 07:00:50 +0000
Subject: [PATCH] Secrets to macros and c string concat at compile time

---
 strat.cpp |   45 +++++++++++++++++++++++++++------------------
 1 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/strat.cpp b/strat.cpp
index 4655787..a4b5e5f 100644
--- a/strat.cpp
+++ b/strat.cpp
@@ -43,10 +43,12 @@
 void mainLoop()
 {
 	auto bs = protocol::recoverBook();
+    std::cout << "ready" << std::endl;
 	while (true) {
 		auto messages = protocol::catchUp(bs);
 		// bom::updateBom(bs);
 		printFeed(messages);
+		// dumbHit(messages);
 		freeMessages(messages);
 	}
 }
@@ -102,23 +104,30 @@
 
 void dumbHit(std::deque<json::Message*>& m)
 {
-    for (auto& i : m) {
-        if (i->type == json::ADDED) {
-            json::AddedMessage* j = (json::AddedMessage*) i;
-            if (j->owner == "jgrunbau") {
-                book::OrderSideEnum s = j->side == book::Buy ? book::Sell : book::Buy;
-                json::AddMessage a(json::ADD, j->product, j->price, s, j->resting);
-                auto b = protocol::addOrder(a);
-                if (b->type == json::ADDED && ((json::AddedMessage*) b)->resting > 0) {
-                    json::DeleteMessage d(json::DELETE, j->product, ((json::AddedMessage*) b)->id);
-                    delete protocol::deleteOrder(d);
-                }
-                if (b->type == json::ADDED) {
-                    std::cout << "Hit " << j->owner << " for " << ((json::AddedMessage*) b)->filled << ", resting " << ((json::AddedMessage*) b)->resting << std::endl;
-                }
-                delete b;
-            }
-        }
-    }
+	for (auto& i : m) {
+		if (i->type == json::ADDED) {
+			json::AddedMessage* j = (json::AddedMessage*)i;
+			if (j->owner == "nseow") {
+				book::OrderSideEnum s =
+					j->side == book::Buy ? book::Sell : book::Buy;
+				json::AddMessage a(json::ADD, j->product, j->price, s,
+				                   j->resting);
+				auto b = protocol::addOrder(a);
+				if (b->type == json::ADDED &&
+				    ((json::AddedMessage*)b)->resting > 0) {
+					json::DeleteMessage d(json::DELETE, j->product,
+					                      ((json::AddedMessage*)b)->id);
+					delete protocol::deleteOrder(d);
+				}
+				if (b->type == json::ADDED) {
+					std::cout << "Hit " << j->owner << " for "
+							  << ((json::AddedMessage*)b)->filled
+							  << ", resting "
+							  << ((json::AddedMessage*)b)->resting << std::endl;
+				}
+				delete b;
+			}
+		}
+	}
 }
 } // namespace strat

--
Gitblit v1.9.3