From 90107c504e5b7d1bea2c93a43c7d07b640350355 Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Thu, 13 Jan 2022 06:57:09 +0000
Subject: [PATCH] Removed now unneeded date library

---
 json.hpp |  218 ++++++++++++++++++++++++++++--------------------------
 1 files changed, 114 insertions(+), 104 deletions(-)

diff --git a/json.hpp b/json.hpp
index 19a4b68..45bf855 100644
--- a/json.hpp
+++ b/json.hpp
@@ -11,157 +11,167 @@
 namespace json
 {
 enum MessageTypes {
-    FUTURE_TYPE,
-    SPREAD_TYPE,
-    CALL_TYPE,
-    PUT_TYPE,
-    SETTLEMENT,
-    ADD,
-    ADDED,
-    DELETE,
-    DELETED,
-    REJECT,
-    TRADE,
-    BROKER_REQUEST,
-    BROKER_ACK,
-    BROKER_CONFIRM,
-    NONE
+	FUTURE_TYPE,
+	SPREAD_TYPE,
+	CALL_TYPE,
+	PUT_TYPE,
+	SETTLEMENT,
+	ADD,
+	ADDED,
+	DELETE,
+	DELETED,
+	REJECT,
+	TRADE,
+	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;
-    std::string product;
-    Message(MessageTypes type, std::string product);
-    Message();
-    virtual ~Message() = default;
+	MessageTypes type;
+	std::string product;
+	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 {
-    uint64_t sequence;
-    double timestamp;
-    FromExchange(MessageTypes type, std::string product, uint64_t sequence,
-                 double timestamp);
-    virtual ~FromExchange() = default;
+	uint64_t sequence;
+	double timestamp;
+	FromExchange(MessageTypes type, std::string product, uint64_t sequence,
+	             double timestamp);
+	virtual ~FromExchange() = default;
 };
 
 struct ToExchange : public Message {
-    ToExchange(MessageTypes type, std::string product);
-    virtual ~ToExchange() = default;
+	ToExchange(MessageTypes type, std::string product);
+	virtual ~ToExchange() = default;
 };
 
 struct Broker : public Message {
-    double price;
-    book::OrderSideEnum side;
-    uint64_t volume;
-    std::string counterparty;
-    Broker(MessageTypes type, std::string product, double price,
-           book::OrderSideEnum side, uint64_t volume, std::string counterparty);
-    virtual ~Broker() = default;
+	double price;
+	book::OrderSideEnum side;
+	uint64_t volume;
+	std::string counterparty;
+	Broker(MessageTypes type, std::string product, double price,
+	       book::OrderSideEnum side, uint64_t volume, std::string counterparty);
+	virtual ~Broker() = default;
 };
 
 struct AnnounceMessage : public FromExchange {
-    int stationId;
-    std::string stationName;
-    std::string unit;
-    std::chrono::nanoseconds expiry;
-    double aggFee;
-    double pasFee;
-    double broFee;
+	int stationId;
+	std::string stationName;
+	std::string unit;
+	std::chrono::nanoseconds expiry;
+	double aggFee;
+	double pasFee;
+	double broFee;
 
-    AnnounceMessage(MessageTypes type, std::string product,
-                    int stationId, std::string stationName,
-                    std::string unit, std::chrono::nanoseconds expiry,
-                    double aggFee, double pasFee, double broFee,
-                    uint64_t sequence, double timestamp);
+	AnnounceMessage(MessageTypes type, std::string product, int stationId,
+	                std::string stationName, std::string unit,
+	                std::chrono::nanoseconds expiry, double aggFee,
+	                double pasFee, double broFee, uint64_t sequence,
+	                double timestamp);
 };
 
 struct SettleMessage : public FromExchange {
-    std::string stationName;
-    std::chrono::nanoseconds expiry;
-    double price;
-    SettleMessage(MessageTypes type, std::string product,
-                  std::string stationName, std::chrono::nanoseconds expiry,
-                  double price, uint64_t sequence, double timestamp);
+	std::string stationName;
+	std::chrono::nanoseconds expiry;
+	double price;
+	SettleMessage(MessageTypes type, std::string product,
+	              std::string stationName, std::chrono::nanoseconds expiry,
+	              double price, uint64_t sequence, double timestamp);
 };
 
 struct AddMessage : public ToExchange {
-    double price;
-    book::OrderSideEnum side;
-    uint64_t volume;
-    AddMessage(MessageTypes type, std::string product, double price,
-               book::OrderSideEnum side, uint64_t volume);
-    std::string as_string();
+	double price;
+	book::OrderSideEnum side;
+	uint64_t volume;
+	AddMessage(MessageTypes type, std::string product, double price,
+	           book::OrderSideEnum side, uint64_t volume);
+	std::string as_string();
 };
 
 struct AddedMessage : public FromExchange {
-    std::string id;
-    book::OrderSideEnum side;
-    double price;
-    uint64_t filled;
-    uint64_t resting;
-    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);
+	std::string id;
+	book::OrderSideEnum side;
+	double price;
+	uint64_t filled;
+	uint64_t resting;
+	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);
+	std::string as_string();
 };
 
 struct DeleteMessage : public ToExchange {
-    std::string id;
-    DeleteMessage(MessageTypes type, std::string product, std::string id);
-    std::string as_string();
+	std::string id;
+	DeleteMessage(MessageTypes type, std::string product, std::string id);
+	std::string as_string();
 };
 
 struct DeletedMessage : public FromExchange {
-    std::string id;
-    book::OrderSideEnum side;
-    DeletedMessage(MessageTypes type, std::string product, std::string id,
-                   book::OrderSideEnum side, uint64_t sequence,
-                   double timestamp);
+	std::string id;
+	book::OrderSideEnum side;
+	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 error;
+	RejectMessage(MessageTypes type, std::string product, std::string error,
+	              uint64_t sequence, double timestamp);
+	std::string as_string();
 };
 
 struct TradeMessage : public FromExchange {
-    double price;
-    uint64_t volume;
-    std::string buyer;
-    std::string seller;
-    TradeTypeEnum tradeType;
-    std::string passiveOrder;
-    uint64_t passiveOrderRemaining;
-    TradeMessage(MessageTypes type, std::string product, double price,
-                 uint64_t volume, std::string buyer, std::string seller,
-                 TradeTypeEnum tradeType, std::string passiveOrder,
-                 uint64_t passiveOrderRemaining, uint64_t sequence,
-                 double timestamp);
+	double price;
+	uint64_t volume;
+	std::string buyer;
+	std::string seller;
+	TradeTypeEnum tradeType;
+	std::string passiveOrder;
+	uint64_t passiveOrderRemaining;
+	TradeMessage(MessageTypes type, std::string product, double price,
+	             uint64_t volume, std::string buyer, std::string seller,
+	             TradeTypeEnum tradeType, std::string passiveOrder,
+	             uint64_t passiveOrderRemaining, uint64_t sequence,
+	             double timestamp);
 };
 
 struct BrokerRequest : public Broker {
-    BrokerRequest(MessageTypes type, std::string product, double price,
-                  book::OrderSideEnum side, uint64_t volume,
-                  std::string counterparty);
+	BrokerRequest(MessageTypes type, std::string product, double price,
+	              book::OrderSideEnum side, uint64_t volume,
+	              std::string counterparty);
 };
 
 struct BrokerAck : public Broker {
-    std::string id;
-    std::string brokerTradeStatus;
-    std::string owner;
-    BrokerAck(MessageTypes type, std::string product, double price,
-              book::OrderSideEnum side, uint64_t volume,
-              std::string counterparty, std::string id,
-              std::string brokerTradeStatus, std::string owner);
+	std::string id;
+	std::string brokerTradeStatus;
+	std::string owner;
+	BrokerAck(MessageTypes type, std::string product, double price,
+	          book::OrderSideEnum side, uint64_t volume,
+	          std::string counterparty, std::string id,
+	          std::string brokerTradeStatus, std::string owner);
 };
 
 struct BrokerConfirm : public Broker {
-    std::string id;
-    BrokerConfirm(MessageTypes type, std::string product, double price,
-                  book::OrderSideEnum side, uint64_t volume,
-                  std::string counterparty, std::string id);
+	std::string id;
+	BrokerConfirm(MessageTypes type, std::string product, double price,
+	              book::OrderSideEnum side, uint64_t volume,
+	              std::string counterparty, std::string id);
 };
 
 std::queue<Message*> parse(std::string& str);

--
Gitblit v1.9.3