Repository navigation
serve: library parity for data and buckets (into experimental branch) - #30
Merged
Merged
Conversation
…, hosted, bucket books)
synpath serve now carries every data feature the terminal needs, so the
terminal's web backend can be a router with no venue connections or keys.
- Auth: every market-data route and stream requires the serve token.
- /ws/market: live books, trades and quotes for all venues, one shared
reference-counted venue connection per market, shared with the
engine's feeds; reconnect with a fresh snapshot.
- Batch reads and search: /markets?ids=, /books?ids=, /search/markets,
/search/events, with per-id errors.
- Hosted routes: /matching/market|event|arbitrage and /history/* through
serve's Synpath key, with mapped errors.
- Buckets: client ids, PATCH, a merged bucket book on /ws/market built
with router.view/merge, and POST /trading/buckets/{id}/plan.
- BucketMember.enabled: an Off member is not streamed, merged or routed.
Alembic revision 0003 adds bucket_members.enabled (default on); schema 8.
- tests/serve_harness.py: in-process serve with mocked venues, SQLite and
PostgreSQL.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On CI's slower runners the bucket tests reached for the fake Polymarket stream before the hub had opened it (KeyError: 'polymarket'). The harness now waits for it, polling the dict directly so the helper also works inside conditions that already run on the server's loop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Smarkets sends up to nine fraction digits. The digit scan also picked up the time zone's digits, and Python 3.10's fromisoformat takes only three or six fraction digits, so every timestamp came back as None there. Take the leading digits only and pad them to six. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps #30's venue_streams / market_stream / MarketStreams structure and fits main into it: - venue_streams accepts a MarketDataKey (Opinion, predict.fun, SX Bet) and builds the market stream alone from it, with a keyed catalog where no adapter supplies one; market_stream and default_streams(market_data) go through it. - Betfair and Smarkets market streams (Smarkets without credentials). - SX Bet's account stream only with an account address, warning otherwise. - serve always loads market_data, passes it to default_streams and to the /ws/market factory, and gives the read app's default VenueRegistry its dotenv keys; #30's auth dependency, hosted routes and buckets stay. - The dotenv read-app test sends serve's access token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
YukiC0804
pushed a commit
that referenced
this pull request
Oct 21, 2026
Merges cleanly. Main's trading changes (SX Bet's key-only trading, Betfair and Smarkets instruments, init/doctor) build no OrderRequest, Order or Fill and bring back no reduce_only or fair values, so nothing needed porting to outcome + action. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
smarkets: parse nanosecond timestamps on Python 3.10
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Targets
codex/order-lifecycle-storage, notmain. Part 1 of the terminal plan (terminal/specs/draft/ORDER_PLACEMENT_PLAN.mdin prediction_market): all data and trading live insynpath serve; the terminal's web backend becomes a router with no venue connections or keys. No merge to main, no release.Changes
/,/health,/docsstay open.WS /ws/marketfor books, trades and quotes on all 8 venues. One shared, reference-counted venue connection per market, shared with the engine'sFeeds(screen and stops see the same book). Reconnect withready:falsethen a fresh snapshot.Feeds.dispatchonly hands the engine books for markets it watches./markets?ids=,/books?ids=(≤100 ids, per-id errors),/search/markets,/search/events./matching/market,/matching/event,/matching/arbitrage,/history/order-book/at|range,/history/trades/rangeusing serve's Synpath key; hosted errors mapped.PATCH /trading/buckets/{id}, a mergedbucket_bookon/ws/market(libraryrouter.view/merge, flip handled),POST /trading/buckets/{id}/plan(libraryrouter.plan, nothing placed).BucketMember.enabled; an Off member is not streamed, merged or routed (including orders on a bucket). Alembic revision 0003 addsbucket_members.enabled(default on), schema version 8; existing buckets load with every member On.tests/serve_harness.py(in-process serve, mocked venues, SQLite and PostgreSQL) and serve tests for auth, streams, batch, hosted and buckets.Verification (offline only, no venue calls)
SYNPATH_TEST_POSTGRES_DSN, throwaway postgres:16): 2511 passed, 3 skipped.After merge
Bump
synpath-sdk-revisionin prediction_market to the merged commit (the terminal PR depends on this).🤖 Generated with Claude Code