Skip to content

Conversation

@JonathanAmenechi
Copy link
Contributor

@JonathanAmenechi JonathanAmenechi commented Dec 12, 2025

Overview

Description

Testing instructions

Types of changes

  • Refactor/enhancement
  • Bug fix/behavior correction
  • New feature
  • Breaking change
  • Other, additional

Notes

Status

  • Prefix PR title with [WIP] if necessary (changes not yet made).
  • Add tests to cover changes as needed.
  • Update documentation/changelog as needed.
  • Verify all tests run correctly in CI and pass.
  • Ready for review/merge.

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.

  • RFQ Client:
    • Update accept_rfq_quote to fetch the quote and build the order from it via _get_request_order_creation_payload.
    • Add _get_request_order_creation_payload to compute token, side, and size based on matchType (COMPLEMENTARY, MINT, MERGE) and quote fields.
  • Types:
    • Introduce MatchType enum in py_clob_client/rfq/rfq_types.py.
  • Packaging:
    • Bump package version in setup.py to 0.32.0.

Written by Cursor Bugbot for commit f9e5ac3. This will update automatically on new commits. Configure here.

@JonathanAmenechi JonathanAmenechi marked this pull request as ready for review December 12, 2025 04:20
@JonathanAmenechi JonathanAmenechi requested a review from a team as a code owner December 12, 2025 04:20
Copilot AI review requested due to automatic review settings December 12, 2025 04:20
Copy link
Contributor

Copilot AI left a 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_quote to fetch quote data instead of request data
  • Added MatchType enum and _get_request_order_creation_payload helper 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):
Copy link

Copilot AI Dec 12, 2025

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.

Copilot uses AI. Check for mistakes.
"""
Build the order creation payload for an RFQ request based on quote details.
"""
match_type = quote.get("matchType", MatchType.COMPLEMENTARY)
Copy link

Copilot AI Dec 12, 2025

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.

Suggested change
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]

Copilot uses AI. Check for mistakes.
class MatchType(enumerate):
COMPLEMENTARY = "COMPLEMENTARY"
MINT = "MINT"
MERGE = "MERGE"
Copy link

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.

Fix in Cursor Fix in Web

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.

2 participants