-
Notifications
You must be signed in to change notification settings - Fork 162
Fix: RFQ accept quote #205
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes the RFQ (Request for Quote) accept quote functionality by correcting how order creation payloads are determined when accepting quotes. The key changes involve switching from fetching RFQ requests to fetching RFQ quotes and introducing logic to handle different match types (COMPLEMENTARY, MINT, MERGE).
- Refactored
accept_rfq_quoteto fetch quote data instead of request data - Added
MatchTypeenum and_get_request_order_creation_payloadhelper method to determine correct order parameters based on match type - Updated version from 0.31.0 to 0.32.0
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| setup.py | Bumped version to 0.32.0 |
| py_clob_client/rfq/rfq_types.py | Added MatchType enum for quote matching types |
| py_clob_client/rfq/rfq_client.py | Refactored accept_rfq_quote to use quotes instead of requests and added match type logic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| total_count: Optional[int] = None | ||
| """Total count (optional).""" | ||
|
|
||
| class MatchType(enumerate): |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MatchType should inherit from Enum (from Python's enum module), not enumerate which is a built-in function. This will cause a runtime error.
| """ | ||
| Build the order creation payload for an RFQ request based on quote details. | ||
| """ | ||
| match_type = quote.get("matchType", MatchType.COMPLEMENTARY) |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value MatchType.COMPLEMENTARY is compared against string values later (lines 623, 634). Since the quote data likely returns a string, the comparisons will fail. Either the default should be the string \"COMPLEMENTARY\" or the comparisons should use the enum values consistently.
| match_type = quote.get("matchType", MatchType.COMPLEMENTARY) | |
| match_type = quote.get("matchType", MatchType.COMPLEMENTARY) | |
| # Ensure match_type is always a MatchType enum value | |
| if isinstance(match_type, str): | |
| match_type = MatchType[match_type] |
| class MatchType(enumerate): | ||
| COMPLEMENTARY = "COMPLEMENTARY" | ||
| MINT = "MINT" | ||
| MERGE = "MERGE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: MatchType inherits from enumerate instead of Enum
The MatchType class inherits from enumerate (a built-in function for indexed iteration) instead of Enum from Python's enum module. This means MatchType.COMPLEMENTARY, MatchType.MINT, and MatchType.MERGE will be plain class attributes (strings), not proper enum members. Comparisons like match_type == MatchType.COMPLEMENTARY will fail when match_type is the string "COMPLEMENTARY" from the API response, since the comparison would be between a string and the class attribute.
Overview
Description
Testing instructions
Types of changes
Notes
Status
[WIP]if necessary (changes not yet made).Note
Accepting an RFQ quote now derives order side/size/token from the quote via match-type handling and introduces a MatchType enum; version bumped to 0.32.0.
accept_rfq_quoteto fetch the quote and build the order from it via_get_request_order_creation_payload._get_request_order_creation_payloadto computetoken,side, andsizebased onmatchType(COMPLEMENTARY,MINT,MERGE) and quote fields.MatchTypeenum inpy_clob_client/rfq/rfq_types.py.setup.pyto0.32.0.Written by Cursor Bugbot for commit f9e5ac3. This will update automatically on new commits. Configure here.