Skip to content
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

fix: partial cancelation based on available liquidity #235

Conversation

pawel-betdex
Copy link
Contributor

Reported Issue:

In a matching approach introduced by v14 makers are at disadvantage when it comes to order cancelation. When the maker order gets created, its liquidity is added to MarketLiquidities account. If any portion of that liquidity gets matched maker order is impossible to cancel until the match gets processed. This is because unmatched_stake of the maker order does not get updated (reduced in that case) till match gets post-processed while it is being used to determine amount being canceled. Since that amount can be bigger than available liquidity it leads to an error until match is processed.

Expected behaviour:

A partial cancel based on available liquidity should happen, leaving enough unmatched_stake to be matched in post-processing.

Consequences:

One of the interesting consequences of this and asynchronicity of order creation operation is that cancel_order endpoint partial success does not necessarily mean that at later time rest of the order cannot be canceled. It should be possible if more liquidity is added to the given liquidity price point.

@pawel-betdex pawel-betdex merged commit 31e4209 into MonacoProtocol:develop Oct 3, 2024
@pawel-betdex pawel-betdex deleted the fix/cancel-should-work-before-match-processed branch October 3, 2024 15:14
@pawel-betdex pawel-betdex mentioned this pull request Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants