| | |
| | | case json::SPREAD_TYPE: |
| | | case json::CALL_TYPE: |
| | | case json::PUT_TYPE: |
| | | announce(bs, dynamic_cast<json::AnnounceMessage*>(message)); |
| | | announce(bs, static_cast<json::AnnounceMessage*>(message)); |
| | | break; |
| | | case json::SETTLEMENT: |
| | | settle(bs, dynamic_cast<json::SettleMessage*>(message)); |
| | | settle(bs, static_cast<json::SettleMessage*>(message)); |
| | | break; |
| | | case json::ADDED: |
| | | addedOrder(bs, dynamic_cast<json::AddedMessage*>(message)); |
| | | addedOrder(bs, static_cast<json::AddedMessage*>(message)); |
| | | break; |
| | | case json::DELETED: |
| | | deletedOrder(bs, dynamic_cast<json::DeletedMessage*>(message)); |
| | | deletedOrder(bs, static_cast<json::DeletedMessage*>(message)); |
| | | break; |
| | | case json::TRADE: |
| | | tradeOrder(bs, dynamic_cast<json::TradeMessage*>(message)); |
| | | tradeOrder(bs, static_cast<json::TradeMessage*>(message)); |
| | | break; |
| | | case json::BROKER_REQUEST: |
| | | case json::BROKER_ACK: |
| | | case json::BROKER_CONFIRM: |
| | | broker(bs, dynamic_cast<json::Broker*>(message)); |
| | | broker(bs, static_cast<json::Broker*>(message)); |
| | | break; |
| | | default:; |
| | | } |
| | |
| | | void tradeOrder(std::unordered_map<std::string, book::Book>& bs, |
| | | json::TradeMessage* message) |
| | | { |
| | | if (bs.contains(message->passiveOrder)) { |
| | | if (bs.find(message->passiveOrder) != bs.end()) { |
| | | if (message->tradeType == json::BUY_AGGRESSOR) { |
| | | if (message->passiveOrderRemaining > 0) { |
| | | bs[message->product].askSide.at(message->passiveOrder).volume = |