SP-115 Dorman: handle unexpected child cancel

This commit is contained in:
Eric Harding committed 2019-07-15 10:59:36 -04:00
1 parent 1d275b942d
commit ea39014307
1 file changed
+6 -3
@@ -196,8 +196,10 @@ void DormanAlgo::on_child_change(OrderKey key, const ChildState& state) {
algo().cancel("Unexpected fill decrease.");
return;
}
// todo: If child is canceled do we need to cancel? probably.
if (state.status == ChildStatus::CANCELED) {
algo().cancel("Unexpected child cancel");
return;
}
auto delta = state.total_fills.value() - me->child_state.total_fills.value();
if (delta != 0) {
@@ -212,9 +214,10 @@ void DormanAlgo::on_child_change(OrderKey key, const ChildState& state) {
do_scratch();
}
if (me->fills >= algo().quantity().value()) {
if (me->fills >= algo().quantity().value() || state.status == ChildStatus::COMPLETED) {
complete();
}
}
void DormanAlgo::on_book(SecurityKey key, const Book& book) {