SP-214 simplify trading status for synthetic logic

This commit is contained in:
Eric Harding authored and Pedro Pinto committed 2019-09-12 14:26:32 -04:00
1 parent 9e2f72b26e
commit eea3bc1d8b
1 file changed
+6 -11
+6 -11
View File
@@ -218,20 +218,15 @@ public:
case HANDLETYPE_DEPTH: return book.cdata->exchange_status;
case HANDLETYPE_BBO: return bbo.cdata->exchange_status;
case HANDLETYPE_SYNTHETIC: {
co2::TradingStatus status = co2::TradingStatus::TRADINGSTATUS_UNKNOWN;;
// Return the status if all legs match otherwise return TRADINGSTATUS_UNKNOWN
for (auto iter = synthetic.def->legs.begin(); iter != synthetic.def->legs.end(); ++iter) {
if (iter == synthetic.def->legs.begin()) {
status = iter->trading_status();
}
else {
auto temp = iter->trading_status();
if (temp != status) {
return co2::TradingStatus::TRADINGSTATUS_UNKNOWN;
}
if (synthetic.def->legs.size() > 0) {
auto status = synthetic.def->legs.front().trading_status();
for (const auto& leg : synthetic.def->legs) {
if (leg.trading_status() != status) break;
}
return status;
}
return status;
return co2::TRADINGSTATUS_UNKNOWN;
}
default:
case HANDLETYPE_VOID: