kraken: engine: fix comparisons

This commit is contained in:
Bruno BELANYI 2022-03-12 10:45:51 +01:00
parent 5f1fbac76c
commit 37b04a678a
2 changed files with 4 additions and 4 deletions

View file

@ -112,7 +112,7 @@ void Engine::operator()(TradeOrder const& trade_order) {
bid_map_it != bids_.end()) { bid_map_it != bids_.end()) {
auto& [_, bid_map] = *bid_map_it; auto& [_, bid_map] = *bid_map_it;
if (bid_map.size() > 0 if (bid_map.size() > 0
&& bid_map.begin()->first <= trade_order.price) { && bid_map.begin()->first >= trade_order.price) {
// FIXME: handle matching if enabled // FIXME: handle matching if enabled
listener_->on_rejection(trade_order.user, trade_order.id); listener_->on_rejection(trade_order.user, trade_order.id);
return; return;
@ -127,7 +127,7 @@ void Engine::operator()(TradeOrder const& trade_order) {
ask_map_it != asks_.end()) { ask_map_it != asks_.end()) {
auto& [_, ask_map] = *ask_map_it; auto& [_, ask_map] = *ask_map_it;
if (ask_map.size() > 0 if (ask_map.size() > 0
&& ask_map.begin()->first >= trade_order.price) { && ask_map.begin()->first <= trade_order.price) {
// FIXME: handle matching if enabled // FIXME: handle matching if enabled
listener_->on_rejection(trade_order.user, trade_order.id); listener_->on_rejection(trade_order.user, trade_order.id);
return; return;

View file

@ -39,8 +39,8 @@ private:
template <typename Order> template <typename Order>
using instrument_side_data = std::multimap<Price, OrderMetaData, Order>; using instrument_side_data = std::multimap<Price, OrderMetaData, Order>;
std::map<Symbol, instrument_side_data<std::less<void>>> bids_; std::map<Symbol, instrument_side_data<std::greater<void>>> bids_;
std::map<Symbol, instrument_side_data<std::greater<void>>> asks_; std::map<Symbol, instrument_side_data<std::less<void>>> asks_;
}; };
} // namespace kraken::engine } // namespace kraken::engine