Skip to content

Conversation

@danielgnh
Copy link
Member

This pull request adds full support for the RFQ (Request for Quote) workflow to the codebase, enabling institutional trading features such as negotiated pricing and large order handling. The changes introduce a new Rfq resource with methods for creating, listing, quoting, accepting, approving, and canceling RFQ requests and quotes. Additionally, relevant enums are added to facilitate sorting and filtering, and an example script demonstrates the complete RFQ workflow.

RFQ Workflow Support

  • Added the new Rfq resource class with methods for creating, listing, quoting, accepting, approving, and canceling RFQ requests and quotes (src/Resources/Clob/Rfq.php).
  • Integrated the rfq() accessor into the Clob class, allowing users to interact with the RFQ resource (src/Clob.php). [1] [2] [3]

Enums for RFQ Operations

  • Introduced RfqSortBy, RfqSortDir, and RfqState enums to support sorting, filtering, and state management in RFQ operations (src/Enums/RfqSortBy.php, src/Enums/RfqSortDir.php, src/Enums/RfqState.php). [1] [2] [3]

Documentation and Examples

  • Added a comprehensive example script demonstrating the full RFQ workflow, including request creation, quoting, acceptance, approval, and cancellation (examples/rfq-workflow.php).

@danielgnh danielgnh self-assigned this Jan 8, 2026
@danielgnh danielgnh added the enhancement New feature or request label Jan 12, 2026
@danielgnh danielgnh requested a review from Copilot January 24, 2026 21:22
Copy link

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

Adds RFQ (Request for Quote) support to the PHP client to enable institutional trading workflows (request/quote, accept, approve, cancel), along with supporting enums and an end-to-end example script.

Changes:

  • Introduced a new Rfq CLOB resource with request/quote lifecycle methods.
  • Added RFQ-related enums for state and sorting (RfqState, RfqSortBy, RfqSortDir).
  • Exposed the RFQ resource via Clob::rfq() and added an RFQ workflow example script.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/Resources/Clob/Rfq.php New RFQ resource implementing request/quote operations via HTTP client.
src/Clob.php Adds rfq() accessor to surface the new RFQ resource from the CLOB client.
src/Enums/RfqState.php Adds RFQ state enum for filtering/state handling.
src/Enums/RfqSortBy.php Adds RFQ sort-by enum for list endpoints.
src/Enums/RfqSortDir.php Adds RFQ sort direction enum for list endpoints.
examples/rfq-workflow.php Demonstrates a full RFQ flow (create, list, quote, accept, approve, cancel).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +19 to +22
* Create an RFQ request for buying/selling outcome tokens.
*
* @param array<string, mixed> $requestData RFQ request data (tokenId, side, size, price, etc.)
*
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docblocks describe request payload keys using camelCase (e.g., tokenId, requestId), but existing CLOB resources and the README use snake_case keys (e.g., token_id in src/Resources/Clob/Book.php:19). Please update these docblocks to reflect the actual expected parameter names so IDE hints don’t mislead users.

Copilot uses AI. Check for mistakes.
Comment on lines +94 to +95
$response = $this->httpClient->delete("/rfq/quotes/$quoteId");

Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The quote cancellation endpoint uses string interpolation without braces, which is inconsistent with the rest of the codebase’s path construction (e.g., src/Resources/Clob/Orders.php:97). Use "/rfq/quotes/{$quoteId}" for consistency/readability.

Copilot uses AI. Check for mistakes.
Comment on lines +135 to +130
public function rfq(): Rfq
{
return new Rfq($this->httpClient);
}
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new public CLOB resource (rfq()) is introduced, but there are no corresponding Feature tests (the repo has per-resource coverage under tests/Feature/Clob/*Test.php). Please add tests for the new RFQ methods/endpoints (at least happy paths for create/list/cancel request/quote, accept, approve) similar to existing resources’ tests.

Copilot uses AI. Check for mistakes.
Comment on lines +133 to +143
// 6. Approve Order (Market Maker's last look)
echo "6. Approving Order (Last Look)...\n";
try {
$approval = $client->clob()->rfq()->approveOrder([
'order_id' => 'example-order-id',
]);

echo "Order approved\n";
echo "Trade will execute\n\n";
} catch (Exception $e) {
echo "Error approving order: {$e->getMessage()}\n\n";
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example claims to demonstrate the complete workflow, but the approval step uses a hard-coded order_id (example-order-id), so it will always error in real runs. Consider extracting the created order ID(s) from the acceptQuote() response (if present) and only calling approveOrder() when you have a real order_id, otherwise skip the step with a clear message.

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +6
require_once __DIR__.'/../vendor/autoload.php';

Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor consistency: other example scripts use spaced concatenation for __DIR__ (e.g., examples/bridge-deposit.php:5 uses __DIR__ . '/../vendor/autoload.php'). Consider matching that formatting here for consistency.

Copilot uses AI. Check for mistakes.
Comment on lines +45 to +46
$response = $this->httpClient->delete("/rfq/requests/$requestId");

Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String interpolation for the request/quote IDs deviates from the convention used elsewhere in CLOB resources (e.g., src/Resources/Clob/Orders.php:36 uses "/orders/{$orderId}"). Prefer "/rfq/requests/{$requestId}" (and similarly for quotes) to avoid ambiguity and keep style consistent.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants