feat: requester-side combo RFQ support (request quote, accept, wait for fill) - #216
Merged
kartojal merged 6 commits intoAug 13, 2026
Merged
Conversation
kartojal
marked this pull request as ready for review
August 10, 2026 15:26
naruto11eth
previously requested changes
Aug 13, 2026
naruto11eth
left a comment
Contributor
There was a problem hiding this comment.
Really solid port overall - ts-sdk is mirrored well. Two things I'd like fixed before merge though, both on the execution path:
- The quote isn't bound to the request that minted it. ts validates the echoed
direction/side/leg_position_ids/requested_sizebefore building the portable quote (rfq.ts:826-858) and derives the quote's direction from the validated echo; here_parse_combo_quote_resultchecks only the nestedrfq_idand stamps the caller's direction onto whatever came back. Note when porting the fix: ts compares legs index-by-index against the canonically sorted request, so_validate_legsneeds the same BigInt-ascending sort or the binding will false-positive. - SELL quotes drop
net_receive_e6. The ts bindings model it, the client requires it for SELL (rfq.ts:797-802throws when absent), and it's what tells a seller their exact post-fee proceeds before accepting -taker_amount_e6is gross.ComboQuoteneeds the field, required for SELL, with a real SELL fixture.
Two smaller ones:
- The accept retry covers
TransportErroronly; ts broadened it to also retryUnexpectedResponseError(288f72b, landed after your head, so this is twin catch-up not a miss) - without it a garbled 200 after server-side acceptance raises while a live-funds order is already executing, instead of re-posting and reading the persisted status. test_combo_rfq_live.py:44parsesPOLYMARKET_COMBO_LEG_POSITION_IDSwith a file-local helper; AGENTS.md wants that intests/integration/conftest.py.
mcamara
approved these changes
Aug 13, 2026
mcamara
left a comment
There was a problem hiding this comment.
All @naruto11eth 's checks have been solved
kartojal
deleted the
feature/dev-425-python-sdk-port-combos-requester-support
branch
August 13, 2026 14:30
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.
Implements DEV-425, porting the requester-side combo RFQ surface from the TypeScript SDK (Polymarket/ts-sdk#251). Adds
request_combo_quote,accept_combo_quote,wait_for_combo_fill, andfetch_rfq_statustoSecureClientandAsyncSecureClient, backed by a new builder-gateway transport that attachesPOLY_*L2 headers plusPOLY_BUILDER_*headers on mutating requests (status reads are account-auth only).Adaptations per the ticket: the BUY/SELL direction-sizing coupling is enforced at runtime via keyword arguments (
amount=for BUY collateral,size=for SELL shares);RfqRejectionCodeis aStrEnumwith unknown-code passthrough;accept_combo_quotetakes theComboQuoteResultfrom the quote request since the status endpoint never returns the bundle. Business outcomes (no quotes, maker declined, expired acceptance window) are returned as result values, not raised.Linear: DEV-425
Note
High Risk
New trading path signs orders and moves real funds on accept/fill; auth and idempotent accept retry behavior are security- and correctness-sensitive despite strong validation.
Overview
Adds requester-side combo RFQ to
SecureClient/AsyncSecureClient:request_combo_quote,accept_combo_quote,wait_for_combo_fill, andfetch_rfq_status, implemented in newcombo_rfqactions against/v1/builder/rfq/requests. Secure clients gain abuilder_gatewaytransport (builder_gateway_urlin env config) with L2 account headers plus Builder API key headers on non-GET calls; a Builder API key is required for quote/accept.accept_combo_quotesigns a v3 GTC order from a self-containedComboQuote, retries once on ambiguous transport/parse failures, polls through maker last-look, and maps declines/expiry to returnedfailedoutcomes (not exceptions).RequestRejectedErrornow surfaces JSONcode; RFQ flows raiseRfqRequestRejectedErrorwithRfqRejectionCodewhere known.Public
polymarket.rfqgrows models/enums (ComboQuote, status/fill/accept results,RfqStatus, etc.) and re-exports. Unit and metered integration tests cover parsing, echo validation, retries, and optional live quote/fill paths viaPOLYMARKET_COMBO_LEG_POSITION_IDS.Reviewed by Cursor Bugbot for commit 168f1a9. Bugbot is set up for automated code reviews on this repo. Configure here.