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

Limit Cancel #37

Merged
merged 7 commits into from
Feb 18, 2024
Merged

Limit Cancel #37

merged 7 commits into from
Feb 18, 2024

Conversation

crnbarr93
Copy link
Collaborator

Closes: #10

What is the purpose of the change

This PR adds the ability for a user to cancel their limit order by providing the book ID, tick ID and order ID. The following process takes place. To cancel an order the following criteria must be met:

  • Order must exist
  • Sender must be order owner
  • No funds can be sent with the cancel order

An automatic refund is sent to the owner upon cancelling an order. Upon cancelling an order the liquidity for the given tick is also deducted by the amount in the order, if the tick's liquidity becomes 0 the tick is removed.

Testing and Verifying

This change added tests and can be verified as follows:

cargo unit-test test_cancel_limit
  • Tests can be found in tests/test_order.rs
  • Small adjustments were also made to test_place_limit to account for liquidity tracking

Copy link
Collaborator

@AlpinYukseloglu AlpinYukseloglu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice work! Made a couple light related driveby changes, lmk if you'd like to revert any of them.

@AlpinYukseloglu AlpinYukseloglu merged commit 140f5df into main Feb 18, 2024
2 checks passed
@AlpinYukseloglu AlpinYukseloglu deleted the connor/cancel-limit branch February 18, 2024 19:59
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.

[Orderbook]: Limit order cancellation logic
2 participants