diff --git a/fix_simulation_server/application.cpp b/fix_simulation_server/application.cpp index 1618694..f0d15a1 100644 --- a/fix_simulation_server/application.cpp +++ b/fix_simulation_server/application.cpp @@ -102,11 +102,14 @@ void Application::onLogout(const FIX::SessionID& sessionID) "====> removing market data subscriptions for senderCompID = {} targetCompID = {}", senderCompID, targetCompID ); - for (; it != market_data_subscriptions.end(); ++it) { + while(it != market_data_subscriptions.end()) { if (senderCompID == it->second.first && targetCompID == it->second.second) { spdlog::info("removing subscription for symbol={}", it->first); it = market_data_subscriptions.erase(it); } + else { + ++it; + } } } diff --git a/zorro_fix_plugin/zorro_fix_plugin.cpp b/zorro_fix_plugin/zorro_fix_plugin.cpp index 4347e94..70f108c 100644 --- a/zorro_fix_plugin/zorro_fix_plugin.cpp +++ b/zorro_fix_plugin/zorro_fix_plugin.cpp @@ -569,12 +569,12 @@ namespace zfix { if (it != order_id_by_internal_order_id.end()) { auto [oit, success] = order_tracker.get_open_order(it->second); - spdlog::debug("BrokerSell2: found open order={}", oit->second.to_string()); - show(std::format("BrokerSell2: found open order={}", oit->second.to_string())); - if (success) { auto& order = oit->second; + spdlog::debug("BrokerSell2: found open order={}", order.to_string()); + show(std::format("BrokerSell2: found open order={}", order.to_string())); + if (order.ord_status == FIX::OrdStatus_FILLED) { double close_price; int close_fill;