Skip to content

Return all successful quotes from CompetitionPriceEstimator - #4664

Merged
MartinquaXD merged 5 commits into
mainfrom
return-multiple-quotes
Jul 28, 2026
Merged

Return all successful quotes from CompetitionPriceEstimator#4664
MartinquaXD merged 5 commits into
mainfrom
return-multiple-quotes

Conversation

@MartinquaXD

Copy link
Copy Markdown
Contributor

Description

The upcoming fastPath feature will allow the best quoter to win a short exclusivity period where it's allowed to settle an order immediately instead of waiting for it to be put into an auction.
The solvers is supposed to be rewarded as if it won a regular auction which means we need to know it's reference score (score compared to the second best quote).
To do that we now need to get multiple quotes from the CompetitionPriceEstimator.

Changes

Introduce CompetitionPriceEstimating which returns either an error or all quotes sorted from best to worst.

How to test

This PR does not introduce any wider logic changes since the quoter still just picks the best quote.
However, the unit tests got updated to show that all quotes now get returned in the expected order - instead of just asserting that the winning quote is correct.

@MartinquaXD
MartinquaXD requested a review from a team as a code owner July 23, 2026 14:33
@claude

claude Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Claude finished @MartinquaXD's task in 3m 38s —— View job


PR Review: Return all successful quotes from CompetitionPriceEstimator

  • Read the PR diff and changed files
  • Analyze competition/mod.rs, quote.rs, order_quoting.rs changes
  • Post inline comments for issues found
  • Post review summary

The refactor is clean and self-consistent. The new CompetitionPriceEstimating trait / RankedEstimates type cleanly replaces the single-best-quote path, and the sort-then-take-first logic preserves the previous winner/error selection in the common case (best Ok wins; else highest-priority error; unreasonable Oks dropped; rest correctly contains only reasonable Oks in descending order). The de-duplication of the old repeated report_winner/is-ok check is a nice cleanup. Test updates correctly assert the full ranked ordering.

One thing worth confirming (inline): the switch from max_by to stable sort_by + take-first flips tie-break behavior — on equally-ranked results the winner is now the first candidate rather than the last. Harmless for "pick best quote", but since fastPath rewards the winning quoter, tie attribution may matter.

Nothing blocking from my side.

Note

I could not run cargo check/nextest in this environment (commands require approval), so compilation and test correctness were verified by static analysis only.
· return-multiple-quotes

Comment thread crates/price-estimation/src/competition/quote.rs

@squadgazzz squadgazzz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@MartinquaXD
MartinquaXD enabled auto-merge July 28, 2026 11:29
@MartinquaXD
MartinquaXD added this pull request to the merge queue Jul 28, 2026
Merged via the queue into main with commit 2c7256d Jul 28, 2026
22 checks passed
@MartinquaXD
MartinquaXD deleted the return-multiple-quotes branch July 28, 2026 11:49
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants