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

---
 json.hpp |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/json.hpp b/json.hpp
index adcb147..bfe2c50 100644
--- a/json.hpp
+++ b/json.hpp
@@ -25,10 +25,11 @@
 	BROKER_REQUEST,
 	BROKER_ACK,
 	BROKER_CONFIRM,
+	ERROR,
 	NONE
 };
 
-enum TradeTypeEnum { BUY_AGGRESSOR, SELL_AGGRESSOR };
+enum TradeTypeEnum { BUY_AGGRESSOR, SELL_AGGRESSOR, BROKER_TRADE };
 
 struct Message {
 	MessageTypes type;
@@ -36,6 +37,12 @@
 	Message(MessageTypes type, std::string product);
 	Message();
 	virtual ~Message() = default;
+};
+
+struct ErrorMessage : public Message {
+	std::string message;
+	ErrorMessage(std::string message);
+	std::string as_string();
 };
 
 struct FromExchange : public Message {
@@ -75,6 +82,7 @@
 	                std::chrono::nanoseconds expiry, double aggFee,
 	                double pasFee, double broFee, uint64_t sequence,
 	                double timestamp);
+    std::string as_string();
 };
 
 struct SettleMessage : public FromExchange {
@@ -84,6 +92,7 @@
 	SettleMessage(MessageTypes type, std::string product,
 	              std::string stationName, std::chrono::nanoseconds expiry,
 	              double price, uint64_t sequence, double timestamp);
+    std::string as_string();
 };
 
 struct AddMessage : public ToExchange {
@@ -101,9 +110,11 @@
 	double price;
 	uint64_t filled;
 	uint64_t resting;
+    std::string owner;
 	AddedMessage(MessageTypes type, std::string product, std::string id,
 	             book::OrderSideEnum side, double price, uint64_t filled,
-	             uint64_t resting, uint64_t sequence, double timestamp);
+	             uint64_t resting, std::string owner, uint64_t sequence, double timestamp);
+	std::string as_string();
 };
 
 struct DeleteMessage : public ToExchange {
@@ -118,12 +129,14 @@
 	DeletedMessage(MessageTypes type, std::string product, std::string id,
 	               book::OrderSideEnum side, uint64_t sequence,
 	               double timestamp);
+	std::string as_string();
 };
 
 struct RejectMessage : public FromExchange {
 	std::string error;
 	RejectMessage(MessageTypes type, std::string product, std::string error,
 	              uint64_t sequence, double timestamp);
+	std::string as_string();
 };
 
 struct TradeMessage : public FromExchange {
@@ -139,12 +152,14 @@
 	             TradeTypeEnum tradeType, std::string passiveOrder,
 	             uint64_t passiveOrderRemaining, uint64_t sequence,
 	             double timestamp);
+	std::string as_string();
 };
 
 struct BrokerRequest : public Broker {
 	BrokerRequest(MessageTypes type, std::string product, double price,
 	              book::OrderSideEnum side, uint64_t volume,
 	              std::string counterparty);
+	std::string as_string();
 };
 
 struct BrokerAck : public Broker {
@@ -155,6 +170,7 @@
 	          book::OrderSideEnum side, uint64_t volume,
 	          std::string counterparty, std::string id,
 	          std::string brokerTradeStatus, std::string owner);
+	std::string as_string();
 };
 
 struct BrokerConfirm : public Broker {
@@ -162,6 +178,7 @@
 	BrokerConfirm(MessageTypes type, std::string product, double price,
 	              book::OrderSideEnum side, uint64_t volume,
 	              std::string counterparty, std::string id);
+	std::string as_string();
 };
 
 std::queue<Message*> parse(std::string& str);

--
Gitblit v1.9.3