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

[Orderbook]: Implement Fill Limit Order #47

Merged
merged 4 commits into from
Feb 29, 2024
Merged

Conversation

crnbarr93
Copy link
Collaborator

@crnbarr93 crnbarr93 commented Feb 27, 2024

Closes: #42

What is the purpose of the change

When a limit order is placed that passes the next tick of the oppossing order direction we can fill that order with any previously placed limit orders for every tick leading up to the placed order's tick. Once an order has been filled as much as possible, if there is a remainder we can store the order with the remainder on the given tick.

This process makes use of the previously created market order filling logic by converting the limit order to a market order when conditions are met. The generated fulfillments from this logic are resolved to bank messages and sent accordingly.

Testing and Verifying

This change added tests and can be verified as follows:

cargo unit-test test_place_limit_fill

These tests are a replication of various tests from #40 that have been adapted for the order placement logic. These are contained in contracts/orderbook/src/tests/test_order.rs.

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!

contracts/orderbook/src/order.rs Outdated Show resolved Hide resolved
Co-authored-by: Alpo <[email protected]>
@crnbarr93 crnbarr93 merged commit 634b233 into main Feb 29, 2024
2 checks passed
@crnbarr93 crnbarr93 deleted the connor/place-limit-fill branch February 29, 2024 16:15
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]: Add market filling logic to place_limit
2 participants