-
Notifications
You must be signed in to change notification settings - Fork 648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent sorting of call orders between matching against a limit order and a force settle order #343
Comments
I agree that by_collateral is the better choice in both cases. I was actually surprised to find that the margin call code didn't update the call price after a partial fill when I wrote my recent explanation of margin calls. OTOH I think this is a relatively minor issue. I'm therefore unsure whether this should be changed. In any case it's not a bugfix but a change of behaviour. IMO this means that the change requires shareholder approval. |
For: * #338 Margin call order fills at price of matching limit_order * #343 Inconsistent sorting of call orders between matching against a limit order and a force settle order * #453 Multiple limit order and call order matching issue * #606 Undercollateralized short positions should be called regardless of asks
For: * #338 Margin call order fills at price of matching limit_order * #343 Inconsistent sorting of call orders between matching against a limit order and a force settle order * #453 Multiple limit order and call order matching issue * #606 Undercollateralized short positions should be called regardless of asks
Done with #829. |
Note: this should not break compatibility in production because the result should be the same after hard fork #343.
Call orders will be sorted then matched against other orders in two scenarios:
However, the sorting methods used in these two scenarios are different.
For margin calls, it's
by_price
(code):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):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.The text was updated successfully, but these errors were encountered: