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 --- json.cpp | 38 +++++++++++++++++++------------------- 1 files changed, 19 insertions(+), 19 deletions(-) diff --git a/json.cpp b/json.cpp index f64f677..dfcbbf4 100644 --- a/json.cpp +++ b/json.cpp @@ -49,7 +49,7 @@ mapTrade = {{"BUY_AGGRESSOR", BUY_AGGRESSOR}, {"SELL_AGGRESSOR", SELL_AGGRESSOR}, - {"BROKER_TRADE", BROKER_TRADE}}; + {"BROKER_TRADE", BROKER_TRADE}}; mapOrderSide = {{book::Buy, "BUY"}, {book::Sell, "SELL"}}; } @@ -279,9 +279,9 @@ { if (mapOrderSide.empty()) initialise(); return "{\"type\": \"ADD\", \"product\": \"" + this->product + - "\", \"price\": " + std::to_string(this->price) + ", \"side\": \"" + - mapOrderSide[this->side] + - "\", \"volume\": " + std::to_string(this->volume) + "}"; + "\", \"price\": " + std::to_string(this->price) + ", \"side\": \"" + + mapOrderSide[this->side] + + "\", \"volume\": " + std::to_string(this->volume) + "}"; } AddedMessage::AddedMessage(MessageTypes type, std::string product, @@ -296,13 +296,13 @@ std::string AddedMessage::as_string() { return "{\"type\": \"ADDED\", \"product\": \"" + this->product + - "\", \"product\": \"" + this->id + "\" \"side\": \"" + - mapOrderSide[this->side] + - "\", \"price\": " + std::to_string(this->price) + - "\"filled\": " + std::to_string(this->filled) + - ", \"resting\": " + std::to_string(this->resting) + - ", \"sequence\": " + std::to_string(this->sequence) + - ", \"timestamp\":" + std::to_string(this->timestamp) + "}"; + "\", \"product\": \"" + this->id + "\" \"side\": \"" + + mapOrderSide[this->side] + + "\", \"price\": " + std::to_string(this->price) + + "\"filled\": " + std::to_string(this->filled) + + ", \"resting\": " + std::to_string(this->resting) + + ", \"sequence\": " + std::to_string(this->sequence) + + ", \"timestamp\":" + std::to_string(this->timestamp) + "}"; } DeleteMessage::DeleteMessage(MessageTypes type, std::string product, @@ -315,7 +315,7 @@ { if (mapOrderSide.empty()) initialise(); return "{\"type\": \"DELETE\", \"product\": \"" + this->product + - "\", \"id\": \"" + this->id + "\"}"; + "\", \"id\": \"" + this->id + "\"}"; } DeletedMessage::DeletedMessage(MessageTypes type, std::string product, @@ -328,10 +328,10 @@ std::string DeletedMessage::as_string() { return "{\"type\": \"DELETED\", \"product\": \"" + this->product + - "\", \"product\": \"" + this->id + "\" \"side\": \"" + - mapOrderSide[this->side] + - ", \"sequence\": " + std::to_string(this->sequence) + - ", \"timestamp\":" + std::to_string(this->timestamp) + "}"; + "\", \"product\": \"" + this->id + "\" \"side\": \"" + + mapOrderSide[this->side] + + ", \"sequence\": " + std::to_string(this->sequence) + + ", \"timestamp\":" + std::to_string(this->timestamp) + "}"; } RejectMessage::RejectMessage(MessageTypes type, std::string product, @@ -344,9 +344,9 @@ std::string RejectMessage::as_string() { return "{\"type\": \"REJECT\", \"product\": \"" + this->product = - "\", \"error\": \"" + this->error + - "\", \"sequence\": " + std::to_string(this->sequence) + - ", \"timestamp\": " + std::to_string(this->timestamp) + "}"; + "\", \"error\": \"" + this->error + + "\", \"sequence\": " + std::to_string(this->sequence) + + ", \"timestamp\": " + std::to_string(this->timestamp) + "}"; } TradeMessage::TradeMessage(MessageTypes type, std::string product, double price, -- Gitblit v1.9.3