Joel Grunbaum
2022-01-19 0bef191acd5a77544852e6a3daae2df05bd34a31
protocol.cpp
@@ -175,14 +175,16 @@
                  json::DeletedMessage* message)
{
   if (message->side == book::Buy) {
        for (auto i = bs[message->product].bidSide.begin(); i != bs[message->product].bidSide.end(); i++) {
      for (auto i = bs[message->product].bidSide.begin();
           i != bs[message->product].bidSide.end(); i++) {
                    if (i->id == message->id) {
                        bs[message->product].bidSide.erase(i);
                        break;
                    }
                }
   } else {
        for (auto i = bs[message->product].askSide.begin(); i != bs[message->product].askSide.end(); i++) {
      for (auto i = bs[message->product].askSide.begin();
           i != bs[message->product].askSide.end(); i++) {
                    if (i->id == message->id) {
                        bs[message->product].askSide.erase(i);
                        break;
@@ -202,7 +204,8 @@
                }
            }
        } else {
            for (auto i = bs[message->product].askSide.begin(); i != bs[message->product].askSide.end(); i++) {
         for (auto i = bs[message->product].askSide.begin();
              i != bs[message->product].askSide.end(); i++) {
                if (i->id == message->passiveOrder) {
                    bs[message->product].askSide.erase(i);
                    break;
@@ -218,7 +221,8 @@
                }
            }
        } else {
            for (auto i = bs[message->product].bidSide.begin(); i != bs[message->product].bidSide.end(); i++) {
         for (auto i = bs[message->product].bidSide.begin();
              i != bs[message->product].bidSide.end(); i++) {
                if (i->id == message->passiveOrder) {
                    bs[message->product].bidSide.erase(i);
                    break;
@@ -238,7 +242,10 @@
   httplib::MultipartFormDataItems a = {{"message", message, "", ""},
                                        {"username", USER, "", ""},
                                        {"password", PASS, "", ""}};
   auto res = cli.Post("/execution", a);
   auto res = cli.Post("/execution",
                       "message=" + message + "&username=" + USER +
                           "&password=" + PASS,
                       "application/x-www-form-urlencoded");
   std::string b = res->body;
   std::queue<json::Message*> c = json::parse(b);
   return c.front();