Call orders will be sorted then matched against other orders in two scenarios:
- when being margin called
- when being force settled
However, the sorting methods used in these two scenarios are different.
For margin calls, it's by_price (code):
const auto& call_price_index = call_index.indices().get<by_price>();
It's the call price when the short position was updated last time. It won't change.
For force settlements, it's by_collateral (code):
auto& call_index = get_index_type<call_order_index>().indices().get<by_collateral>();
It's the real-time collateral ratio of the call order. It changes every time when the order is partially filled.
The consequence: when a call order is partially filled, no matter if it's margin called or force settled, its real collateral ratio is increased, so it will have less chance to be matched against a force settlement order again; however, it will still be margin called at the initial call price.
Personally I think the by_collateral sorting is fairer and we should use it in both scenarios.