Repository navigation
Warm combo boards in serve and name the legs a venue lacks - #40
Merged
Merged
Conversation
serve now builds every combo venue's board in the background at start-up and again every refresh_interval_s ([combo_board] warm, refresh_interval_s, pause_s), keeping the last good board, so the board route never waits on a build. The board is served in parts: GET /trading/combos/board/categories for the rail, and category / cursor / limit / q / sort pages on the board route. Polymarket's catalogue is about 214,000 markets; Gamma reads are cached between builds, and a first build publishes partial boards. The build stays off the event loop that answers health checks and orders: its CPU steps run in worker threads that hand back the GIL every 100 items, the GIL switch interval drops to 0.5 ms while boards are warmed, and the board's objects are frozen out of the cyclic collector as they are built. Requests stay under 0.8 s during a whole-catalogue build (before: 1-6 s). An RFQ group now matches every leg before skipping a venue, and each skip lists missing_legs (market_id, label, code, mapped_id, detail), with codes missing_leg, matching_error, ineligible_leg and outside_collections; labels come from the warm board, else a shortened catalogue question. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Experimental line only (
codex/order-lifecycle-storage), not formain.What changes
refresh_interval_s([combo_board] warm,refresh_interval_s = 60,pause_s = 0.1). It keeps the last good board, so the board route never waits on a build. While the first build runs, the route answersstatus: "building"at once.GET /trading/combos/board/categoriesfor the category rail. The board route now takescategory,cursor,limit,qandsort; the whole-board call still works.BoardCache), and a first build publishes partial boards after page 5 and then every 40 pages.missing_legs(market_id,label,code,mapped_id,detail), with codesmissing_leg,matching_error,ineligible_leg, and the newoutside_collectionsfor Kalshi. Labels come from the warm board ("Al Fayha to win"), else a shortened catalogue question.gc.freeze) as they are built. Profiling showed full garbage collections over the board's objects were the main stall (0.3-1.4 s each).No public Python interface from #39 is renamed or used differently here.
Measured on the real Polymarket catalogue
Concerns
[combo_board] warm = falseturns warming off.Tests
tests/test_combo_warmer.py(16 tests). Its Gamma rows are real, saved intests/samples/polymarket_combo_skip_legs_live.json.The terminal side is on Synpath-ai/prediction_market#104.
🤖 Generated with Claude Code