| | |
| | | mapOrder = {{"BUY", book::Buy}, {"SELL", book::Sell}}; |
| | | |
| | | mapTrade = {{"BUY_AGGRESSOR", BUY_AGGRESSOR}, |
| | | {"SELL_AGGRESSOR", SELL_AGGRESSOR}}; |
| | | {"SELL_AGGRESSOR", SELL_AGGRESSOR}, |
| | | {"BROKER_TRADE", BROKER_TRADE}}; |
| | | |
| | | mapOrderSide = {{book::Buy, "BUY"}, {book::Sell, "SELL"}}; |
| | | } |
| | |
| | | { |
| | | 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, |
| | |
| | | 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, |
| | |
| | | { |
| | | if (mapOrderSide.empty()) initialise(); |
| | | return "{\"type\": \"DELETE\", \"product\": \"" + this->product + |
| | | "\", \"id\": \"" + this->id + "\"}"; |
| | | "\", \"id\": \"" + this->id + "\"}"; |
| | | } |
| | | |
| | | DeletedMessage::DeletedMessage(MessageTypes type, std::string product, |
| | |
| | | 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, |
| | |
| | | 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, |