From 9ae8b92ba549ab916c88e9004a95c1ed0cd16059 Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Wed, 19 Jan 2022 10:48:57 +0000
Subject: [PATCH] Added loop to click trader and hit self for perf testing

---
 strat.cpp |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/strat.cpp b/strat.cpp
index 2856c1a..4655787 100644
--- a/strat.cpp
+++ b/strat.cpp
@@ -105,14 +105,17 @@
     for (auto& i : m) {
         if (i->type == json::ADDED) {
             json::AddedMessage* j = (json::AddedMessage*) i;
-            if (j->owner == "nseow") {
+            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) {
+                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;
             }
         }

--
Gitblit v1.9.3