SimExecutionGateway can now deal with books with 0 qty levels

This commit is contained in:
Taha Afzal committed 2023-02-23 15:51:36 -05:00
1 parent a7f24e84e4
commit fdb7bbdac2
1 file changed
+8 -2
@@ -68,8 +68,14 @@ void to_book(
auto copy_side =
[](const std::array<md::PriceSize, md::COCONUT_MAX_DEPTH> &from,
BookSide &bk_to) {
for (size_t i = 0; i < std::min(from.size(), bk_to.size()); i++) {
bk_to[i] = from[i];
size_t to_idx = 0;
for (const auto &l : from) {
if (Quantity::create_new(l.size()).is_zero()) {
continue;
}
bk_to[to_idx++] = l;
if (to_idx >= bk_to.size())
break;
}
};
copy_side(bids, book.bid());