Joel Grunbaum
2022-01-12 e8c910e52d1807e2fcca3b43d80a9df6acac5387
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,