Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the orderbook implementation with Time in Force (TIF) support and Self-Trade Prevention (STP), improving the matching engine's functionality and control.
- Adds support for TIF types (GTC, IOC, FOK) to control order lifetime and execution behavior
- Implements STP functionality to prevent self-trading by the same owner
- Refactors matching algorithms to handle owner-based order filtering and improved price-time priority
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/models/mod.rs | Extends Order struct with owner_id, tif, post_only, and max_slippage_bps fields; adds Tif enum |
| src/order_book/mod.rs | Implements TIF logic, STP prevention, refactors matching algorithms, and adds comprehensive test coverage |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- Added Ord, PartialOrd, PartialEq, and Eq implementations for the Price struct to enable proper comparison based on integral and fractional values. - Created a new test suite for the OrderBook, covering various scenarios including adding limit orders, matching orders, handling market orders, and ensuring proper order cancellation. - Included tests for edge cases such as partial fills, FIFO behavior within price levels, and the behavior of different order types (GTC, IOC, FOK). - Verified that the notifier broadcasts matches correctly and that the order book maintains expected states after operations.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.