Repository navigation
Add Betfair Exchange and Smarkets (market data and streams) - #33
Merged
Merged
Conversation
Two betting exchanges as venues, read side only. Each runner or contract is a binary YES/NO market (betfair:<marketId>-<selectionId>, smarkets:<marketId>-<contractId>) and the exchange market is its event, the way multi-outcome events already work. Betfair (betfair): interactive and certificate login with session keep-alive, catalogue, events and books batched under the request-weight limit, the CLASSIC odds ladder, a net-market-winnings commission fee type, and an Exchange Stream API client over TLS. Built for the free delayed app key: books are marked delayed and the stream warns that it is conflated to three minutes. Back offers are YES asks at 1/odds and lay offers YES bids. Smarkets (smarkets): public market data with no login (events, markets, contracts, quotes, volumes, last prices, states, recent trades, search), prices in basis points and quantities in 1/10,000 of a pound contract, 2% commission on net winnings, an optional session login, and a polled market stream, since push streaming is for approved API users only. Neither venue trades yet; Client.trading() says so. init and doctor say what each credential is for. Docs cover the delayed data, API region blocks and the licence terms on showing prices to others. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
YukiC0804
force-pushed
the
sp/betfair-delayed
branch
from
October 21, 2026 11:14
fa2a5bd to
d3cbabc
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 21, 2026
YukiC0804
pushed a commit
that referenced
this pull request
Oct 21, 2026
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>
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.
Adds two betting exchanges as venues, read side only. Neither trades yet.
Mapping
betfair:<marketId>-<selectionId>(a non-zero handicap adds-<handicap>) andsmarkets:<marketId>-<contractId>. The exchange market is its event, the way multi-outcome events already work.net_market_winningsfee type: Betfair at the market base rate, Smarkets at 2%.Betfair (
betfair), for the free delayed app keydelayed.clk. It warns once that a delayed key is conflated to 3 minutes.Smarkets (
smarkets), with no login needed for market datasynpath/<version>.Also
Client.trading("betfair" | "smarkets")raises NotSupported.initanddoctorsay what each credential is for.notavenueas their unknown-venue example.Tests
Not verified live
Merge order
Overlaps with #32 in credentials, init, feeds and docs. Merge #32 first, then rebase this.
🤖 Generated with Claude Code